Cocoa: refactor commit 876a428f.

Conditions for when updateExposedGeometry() should
actually send the expose event goes into the function
itself.

The window()->isVisible() check could arguably be
moved to isWindowExposable(), but I'm keeping this
as a straight refactor without any behavior changes.
(isWindowExposable() is called from multiple locations)

Change-Id: I6d792286ccbc50065ebfc588daca2240761a1937
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
This commit is contained in:
Morten Johan Sørvig 2014-10-30 16:52:36 +01:00
parent a2ce7e6a6f
commit bb31aa853e
2 changed files with 7 additions and 6 deletions

View File

@ -1754,6 +1754,11 @@ void QCocoaWindow::updateExposedGeometry()
if (!m_geometryUpdateExposeAllowed)
return;
// 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 (!window()->isVisible())
return;
if (!isWindowExposable())
return;

View File

@ -361,12 +361,8 @@ 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);
// 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();
}
m_platformWindow->updateExposedGeometry();
QWindowSystemInterface::flushWindowSystemEvents();
}
}