Changeset 26961 in vbox for trunk/src/VBox/Frontends
- Timestamp:
- Mar 2, 2010 5:13:50 PM (15 years ago)
- Location:
- trunk/src/VBox/Frontends/VirtualBox/src/runtime
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.cpp
r26955 r26961 30 30 #include "UIMachineWindow.h" 31 31 32 #ifdef Q_WS_MAC 33 # ifdef QT_MAC_USE_COCOA 34 # include <Carbon/Carbon.h> 35 # endif /* QT_MAC_USE_COCOA */ 36 #endif /* Q_WS_MAC */ 37 32 38 class UIVisualState : public QObject 33 39 { … … 42 48 , m_pActionsPool(pActionsPool) 43 49 , m_pMachineLogic(0) 50 #ifdef Q_WS_MAC 51 , m_fadeToken(kCGDisplayFadeReservationInvalidToken) 52 #endif /* Q_WS_MAC */ 44 53 { 45 54 /* Connect state-change handler: */ … … 51 60 virtual UIVisualStateType visualStateType() const = 0; 52 61 53 virtual bool prepareChange( )62 virtual bool prepareChange(UIVisualStateType previousVisualStateType) 54 63 { 55 64 m_pMachineLogic = UIMachineLogic::create(this, m_pSession, m_pActionsPool, visualStateType()); 56 return m_pMachineLogic->checkAvailability(); 65 bool fResult = m_pMachineLogic->checkAvailability(); 66 #ifdef Q_WS_MAC 67 /* If the new is or the old type was fullscreen we add the blending 68 * transition between the mode switches. 69 * TODO: make this more general. */ 70 if ( fResult 71 && ( visualStateType() == UIVisualStateType_Fullscreen 72 || previousVisualStateType == UIVisualStateType_Fullscreen)) 73 { 74 /* Fade to black */ 75 CGAcquireDisplayFadeReservation(kCGMaxDisplayReservationInterval, &m_fadeToken); 76 CGDisplayFade(m_fadeToken, 0.3, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0.0, 0.0, 0.0, true); 77 } 78 #else /* Q_WS_MAC */ 79 Q_UNUSED(previousVisualStateType); 80 #endif /* !Q_WS_MAC */ 81 return fResult; 57 82 } 58 83 59 84 virtual void change() = 0; 60 virtual void finishChange() {} 85 86 virtual void finishChange() 87 { 88 #ifdef Q_WS_MAC 89 /* If there is a valid fade token, fade back to normal color in any 90 * case. */ 91 if (m_fadeToken != kCGDisplayFadeReservationInvalidToken) 92 { 93 /* Fade back to the normal gamma */ 94 CGDisplayFade(m_fadeToken, 0.5, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0.0, 0.0, 0.0, false); 95 CGReleaseDisplayFadeReservation(m_fadeToken); 96 m_fadeToken = kCGDisplayFadeReservationInvalidToken; 97 } 98 #endif /* Q_WS_MAC */ 99 } 100 61 101 62 102 signals: … … 71 111 UIActionsPool *m_pActionsPool; 72 112 UIMachineLogic *m_pMachineLogic; 113 #ifdef Q_WS_MAC 114 CGDisplayFadeReservationToken m_fadeToken; 115 #endif /* Q_WS_MAC */ 73 116 }; 74 117 … … 274 317 } 275 318 319 UIVisualStateType previousVisualStateType = UIVisualStateType_Normal; 320 if (m_pVisualState) 321 previousVisualStateType = m_pVisualState->visualStateType(); 322 276 323 /* First we have to check if the selected mode is available at all. 277 324 * Only then we delete the old mode and switch to the new mode. */ 278 if (pNewVisualState->prepareChange( ))325 if (pNewVisualState->prepareChange(previousVisualStateType)) 279 326 { 280 327 /* Delete previous state: */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp
r26955 r26961 109 109 } 110 110 111 112 111 return true; 113 112 } -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp
r26943 r26961 178 178 break; 179 179 } 180 #ifdef Q_WS_MAC181 case QEvent::Polish:182 {183 /* Fade back to the normal gamma */184 // CGDisplayFade (mFadeToken, 0.5, kCGDisplayBlendSolidColor, kCGDisplayBlendNormal, 0.0, 0.0, 0.0, false);185 // CGReleaseDisplayFadeReservation (mFadeToken);186 break;187 }188 #endif /* Q_WS_MAC */189 180 default: 190 181 break; … … 300 291 setAutoFillBackground (true); 301 292 302 #ifdef Q_WS_MAC303 /* Fade to black */304 // CGAcquireDisplayFadeReservation (kCGMaxDisplayReservationInterval, &mFadeToken);305 // CGDisplayFade (mFadeToken, 0.3, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0.0, 0.0, 0.0, true);306 #endif307 308 293 /* We have to show the window early, or the position will be wrong on the 309 294 Mac */ -
trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h
r26937 r26961 98 98 //void cleanupConsoleConnections() {} 99 99 100 #ifdef Q_WS_MAC101 CGDisplayFadeReservationToken mFadeToken;102 #endif /* Q_WS_MAC */103 104 100 /* Other members: */ 105 101 QRect m_normalGeometry;
Note:
See TracChangeset
for help on using the changeset viewer.