Cocoa: Send expose event on screen change.

Required to repaint OpenGL content properly.

Task-number: QTBUG-38105
Change-Id: Ie9441d56bd9d1a4eb399210369592f03e19c4929
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
This commit is contained in:
Morten Johan Sørvig 2014-04-09 12:16:09 +02:00 committed by The Qt Project
parent 78af725907
commit bab494e4d0
3 changed files with 5 additions and 1 deletions

View File

@ -272,6 +272,7 @@ public: // for QNSView
bool m_geometryUpdateExposeAllowed;
bool m_isExposed;
QRect m_exposedGeometry;
qreal m_exposedDevicePixelRatio;
int m_registerTouchCount;
bool m_resizableTransientParent;
bool m_hiddenByClipping;

View File

@ -1710,6 +1710,7 @@ void QCocoaWindow::exposeWindow()
if (!m_isExposed) {
m_isExposed = true;
m_exposedGeometry = geometry();
m_exposedDevicePixelRatio = devicePixelRatio();
QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry()));
}
}
@ -1735,11 +1736,12 @@ void QCocoaWindow::updateExposedGeometry()
if (!isWindowExposable())
return;
if (m_exposedGeometry == geometry())
if (m_exposedGeometry == geometry() && m_exposedDevicePixelRatio == devicePixelRatio())
return;
m_isExposed = true;
m_exposedGeometry = geometry();
m_exposedDevicePixelRatio = devicePixelRatio();
QWindowSystemInterface::handleExposeEvent(window(), QRegion(geometry()));
}

View File

@ -329,6 +329,7 @@ static QTouchDevice *touchDevice = 0;
if (m_window) {
NSUInteger screenIndex = [[NSScreen screens] indexOfObject:self.window.screen];
if (screenIndex != NSNotFound) {
m_platformWindow->updateExposedGeometry();
QCocoaScreen *cocoaScreen = QCocoaIntegration::instance()->screenAtIndex(screenIndex);
QWindowSystemInterface::handleWindowScreenChanged(m_window, cocoaScreen->screen());
}