summaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2022-09-19 17:59:12 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-09-20 14:35:06 +0000
commit9702e8107fbd140f051dfb69dd54eda81f4ded72 (patch)
tree717dcf404a775fe3b573c28a25a706c48a38109a /src/plugins
parentdba46183cd4e5d34e155a36650ef5d1d01625faa (diff)
downloadqtbase-9702e8107fbd140f051dfb69dd54eda81f4ded72.tar.gz
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>
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index ff8a15f0d6..67f940ded8 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -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)