summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoaintegration.mm
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@qt.io>2019-08-28 14:37:25 +0200
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2019-08-29 17:27:37 +0200
commit048e66a11d87845eaba9e8cf23de3fb4acac924d (patch)
tree63adfa1b594b32e42e55d0f4bca606307afc0112 /src/plugins/platforms/cocoa/qcocoaintegration.mm
parentea1c8d4e65676bf49ad0ae8e4e0d390fb7be37f6 (diff)
Close popups on windowWillMiniaturize notification
We do this on windowDidMove/windowWillClose, but we don't on a 'will miniaturize' notification. This can leave an application with an orphan popup window, such as context menu which looks really weird. I err on a safe side though - I don't close all popups - the application's logic can be such that it has several windows and one of them gets minimized (we can do this via QWidget's interface, for example) - would be strange if all popups close. So I only close popups that have the miniaturized window as a transient parent. Task-number: QTBUG-77833 Change-Id: Ib655a27c0ce8661f9e7156e6035f7fffaff901b1 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoaintegration.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index 9a2f19c2f2..67ad0b3492 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -487,6 +487,19 @@ void QCocoaIntegration::beep() const
NSBeep();
}
+void QCocoaIntegration::closePopups(QWindow *forWindow)
+{
+ for (auto it = m_popupWindowStack.begin(); it != m_popupWindowStack.end();) {
+ auto *popup = *it;
+ if (!forWindow || popup->window()->transientParent() == forWindow) {
+ it = m_popupWindowStack.erase(it);
+ QWindowSystemInterface::handleCloseEvent<QWindowSystemInterface::SynchronousDelivery>(popup->window());
+ } else {
+ ++it;
+ }
+ }
+}
+
void QCocoaIntegration::focusWindowChanged(QWindow *focusWindow)
{
// Don't revert icon just because we lost focus