Changeset 50498 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Feb 18, 2014 4:23:28 PM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 92340
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp
r50493 r50498 506 506 { 507 507 case UIVisualStateType_Normal: return Qt::Window; 508 #ifdef Q_WS_MAC 509 /* We want normal window for native fullscreen mode on ML and next: */ 510 case UIVisualStateType_Fullscreen: return vboxGlobal().osRelease() > MacOSXRelease_Lion ? Qt::Window : Qt::FramelessWindowHint; 511 #else /* !Q_WS_MAC */ 508 512 case UIVisualStateType_Fullscreen: return Qt::FramelessWindowHint; 513 #endif /* !Q_WS_MAC */ 509 514 case UIVisualStateType_Seamless: return Qt::FramelessWindowHint; 510 515 case UIVisualStateType_Scale: return Qt::Window; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp
r50490 r50498 97 97 } 98 98 99 #ifdef RT_OS_DARWIN 100 void UIMachineLogicFullscreen::sltHandleNativeFullscreenDidEnter() 101 { 102 /* Make sure this method is only used for ML and next: */ 103 AssertReturnVoid(vboxGlobal().osRelease() > MacOSXRelease_Lion); 104 105 /* Get sender machine-window: */ 106 UIMachineWindow *pMachineWindow = qobject_cast<UIMachineWindow*>(sender()); 107 AssertReturnVoid(pMachineWindow); 108 109 /* Add machine-window to corresponding set: */ 110 m_fullscreenMachineWindows.insert(pMachineWindow); 111 AssertReturnVoid(m_fullscreenMachineWindows.contains(pMachineWindow)); 112 } 113 114 void UIMachineLogicFullscreen::sltHandleNativeFullscreenDidExit() 115 { 116 /* Make sure this method is only used for ML and next: */ 117 AssertReturnVoid(vboxGlobal().osRelease() > MacOSXRelease_Lion); 118 119 /* Get sender machine-window: */ 120 UIMachineWindow *pMachineWindow = qobject_cast<UIMachineWindow*>(sender()); 121 AssertReturnVoid(pMachineWindow); 122 123 /* Remove machine-window from corresponding set: */ 124 bool fResult = m_fullscreenMachineWindows.remove(pMachineWindow); 125 AssertReturnVoid(fResult && !m_fullscreenMachineWindows.contains(pMachineWindow)); 126 Q_UNUSED(fResult); 127 128 /* Exit fullscreen mode if there is/are no fullscreen window(s) left: */ 129 if (m_fullscreenMachineWindows.isEmpty()) 130 { 131 /* Change visual-state to requested: */ 132 LogRel(("UIMachineLogicFullscreen::sltHandleNativeFullscreenDidExit: " 133 "Machine-window(s) exited fullscreen, changing visual-state to requested...\n")); 134 UIVisualStateType type = uisession()->requestedVisualState(); 135 if (type == UIVisualStateType_Invalid) 136 type = UIVisualStateType_Normal; 137 uisession()->setRequestedVisualState(UIVisualStateType_Invalid); 138 uisession()->changeVisualState(type); 139 } 140 } 141 142 void UIMachineLogicFullscreen::sltChangeVisualStateToNormal() 143 { 144 /* Base-class handling for Lion and previous: */ 145 if (vboxGlobal().osRelease() <= MacOSXRelease_Lion) 146 UIMachineLogic::sltChangeVisualStateToNormal(); 147 /* Special handling for ML and next: */ 148 else 149 { 150 /* Request 'normal' (window) visual-state: */ 151 uisession()->setRequestedVisualState(UIVisualStateType_Normal); 152 /* Toggle native fullscreen mode for each window: */ 153 foreach (UIMachineWindow *pMachineWindow, machineWindows()) 154 darwinToggleFullscreenMode(pMachineWindow); 155 } 156 } 157 158 void UIMachineLogicFullscreen::sltChangeVisualStateToSeamless() 159 { 160 /* Base-class handling for Lion and previous: */ 161 if (vboxGlobal().osRelease() <= MacOSXRelease_Lion) 162 UIMachineLogic::sltChangeVisualStateToSeamless(); 163 /* Special handling for ML and next: */ 164 else 165 { 166 /* Request 'seamless' visual-state: */ 167 uisession()->setRequestedVisualState(UIVisualStateType_Seamless); 168 /* Toggle native fullscreen mode for each window: */ 169 foreach (UIMachineWindow *pMachineWindow, machineWindows()) 170 darwinToggleFullscreenMode(pMachineWindow); 171 } 172 } 173 174 void UIMachineLogicFullscreen::sltChangeVisualStateToScale() 175 { 176 /* Base-class handling for Lion and previous: */ 177 if (vboxGlobal().osRelease() <= MacOSXRelease_Lion) 178 UIMachineLogic::sltChangeVisualStateToScale(); 179 /* Special handling for ML and next: */ 180 else 181 { 182 /* Request 'scale' visual-state: */ 183 uisession()->setRequestedVisualState(UIVisualStateType_Scale); 184 /* Toggle native fullscreen mode for each window: */ 185 foreach (UIMachineWindow *pMachineWindow, machineWindows()) 186 darwinToggleFullscreenMode(pMachineWindow); 187 } 188 } 189 #endif /* RT_OS_DARWIN */ 190 99 191 void UIMachineLogicFullscreen::sltMachineStateChanged() 100 192 { … … 191 283 void UIMachineLogicFullscreen::prepareOtherConnections() 192 284 { 193 /* Presentation mode connection: */ 194 connect(gEDataEvents, SIGNAL(sigPresentationModeChange(bool)), 195 this, SLOT(sltChangePresentationMode(bool))); 285 /* Make sure 'presentation mode' is updated for Lion and previous: */ 286 if (vboxGlobal().osRelease() <= MacOSXRelease_Lion) 287 connect(gEDataEvents, SIGNAL(sigPresentationModeChange(bool)), 288 this, SLOT(sltChangePresentationMode(bool))); 196 289 } 197 290 #endif /* Q_WS_MAC */ … … 222 315 223 316 #ifdef Q_WS_MAC 224 /* If the user change the screen, we have to decide again if the 225 * presentation mode should be changed. */ 226 connect(m_pScreenLayout, SIGNAL(sigScreenLayoutChanged()), 227 this, SLOT(sltScreenLayoutChanged())); 228 /* Note: Presentation mode has to be set *after* the windows are created. */ 229 setPresentationModeEnabled(true); 317 /* Make sure 'presentation mode' is enabled/updated for Lion and previous: */ 318 if (vboxGlobal().osRelease() <= MacOSXRelease_Lion) 319 { 320 connect(m_pScreenLayout, SIGNAL(sigScreenLayoutChanged()), 321 this, SLOT(sltScreenLayoutChanged())); 322 setPresentationModeEnabled(true); 323 } 324 #endif /* Q_WS_MAC */ 325 326 #ifdef Q_WS_MAC 327 /* Keep sync for machine-logic/window(s) in ML and next: */ 328 if (vboxGlobal().osRelease() > MacOSXRelease_Lion) 329 { 330 foreach (UIMachineWindow *pMachineWindow, machineWindows()) 331 { 332 connect(pMachineWindow, SIGNAL(sigNotifyAboutNativeFullscreenDidEnter()), 333 this, SLOT(sltHandleNativeFullscreenDidEnter())); 334 connect(pMachineWindow, SIGNAL(sigNotifyAboutNativeFullscreenDidExit()), 335 this, SLOT(sltHandleNativeFullscreenDidExit())); 336 } 337 } 230 338 #endif /* Q_WS_MAC */ 231 339 … … 253 361 setMachineWindowsCreated(false); 254 362 363 #ifdef Q_WS_MAC 364 /* Leave sync for machine-logic/window(s) in ML and next: */ 365 if (vboxGlobal().osRelease() > MacOSXRelease_Lion) 366 { 367 foreach (UIMachineWindow *pMachineWindow, machineWindows()) 368 { 369 disconnect(pMachineWindow, SIGNAL(sigNotifyAboutNativeFullscreenDidEnter()), 370 this, SLOT(sltHandleNativeFullscreenDidEnter())); 371 disconnect(pMachineWindow, SIGNAL(sigNotifyAboutNativeFullscreenDidExit()), 372 this, SLOT(sltHandleNativeFullscreenDidExit())); 373 } 374 } 375 #endif/* Q_WS_MAC */ 376 255 377 /* Cleanup machine-window(s): */ 256 378 foreach (UIMachineWindow *pMachineWindow, machineWindows()) … … 258 380 259 381 #ifdef Q_WS_MAC 260 setPresentationModeEnabled(false); 382 /* Make sure 'presentation mode' is disabled for Lion and previous: */ 383 if (vboxGlobal().osRelease() <= MacOSXRelease_Lion) 384 setPresentationModeEnabled(false); 261 385 #endif/* Q_WS_MAC */ 262 386 } … … 298 422 void UIMachineLogicFullscreen::setPresentationModeEnabled(bool fEnabled) 299 423 { 424 /* Make sure this method is only used for Lion and previous: */ 425 AssertReturnVoid(vboxGlobal().osRelease() <= MacOSXRelease_Lion); 426 300 427 /* First check if we are on a screen which contains the Dock or the 301 428 * Menubar (which hasn't to be the same), only than the -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h
r49505 r50498 45 45 private slots: 46 46 47 #ifdef RT_OS_DARWIN 48 /** Mac OS X: Marks sender() machine-window as 'fullscreen' one. */ 49 void sltHandleNativeFullscreenDidEnter(); 50 /** Mac OS X: Marks sender() machine-window as 'non-fullscreen' one, 51 * changes visual-state to requested if there is/are no more fullscreen window(s). */ 52 void sltHandleNativeFullscreenDidExit(); 53 54 /** Mac OS X: Requests visual-state change from 'fullscreen' to 'normal' (window). */ 55 void sltChangeVisualStateToNormal(); 56 /** Mac OS X: Requests visual-state change from 'fullscreen' to 'seamless'. */ 57 void sltChangeVisualStateToSeamless(); 58 /** Mac OS X: Requests visual-state change from 'fullscreen' to 'scale'. */ 59 void sltChangeVisualStateToScale(); 60 #endif /* RT_OS_DARWIN */ 61 47 62 /* Handler: Console callback stuff: */ 48 63 void sltMachineStateChanged(); … … 82 97 UIMultiScreenLayout *m_pScreenLayout; 83 98 99 #ifdef Q_WS_MAC 100 /** Mac OS X: Contains machine-window(s) marked as 'fullscreen'. */ 101 QSet<UIMachineWindow*> m_fullscreenMachineWindows; 102 #endif /* Q_WS_MAC */ 103 84 104 /* Friend classes: */ 85 105 friend class UIMachineLogic; -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp
r49758 r50498 32 32 #include "UIMachineDefs.h" 33 33 #include "UIMiniToolBar.h" 34 #ifdef Q_WS_MAC 35 # include "VBoxUtils-darwin.h" 36 # include "UICocoaApplication.h" 37 #endif /* Q_WS_MAC */ 34 38 35 39 /* COM includes: */ … … 42 46 { 43 47 } 48 49 #ifdef Q_WS_MAC 50 void UIMachineWindowFullscreen::handleNativeNotification(const QString &strNativeNotificationName) 51 { 52 /* Make sure this method is only used for ML and next: */ 53 AssertReturnVoid(vboxGlobal().osRelease() > MacOSXRelease_Lion); 54 55 /* Handle arrived notification: */ 56 LogRel(("UIMachineWindowFullscreen::handleNativeNotification: Notification '%s' received.\n", 57 strNativeNotificationName.toAscii().constData())); 58 /* Handle 'NSWindowDidEnterFullScreenNotification' notification: */ 59 if (strNativeNotificationName == "NSWindowDidEnterFullScreenNotification") 60 { 61 LogRel(("UIMachineWindowFullscreen::handleNativeNotification: " 62 "Native fullscreen mode entered, notifying listener...\n")); 63 emit sigNotifyAboutNativeFullscreenDidEnter(); 64 } 65 /* Handle 'NSWindowDidExitFullScreenNotification' notification: */ 66 else if (strNativeNotificationName == "NSWindowDidExitFullScreenNotification") 67 { 68 LogRel(("UIMachineWindowFullscreen::handleNativeNotification: " 69 "Native fullscreen mode exited, notifying listener...\n")); 70 emit sigNotifyAboutNativeFullscreenDidExit(); 71 } 72 } 73 #endif /* Q_WS_MAC */ 74 75 #ifdef RT_OS_DARWIN 76 void UIMachineWindowFullscreen::sltToggleNativeFullscreenMode() 77 { 78 /* Make sure this method is only used for ML and next: */ 79 AssertReturnVoid(vboxGlobal().osRelease() > MacOSXRelease_Lion); 80 81 /* Toggle native fullscreen mode: */ 82 darwinToggleFullscreenMode(this); 83 } 84 #endif /* RT_OS_DARWIN */ 44 85 45 86 void UIMachineWindowFullscreen::sltMachineStateChanged() … … 88 129 /* Prepare mini-toolbar: */ 89 130 prepareMiniToolbar(); 131 132 #ifdef Q_WS_MAC 133 /* Native fullscreen stuff on ML and next: */ 134 if (vboxGlobal().osRelease() > MacOSXRelease_Lion) 135 { 136 /* Enable native fullscreen support: */ 137 darwinEnableFullscreenSupport(this); 138 /* Register to native fullscreen notifications: */ 139 UICocoaApplication::instance()->registerToNativeNotification("NSWindowDidEnterFullScreenNotification", this, 140 UIMachineWindow::handleNativeNotification); 141 UICocoaApplication::instance()->registerToNativeNotification("NSWindowDidExitFullScreenNotification", this, 142 UIMachineWindow::handleNativeNotification); 143 /* Asynchronously toggle native fullscreen mode: */ 144 QTimer::singleShot(0, this, SLOT(sltToggleNativeFullscreenMode())); 145 } 146 #endif /* Q_WS_MAC */ 90 147 } 91 148 … … 140 197 void UIMachineWindowFullscreen::cleanupVisualState() 141 198 { 199 #ifdef Q_WS_MAC 200 /* Native fullscreen stuff on ML and next: */ 201 if (vboxGlobal().osRelease() > MacOSXRelease_Lion) 202 { 203 /* Unregister from native fullscreen notifications: */ 204 UICocoaApplication::instance()->unregisterFromNativeNotification("NSWindowDidEnterFullScreenNotification", this); 205 UICocoaApplication::instance()->unregisterFromNativeNotification("NSWindowDidExitFullScreenNotification", this); 206 } 207 #endif /* Q_WS_MAC */ 208 142 209 /* Cleanup mini-toolbar: */ 143 210 cleanupMiniToolbar(); … … 199 266 #endif /* Q_WS_WIN */ 200 267 268 #ifdef Q_WS_MAC 269 /* ML and next using native stuff, so we can call for simple show(): */ 270 if (vboxGlobal().osRelease() > MacOSXRelease_Lion) show(); 271 /* Lion and previous still using Qt one, call for showFullScreen(): */ 272 else showFullScreen(); 273 #else /* !Q_WS_MAC */ 201 274 /* Show in fullscreen mode: */ 202 275 showFullScreen(); 276 #endif /* !Q_WS_MAC */ 203 277 204 278 /* Make sure the window is placed on valid screen again -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h
r46244 r50498 31 31 Q_OBJECT; 32 32 33 #ifdef RT_OS_DARWIN 34 signals: 35 /** Mac OS X: Notifies listener about native fullscreen entering. */ 36 void sigNotifyAboutNativeFullscreenDidEnter(); 37 /** Mac OS X: Notifies listener about native fullscreen exiting. */ 38 void sigNotifyAboutNativeFullscreenDidExit(); 39 #endif /* RT_OS_DARWIN */ 40 33 41 protected: 34 42 … … 36 44 UIMachineWindowFullscreen(UIMachineLogic *pMachineLogic, ulong uScreenId); 37 45 46 #ifdef Q_WS_MAC 47 /** Mac OS X: Handles native notifications @a strNativeNotificationName for fullscreen window. */ 48 void handleNativeNotification(const QString &strNativeNotificationName); 49 #endif /* Q_WS_MAC */ 50 38 51 private slots: 52 53 #ifdef RT_OS_DARWIN 54 /** Mac OS X: Toggles native fullscreen mode. */ 55 void sltToggleNativeFullscreenMode(); 56 #endif /* RT_OS_DARWIN */ 39 57 40 58 /* Session event-handlers: */
Note:
See TracChangeset
for help on using the changeset viewer.