From 0481c2dfbbcc59b76bde3f72fbe6d1e4003c913a Mon Sep 17 00:00:00 2001 From: Carlos Manuel Duclos Vergara Date: Thu, 21 Jan 2010 10:17:29 +0100 Subject: Menubar and dock disappear after hiding a fullscreen widget on Cocoa. The problem here was exiting the full screen mode. In Cocoa we don't activate windows as we do in Carbon, therefore we were not exiting from the full screen mode. This patch adds a check when hiding a window, if the window is in full screen mode then we go through the list of top level windows checking if there are any other visible and not-minimized windows that are also in full screen mode. If none if found, the we exit the full screen mode. Task-number: QTBUG-7312 Reviewed-by: Prasanth --- src/gui/kernel/qwidget_mac.mm | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index b18830f..3dbc843 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -3414,6 +3414,38 @@ void QWidgetPrivate::hide_sys() ShowHide(window, false); #else [window orderOut:window]; + // Unfortunately it is not as easy as just hiding the window, we need + // to find out if we were in full screen mode. If we were and this is + // the last window in full screen mode then we need to unset the full screen + // mode. If this is not the last visible window in full screen mode then we + // don't change the full screen mode. + if(q->isFullScreen()) + { + bool keepFullScreen = false; + QWidgetList windowList = qApp->topLevelWidgets(); + int windowCount = windowList.count(); + for(int i = 0; i < windowCount; i++) + { + QWidget *w = windowList[i]; + // If it is the same window, we don't need to check :-) + if(q == w) + continue; + // If they are not visible or if they are minimized then + // we just ignore them. + if(!w->isVisible() || w->isMinimized()) + continue; + // Is it full screen? + // Notice that if there is one window in full screen mode then we + // cannot switch the full screen mode off, therefore we just abort. + if(w->isFullScreen()) { + keepFullScreen = true; + break; + } + } + // No windows in full screen mode, so let just unset that flag. + if(!keepFullScreen) + qt_mac_set_fullscreen_mode(false); + } #endif toggleDrawers(false); #ifndef QT_MAC_USE_COCOA -- cgit v0.12