macOS: Correctly restart display-link when window is moved between screens

Change-Id: I4b9cdd3d259965f9094ef1bbbca3ebed8df18443
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
This commit is contained in:
Tor Arne Vestbø 2018-07-09 14:27:11 +02:00
parent 97e88dcb92
commit d6fb64267f

View File

@ -1070,10 +1070,12 @@ void QCocoaWindow::windowDidChangeScreen()
if (!window())
return;
const bool wasRunningDisplayLink = static_cast<QCocoaScreen *>(screen())->isRunningDisplayLink();
if (QCocoaScreen *cocoaScreen = QCocoaIntegration::instance()->screenForNSScreen(m_view.window.screen)) {
QWindowSystemInterface::handleWindowScreenChanged<QWindowSystemInterface::SynchronousDelivery>(window(), cocoaScreen->screen());
if (hasPendingUpdateRequest() && cocoaScreen->isRunningDisplayLink())
if (hasPendingUpdateRequest() && wasRunningDisplayLink)
requestUpdate(); // Restart display-link on new screen
}
}