src/gui/kernel/qwidget_mac.mm
branchRCL_3
changeset 5 d3bac044e0f0
parent 4 3b1da2848fc7
child 8 3f74d0d4af4c
equal deleted inserted replaced
4:3b1da2848fc7 5:d3bac044e0f0
   402     extern bool qt_mac_app_fullscreen; //qapplication_mac.mm
   402     extern bool qt_mac_app_fullscreen; //qapplication_mac.mm
   403     if(qt_mac_app_fullscreen == b)
   403     if(qt_mac_app_fullscreen == b)
   404         return;
   404         return;
   405     qt_mac_app_fullscreen = b;
   405     qt_mac_app_fullscreen = b;
   406     if (b) {
   406     if (b) {
   407         SetSystemUIMode(kUIModeAllSuppressed, 0);
   407         SetSystemUIMode(kUIModeAllHidden, kUIOptionAutoShowMenuBar);
   408     } else {
   408     } else {
   409         SetSystemUIMode(kUIModeNormal, 0);
   409         SetSystemUIMode(kUIModeNormal, 0);
   410     }
   410     }
   411 }
   411 }
   412 
   412 
  3412         } else {
  3412         } else {
  3413 #ifndef QT_MAC_USE_COCOA
  3413 #ifndef QT_MAC_USE_COCOA
  3414             ShowHide(window, false);
  3414             ShowHide(window, false);
  3415 #else
  3415 #else
  3416             [window orderOut:window];
  3416             [window orderOut:window];
       
  3417             // Unfortunately it is not as easy as just hiding the window, we need
       
  3418             // to find out if we were in full screen mode. If we were and this is
       
  3419             // the last window in full screen mode then we need to unset the full screen
       
  3420             // mode. If this is not the last visible window in full screen mode then we
       
  3421             // don't change the full screen mode.
       
  3422             if(q->isFullScreen())
       
  3423             {
       
  3424                 bool keepFullScreen = false;
       
  3425                 QWidgetList windowList = qApp->topLevelWidgets();
       
  3426                 int windowCount = windowList.count();
       
  3427                 for(int i = 0; i < windowCount; i++)
       
  3428                 {
       
  3429                     QWidget *w = windowList[i];
       
  3430                     // If it is the same window, we don't need to check :-)
       
  3431                     if(q == w)
       
  3432                         continue;
       
  3433                     // If they are not visible or if they are minimized then
       
  3434                     // we just ignore them.
       
  3435                     if(!w->isVisible() || w->isMinimized())
       
  3436                         continue;
       
  3437                     // Is it full screen?
       
  3438                     // Notice that if there is one window in full screen mode then we
       
  3439                     // cannot switch the full screen mode off, therefore we just abort.
       
  3440                     if(w->isFullScreen()) {
       
  3441                         keepFullScreen = true;
       
  3442                         break;
       
  3443                     }
       
  3444                 }
       
  3445                 // No windows in full screen mode, so let just unset that flag.
       
  3446                 if(!keepFullScreen)
       
  3447                     qt_mac_set_fullscreen_mode(false);
       
  3448             }
  3417 #endif
  3449 #endif
  3418             toggleDrawers(false);
  3450             toggleDrawers(false);
  3419 #ifndef QT_MAC_USE_COCOA
  3451 #ifndef QT_MAC_USE_COCOA
  3420             // Clear modality (because it seems something that we've always done).
  3452             // Clear modality (because it seems something that we've always done).
  3421             if (data.window_modality != Qt::NonModal) {
  3453             if (data.window_modality != Qt::NonModal) {
  3476 #endif
  3508 #endif
  3477     }
  3509     }
  3478 
  3510 
  3479     if (!QWidget::mouseGrabber()){
  3511     if (!QWidget::mouseGrabber()){
  3480         QWidget *enterWidget = QApplication::widgetAt(QCursor::pos());
  3512         QWidget *enterWidget = QApplication::widgetAt(QCursor::pos());
       
  3513         if (enterWidget && enterWidget->data->in_destructor)
       
  3514             enterWidget = 0;
  3481         QApplicationPrivate::dispatchEnterLeave(enterWidget, qt_mouseover);
  3515         QApplicationPrivate::dispatchEnterLeave(enterWidget, qt_mouseover);
  3482         qt_mouseover = enterWidget;
  3516         qt_mouseover = enterWidget;
  3483     }
  3517     }
  3484 
  3518 
  3485     qt_event_request_window_change(q);
  3519     qt_event_request_window_change(q);