Changeset 50634 in vbox for trunk/src/VBox/Frontends/VirtualBox
- Timestamp:
- Feb 27, 2014 3:53:39 PM (11 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp
r50631 r50634 132 132 if (!m_fullscreenMachineWindows.isEmpty()) 133 133 { 134 /* Ask remain window(s) to exit fullscreen too: */ 135 foreach (UIMachineWindow *pMachineWindow, machineWindows()) 136 if (darwinIsInFullscreenMode(pMachineWindow)) 137 darwinToggleFullscreenMode(pMachineWindow); 134 /* Exit fullscreen mode if it was not invalidated yet: */ 135 if (!m_fIsFullscreenInvalidated) 136 emit sigNotifyAboutNativeFullscreenShouldBeExited(); 138 137 } 139 138 /* If there is/are no more fullscreen window(s) left: */ … … 153 152 foreach (UIMachineWindow *pMachineWindow, machineWindows()) 154 153 pMachineWindow->showInNecessaryMode(); 155 /* Re-enter fullscreen mode: */ 156 foreach (UIMachineWindow *pMachineWindow, machineWindows()) 157 if ( uisession()->isScreenVisible(pMachineWindow->screenId()) 158 && (darwinScreensHaveSeparateSpaces() || pMachineWindow->screenId() == 0) 159 && !darwinIsInFullscreenMode(pMachineWindow)) 160 darwinToggleFullscreenMode(pMachineWindow); 154 /* Ask all window(s) to re-enter fullscreen mode: */ 155 emit sigNotifyAboutNativeFullscreenShouldBeEntered(); 161 156 } 162 157 /* If fullscreen mode was manually exited: */ … … 186 181 /* Request 'normal' (window) visual-state: */ 187 182 uisession()->setRequestedVisualState(UIVisualStateType_Normal); 188 /* Exit native fullscreen mode for each window: */ 189 foreach (UIMachineWindow *pMachineWindow, machineWindows()) 190 if (darwinIsInFullscreenMode(pMachineWindow)) 191 darwinToggleFullscreenMode(pMachineWindow); 183 /* Ask all window(s) to exit fullscreen mode: */ 184 emit sigNotifyAboutNativeFullscreenShouldBeExited(); 192 185 } 193 186 } … … 203 196 /* Request 'seamless' visual-state: */ 204 197 uisession()->setRequestedVisualState(UIVisualStateType_Seamless); 205 /* Exit native fullscreen mode for each window: */ 206 foreach (UIMachineWindow *pMachineWindow, machineWindows()) 207 if (darwinIsInFullscreenMode(pMachineWindow)) 208 darwinToggleFullscreenMode(pMachineWindow); 198 /* Ask all window(s) to exit fullscreen mode: */ 199 emit sigNotifyAboutNativeFullscreenShouldBeExited(); 209 200 } 210 201 } … … 220 211 /* Request 'scale' visual-state: */ 221 212 uisession()->setRequestedVisualState(UIVisualStateType_Scale); 222 /* Exit native fullscreen mode for each window: */ 223 foreach (UIMachineWindow *pMachineWindow, machineWindows()) 224 if (darwinIsInFullscreenMode(pMachineWindow)) 225 darwinToggleFullscreenMode(pMachineWindow); 213 /* Ask all window(s) to exit fullscreen mode: */ 214 emit sigNotifyAboutNativeFullscreenShouldBeExited(); 226 215 } 227 216 } … … 270 259 } 271 260 /* Invalidate fullscreen mode for ML and next: */ 272 else invalidateFullscreenMode(); 261 else if (shouldWeInvalidateFullscreenMode()) 262 invalidateFullscreenMode(); 263 else 264 { 265 /* Make sure all machine-window(s) have proper geometry: */ 266 foreach (UIMachineWindow *pMachineWindow, machineWindows()) 267 pMachineWindow->showInNecessaryMode(); 268 } 273 269 #else /* !Q_WS_MAC */ 274 270 /* Make sure all machine-window(s) have proper geometry: */ … … 292 288 UIMachineLogic::sltGuestMonitorChange(changeType, uScreenId, screenGeo); 293 289 /* Invalidate fullscreen mode for ML and next: */ 294 else invalidateFullscreenMode(); 290 else if (shouldWeInvalidateFullscreenMode()) 291 invalidateFullscreenMode(); 292 /* Call to base-class otherwise: */ 293 else UIMachineLogic::sltGuestMonitorChange(changeType, uScreenId, screenGeo); 295 294 #else /* !Q_WS_MAC */ 296 295 /* Call to base-class: */ … … 311 310 UIMachineLogic::sltHostScreenCountChanged(); 312 311 /* Invalidate fullscreen mode for ML and next: */ 313 else invalidateFullscreenMode(); 312 else if (shouldWeInvalidateFullscreenMode()) 313 invalidateFullscreenMode(); 314 /* Call to base-class otherwise: */ 315 else UIMachineLogic::sltHostScreenCountChanged(); 314 316 #else /* !Q_WS_MAC */ 315 317 /* Call to base-class: */ … … 391 393 if (vboxGlobal().osRelease() > MacOSXRelease_Lion) 392 394 { 393 /* For all the machine-window(s): */395 /* Enable native fullscreen support: */ 394 396 foreach (UIMachineWindow *pMachineWindow, machineWindows()) 395 397 { 396 /* Watch for native fullscreen signals: */ 398 /* Logic => window signals: */ 399 connect(this, SIGNAL(sigNotifyAboutNativeFullscreenShouldBeEntered()), 400 pMachineWindow, SLOT(sltEnterNativeFullscreen())); 401 connect(this, SIGNAL(sigNotifyAboutNativeFullscreenShouldBeExited()), 402 pMachineWindow, SLOT(sltExitNativeFullscreen())); 403 /* Window => logic signals: */ 397 404 connect(pMachineWindow, SIGNAL(sigNotifyAboutNativeFullscreenDidEnter()), 398 405 this, SLOT(sltHandleNativeFullscreenDidEnter())); 399 406 connect(pMachineWindow, SIGNAL(sigNotifyAboutNativeFullscreenDidExit()), 400 407 this, SLOT(sltHandleNativeFullscreenDidExit())); 401 /* Enter native fullscreen mode: */ 402 if ( (darwinScreensHaveSeparateSpaces() || pMachineWindow->screenId() == 0) 403 && !darwinIsInFullscreenMode(pMachineWindow)) 404 darwinToggleFullscreenMode(pMachineWindow); 405 } 408 } 409 /* Ask all window(s) to enter fullscreen mode: */ 410 emit sigNotifyAboutNativeFullscreenShouldBeEntered(); 406 411 } 407 412 #endif /* Q_WS_MAC */ … … 508 513 } 509 514 515 bool UIMachineLogicFullscreen::shouldWeInvalidateFullscreenMode() const 516 { 517 /* Prepare result: */ 518 bool fSomethingInvalid = false; 519 520 /* Enumerate windows: */ 521 foreach (UIMachineWindow *pMachineWindow, machineWindows()) 522 { 523 /* Get screen ID: */ 524 ulong uScreenID = pMachineWindow->screenId(); 525 /* Check window which can be fullscreen: */ 526 if (uScreenID == 0 || darwinScreensHaveSeparateSpaces()) 527 { 528 /* Check window which is not in fullscreen: */ 529 if (!darwinIsInFullscreenMode(pMachineWindow)) 530 { 531 /* Check if that window should really 532 * be shown and is mapped to some host-screen: */ 533 if ( uisession()->isScreenVisible(uScreenID) 534 && hasHostScreenForGuestScreen(uScreenID)) 535 { 536 fSomethingInvalid = true; 537 break; 538 } 539 } 540 /* Check window which is in fullscreen: */ 541 else 542 { 543 /* Check if that window shouldn't really 544 * be shown or isn't mapped to some host-screen: */ 545 if ( !uisession()->isScreenVisible(uScreenID) 546 || !hasHostScreenForGuestScreen(uScreenID)) 547 { 548 fSomethingInvalid = true; 549 break; 550 } 551 } 552 } 553 } 554 555 /* Return result: */ 556 return fSomethingInvalid; 557 } 558 510 559 void UIMachineLogicFullscreen::invalidateFullscreenMode() 511 560 { … … 514 563 return; 515 564 565 LogRel(("UIMachineLogicFullscreen::invalidateFullscreenMode: " 566 "Fullscreen mode invalidated...\n")); 567 516 568 /* Mark 'fullscreen' mode as invalidated: */ 517 569 m_fIsFullscreenInvalidated = true; 518 570 519 /* Exit fullscreen mode: */ 520 foreach (UIMachineWindow *pMachineWindow, machineWindows()) 521 if (darwinIsInFullscreenMode(pMachineWindow)) 522 darwinToggleFullscreenMode(pMachineWindow); 523 } 524 #endif /* Q_WS_MAC */ 525 571 /* Ask all window(s) to exit fullscreen mode: */ 572 emit sigNotifyAboutNativeFullscreenShouldBeExited(); 573 } 574 #endif /* Q_WS_MAC */ 575 -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h
r50573 r50634 28 28 { 29 29 Q_OBJECT; 30 31 #ifdef RT_OS_DARWIN 32 signals: 33 /** Mac OS X: Notifies listener about native fullscreen mode should be entered. */ 34 void sigNotifyAboutNativeFullscreenShouldBeEntered(); 35 /** Mac OS X: Notifies listener about native fullscreen mode should be exited. */ 36 void sigNotifyAboutNativeFullscreenShouldBeExited(); 37 #endif /* RT_OS_DARWIN */ 30 38 31 39 protected: … … 96 104 void setPresentationModeEnabled(bool fEnabled); 97 105 106 /** Mac OS X: Checks if 'fullscreen' mode should be invalidated. */ 107 bool shouldWeInvalidateFullscreenMode() const; 98 108 /** Mac OS X: Invalidates 'fullscreen' mode. */ 99 109 void invalidateFullscreenMode(); -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp
r50631 r50634 91 91 } 92 92 } 93 94 #ifdef Q_WS_MAC 95 void UIMachineWindowFullscreen::sltEnterNativeFullscreen() 96 { 97 /* Make sure this slot is called only under ML and next: */ 98 AssertReturnVoid(vboxGlobal().osRelease() > MacOSXRelease_Lion); 99 100 /* Make sure this window should be shown at all: */ 101 if (!uisession()->isScreenVisible(m_uScreenId)) 102 return; 103 104 /* Make sure this window has fullscreen logic: */ 105 UIMachineLogicFullscreen *pFullscreenLogic = qobject_cast<UIMachineLogicFullscreen*>(machineLogic()); 106 if (!pFullscreenLogic) 107 return; 108 109 /* Make sure this window mapped to some host-screen: */ 110 if (!pFullscreenLogic->hasHostScreenForGuestScreen(m_uScreenId)) 111 return; 112 113 /* Enter native fullscreen mode if necessary: */ 114 if ( (darwinScreensHaveSeparateSpaces() || m_uScreenId == 0) 115 && !darwinIsInFullscreenMode(this)) 116 darwinToggleFullscreenMode(this); 117 } 118 119 void UIMachineWindowFullscreen::sltExitNativeFullscreen() 120 { 121 /* Make sure this slot is called only under ML and next: */ 122 AssertReturnVoid(vboxGlobal().osRelease() > MacOSXRelease_Lion); 123 124 /* Exit native fullscreen mode if necessary: */ 125 if ( (darwinScreensHaveSeparateSpaces() || m_uScreenId == 0) 126 && darwinIsInFullscreenMode(this)) 127 darwinToggleFullscreenMode(this); 128 } 129 #endif /* Q_WS_MAC */ 93 130 94 131 void UIMachineWindowFullscreen::prepareMenu() -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h
r50535 r50634 57 57 void sltPopupMainMenu(); 58 58 59 #ifdef RT_OS_DARWIN 60 /** Mac OS X: Commands window to enter native 'fullscreen' mode if possible. */ 61 void sltEnterNativeFullscreen(); 62 /** Mac OS X: Commands window to exit native 'fullscreen' mode if possible. */ 63 void sltExitNativeFullscreen(); 64 #endif /* RT_OS_DARWIN */ 65 59 66 private: 60 67
Note:
See TracChangeset
for help on using the changeset viewer.