Cocoa: avoid sending exposes too early

Expose events trigger backing store sync and thus paint events
on QGLWidgets. Sending the exposes too early may lead to failures
in the OpenGL calls. Sending exposes before even getting to calling
setVisible(true) in QWidget::show() is just wrong.

Task-number: QTBUG-36802
Change-Id: Ic7d5125f4e257d715009811217e453d79d0fcc7c
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
This commit is contained in:
Laszlo Agocs 2014-10-22 17:53:24 +02:00
parent 591bce8f68
commit 876a428f60

View File

@ -361,8 +361,12 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil;
// Send a geometry change event to Qt, if it's ready to handle events
if (!m_platformWindow->m_inConstructor) {
QWindowSystemInterface::handleGeometryChange(m_window, geometry);
m_platformWindow->updateExposedGeometry();
QWindowSystemInterface::flushWindowSystemEvents();
// Do not send incorrect exposes in case the window is not even visible yet.
// We might get here as a result of a resize() from QWidget's show(), for instance.
if (m_platformWindow->window()->isVisible()) {
m_platformWindow->updateExposedGeometry();
QWindowSystemInterface::flushWindowSystemEvents();
}
}
}