VirtualBox

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


Ignore:
Timestamp:
Mar 2, 2010 11:00:50 AM (15 years ago)
Author:
vboxsync
Message:

FE/Qt4: new core: Presentation mode belongs to the machine logic not a particular window.

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

    r26931 r26937  
    4040
    4141#include "VBoxUtils.h"
     42
     43#ifdef Q_WS_MAC
     44# ifdef QT_MAC_USE_COCOA
     45#  include <Carbon/Carbon.h>
     46# endif /* QT_MAC_USE_COCOA */
     47#endif /* Q_WS_MAC */
    4248
    4349UIMachineLogicFullscreen::UIMachineLogicFullscreen(QObject *pParent, UISession *pSession, UIActionsPool *pActionsPool)
     
    152158     * This is necessary for Qt versions > 4.3.3: */
    153159    ::darwinSetFrontMostProcess();
     160    setPresentationModeEnabled(true);
    154161#endif /* Q_WS_MAC */
    155162
     
    264271    foreach (UIMachineWindow *pMachineWindow, machineWindows())
    265272        UIMachineWindow::destroy(pMachineWindow);
    266 }
    267 
     273
     274#ifdef Q_WS_MAC
     275    setPresentationModeEnabled(false);
     276#endif/* Q_WS_MAC */
     277}
     278
     279#ifdef Q_WS_MAC
     280# ifdef QT_MAC_USE_COCOA
     281void UIMachineLogicFullscreen::setPresentationModeEnabled(bool fEnabled)
     282{
     283    if (fEnabled)
     284    {
     285        /* First check if we are on the primary screen, only than the
     286         * presentation mode have to be changed. */
     287        // TODO_NEW_CORE: we need some algorithm to decide which virtual screen
     288        // is on which physical host display. Than we can decide on the
     289        // presentation mode as well. */
     290//        QDesktopWidget* pDesktop = QApplication::desktop();
     291//        if (pDesktop->screenNumber(this) == pDesktop->primaryScreen())
     292        {
     293            QString testStr = vboxGlobal().virtualBox().GetExtraData(VBoxDefs::GUI_PresentationModeEnabled).toLower();
     294            /* Default to false if it is an empty value */
     295            if (testStr.isEmpty() || testStr == "false")
     296                SetSystemUIMode(kUIModeAllHidden, 0);
     297            else
     298                SetSystemUIMode(kUIModeAllSuppressed, 0);
     299        }
     300    }
     301    else
     302        SetSystemUIMode(kUIModeNormal, 0);
     303}
     304# endif /* QT_MAC_USE_COCOA */
     305#endif /* Q_WS_MAC */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.h

    r26931 r26937  
    6060    void cleanupActionConnections() {}
    6161
     62#ifdef Q_WS_MAC
     63# ifdef QT_MAC_USE_COCOA
     64    void setPresentationModeEnabled(bool fEnabled);
     65# endif /* QT_MAC_USE_COCOA */
     66#endif /* Q_WS_MAC */
     67
    6268    /* Friend classes: */
    6369    friend class UIMachineLogic;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp

    r26931 r26937  
    3636#include "UIMachineView.h"
    3737#include "UIMachineWindowFullscreen.h"
    38 
    39 #ifdef Q_WS_MAC
    40 # ifdef QT_MAC_USE_COCOA
    41 #  include <Carbon/Carbon.h>
    42 # endif /* QT_MAC_USE_COCOA */
    43 #endif /* Q_WS_MAC */
    4438
    4539UIMachineWindowFullscreen::UIMachineWindowFullscreen(UIMachineLogic *pMachineLogic, ulong uScreenId)
     
    316310       Mac */
    317311    show();
     312    move(0,0);
    318313
    319314#ifdef Q_WS_MAC
     
    325320    /* Here we are going really fullscreen */
    326321    setWindowState(windowState() ^ Qt::WindowFullScreen);
    327     setPresentationModeEnabled(true);
    328322
    329323# ifndef QT_MAC_USE_COCOA
     
    354348    {
    355349    }
    356 
    357 #ifdef Q_WS_MAC
    358     setPresentationModeEnabled(false);
    359 #endif/* Q_WS_MAC */
    360350}
    361351
     
    370360}
    371361
    372 #ifdef Q_WS_MAC
    373 # ifdef QT_MAC_USE_COCOA
    374 void UIMachineWindowFullscreen::setPresentationModeEnabled(bool fEnabled)
    375 {
    376     if (fEnabled)
    377     {
    378         /* First check if we are on the primary screen, only than the presentation mode have to be changed. */
    379         QDesktopWidget* pDesktop = QApplication::desktop();
    380         if (pDesktop->screenNumber(this) == pDesktop->primaryScreen())
    381         {
    382             QString testStr = vboxGlobal().virtualBox().GetExtraData(VBoxDefs::GUI_PresentationModeEnabled).toLower();
    383             /* Default to false if it is an empty value */
    384             if (testStr.isEmpty() || testStr == "false")
    385                 SetSystemUIMode(kUIModeAllHidden, 0);
    386             else
    387                 SetSystemUIMode(kUIModeAllSuppressed, 0);
    388         }
    389     }
    390     else
    391         SetSystemUIMode(kUIModeNormal, 0);
    392 }
    393 # endif /* QT_MAC_USE_COCOA */
    394 #endif /* Q_WS_MAC */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.h

    r26921 r26937  
    9999
    100100#ifdef Q_WS_MAC
    101 # ifdef QT_MAC_USE_COCOA
    102     void setPresentationModeEnabled(bool fEnabled);
    103 # endif /* QT_MAC_USE_COCOA */
    104101    CGDisplayFadeReservationToken mFadeToken;
    105102#endif /* Q_WS_MAC */
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