VirtualBox

Changeset 26961 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Mar 2, 2010 5:13:50 PM (15 years ago)
Author:
vboxsync
Message:

FE/Qt4: new core: Enable the blending transition between fs and normal mode switches again on OSX.

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  
    3030#include "UIMachineWindow.h"
    3131
     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
    3238class UIVisualState : public QObject
    3339{
     
    4248        , m_pActionsPool(pActionsPool)
    4349        , m_pMachineLogic(0)
     50#ifdef Q_WS_MAC
     51        , m_fadeToken(kCGDisplayFadeReservationInvalidToken)
     52#endif /* Q_WS_MAC */
    4453    {
    4554        /* Connect state-change handler: */
     
    5160    virtual UIVisualStateType visualStateType() const = 0;
    5261
    53     virtual bool prepareChange()
     62    virtual bool prepareChange(UIVisualStateType previousVisualStateType)
    5463    {
    5564        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;
    5782    }
    5883
    5984    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
    61101
    62102signals:
     
    71111    UIActionsPool *m_pActionsPool;
    72112    UIMachineLogic *m_pMachineLogic;
     113#ifdef Q_WS_MAC
     114    CGDisplayFadeReservationToken m_fadeToken;
     115#endif /* Q_WS_MAC */
    73116};
    74117
     
    274317    }
    275318
     319    UIVisualStateType previousVisualStateType = UIVisualStateType_Normal;
     320    if (m_pVisualState)
     321        previousVisualStateType = m_pVisualState->visualStateType();
     322
    276323    /* First we have to check if the selected mode is available at all.
    277324     * Only then we delete the old mode and switch to the new mode. */
    278     if (pNewVisualState->prepareChange())
     325    if (pNewVisualState->prepareChange(previousVisualStateType))
    279326    {
    280327        /* Delete previous state: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp

    r26955 r26961  
    109109    }
    110110
    111 
    112111    return true;
    113112}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp

    r26943 r26961  
    178178            break;
    179179        }
    180 #ifdef Q_WS_MAC
    181         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 */
    189180        default:
    190181            break;
     
    300291    setAutoFillBackground (true);
    301292
    302 #ifdef Q_WS_MAC
    303     /* Fade to black */
    304 //    CGAcquireDisplayFadeReservation (kCGMaxDisplayReservationInterval, &mFadeToken);
    305 //    CGDisplayFade (mFadeToken, 0.3, kCGDisplayBlendNormal, kCGDisplayBlendSolidColor, 0.0, 0.0, 0.0, true);
    306 #endif
    307 
    308293    /* We have to show the window early, or the position will be wrong on the
    309294       Mac */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h

    r26937 r26961  
    9898    //void cleanupConsoleConnections() {}
    9999
    100 #ifdef Q_WS_MAC
    101     CGDisplayFadeReservationToken mFadeToken;
    102 #endif /* Q_WS_MAC */
    103 
    104100    /* Other members: */
    105101    QRect m_normalGeometry;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette