macOS: Handle asynchronous deminiaturizing of windows

As of macOS 13 this operation is now asynchronous.

Change-Id: I9431e24803c53a3fa455707b20a6814290718766
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
(cherry picked from commit dc1f931a9169484b8f2c39bd1f8d4bd4e148ea14)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Tor Arne Vestbø 2022-09-19 17:59:12 +02:00 committed by Qt Cherry-pick Bot
parent dba46183cd
commit 9702e8107f

View File

@ -690,9 +690,10 @@ void QCocoaWindow::applyWindowState(Qt::WindowStates requestedState)
switch (currentState) {
case Qt::WindowMinimized:
[nsWindow deminiaturize:sender];
Q_ASSERT_X(windowState() != Qt::WindowMinimized, "QCocoaWindow",
"[NSWindow deminiaturize:] is synchronous");
break;
// Deminiaturizing is not synchronous, so we need to wait for the
// NSWindowDidMiniaturizeNotification before continuing to apply
// the new state.
return;
case Qt::WindowFullScreen: {
toggleFullScreen();
// Exiting fullscreen is not synchronous, so we need to wait for the
@ -858,7 +859,15 @@ void QCocoaWindow::windowDidDeminiaturize()
if (!isContentView())
return;
Qt::WindowState requestedState = window()->windowState();
handleWindowStateChanged();
if (requestedState != windowState() && requestedState != Qt::WindowMinimized) {
// We were only going out of minimized as an intermediate step before
// progressing into the final step, so re-sync the desired state.
applyWindowState(requestedState);
}
}
void QCocoaWindow::handleWindowStateChanged(HandleFlags flags)