summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-02-19 11:14:53 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-02-20 01:30:01 +0000
commit2fc4635e9889ade1ae79b787cc18aae654e65e3b (patch)
treebc39b762a18c6584e268d95501e484e6f16a1f82 /src/plugins/platforms
parent4c759340081384e7b9fae5d2179d25016dc1dda6 (diff)
macOS: Remove special handling for hiding tool windows on application hide
The code was needed when we had QCocoaWindow::hide(), that guarded the ordering out by checking the visible state of the NSWindow. We no longer have that method, and setVisible doesn't have the same guard. Added a comment in setVisible to prevent future travelers from adding logic that introduces the same situation. Change-Id: I0514619a303daceb1cd7d334f0de4bfce6c3e96f Reviewed-by: Andy Shaw <andy.shaw@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm36
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm5
2 files changed, 5 insertions, 36 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
index 9e3c89b6a4..e255719cc1 100644
--- a/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
+++ b/src/plugins/platforms/cocoa/qcocoaapplicationdelegate.mm
@@ -94,7 +94,6 @@ QT_USE_NAMESPACE
bool startedQuit;
NSObject <NSApplicationDelegate> *reflectionDelegate;
bool inLaunch;
- QWindowList hiddenWindows;
}
+ (instancetype)sharedDelegate
@@ -311,41 +310,6 @@ QT_USE_NAMESPACE
return NO; // Someday qApp->quitOnLastWindowClosed(); when QApp and NSApp work closer together.
}
-- (void)applicationWillHide:(NSNotification *)notification
-{
- if (reflectionDelegate
- && [reflectionDelegate respondsToSelector:@selector(applicationWillHide:)]) {
- [reflectionDelegate applicationWillHide:notification];
- }
-
- // When the application is hidden Qt will hide the popup windows associated with
- // it when it has lost the activation for the application. However, when it gets
- // to this point it believes the popup windows to be hidden already due to the
- // fact that the application itself is hidden, which will cause a problem when
- // the application is made visible again.
- const QWindowList topLevelWindows = QGuiApplication::topLevelWindows();
- for (QWindow *topLevelWindow : topLevelWindows) {
- if ((topLevelWindow->type() & Qt::Popup) == Qt::Popup && topLevelWindow->isVisible()) {
- topLevelWindow->hide();
-
- if ((topLevelWindow->type() & Qt::Tool) == Qt::Tool)
- hiddenWindows << topLevelWindow;
- }
- }
-}
-
-- (void)applicationDidUnhide:(NSNotification *)notification
-{
- if (reflectionDelegate
- && [reflectionDelegate respondsToSelector:@selector(applicationDidUnhide:)])
- [reflectionDelegate applicationDidUnhide:notification];
-
- for (QWindow *window : qAsConst(hiddenWindows))
- window->show();
-
- hiddenWindows.clear();
-}
-
- (void)applicationDidBecomeActive:(NSNotification *)notification
{
if (reflectionDelegate
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index d1047e1965..50adbad518 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -400,6 +400,11 @@ void QCocoaWindow::setVisible(bool visible)
}
}
+ // Note: We do not guard the order out by checking NSWindow.visible, as AppKit will
+ // in some cases, such as when hiding the application, order out and make a window
+ // invisible, but keep it in a list of "hidden windows", that it then restores again
+ // when the application is unhidden. We need to call orderOut explicitly, to bring
+ // the window out of this "hidden list".
[m_view.window orderOut:nil];
if (m_view.window == [NSApp keyWindow] && !eventDispatcher()->hasModalSession()) {