VirtualBox

Changeset 49013 in vbox


Ignore:
Timestamp:
Oct 9, 2013 3:49:57 PM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: Runtime UI: Strict guest normalization on desktop resize; Native MacOS X display reconfiguration callback handling.

Location:
trunk/src/VBox/Frontends/VirtualBox/src/runtime
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.cpp

    r48832 r49013  
    544544}
    545545
    546 void UIMachineLogic::sltHostScreenResized(int /*iHostScreenNumber*/)
    547 {
     546void UIMachineLogic::sltHostScreenGeometryChanged()
     547{
     548    LogRelFlow(("UIMachineLogic: Host-screen geometry changed.\n"));
     549
    548550    /* Deliver event to all machine-windows: */
    549551    foreach (UIMachineWindow *pMachineWindow, machineWindows())
    550         pMachineWindow->handleScreenResize();
     552        pMachineWindow->handleScreenGeometryChange();
    551553}
    552554
     
    718720            this, SLOT(sltGuestMonitorChange(KGuestMonitorChangedEventType, ulong, QRect)));
    719721
    720     /* Host-screen-change updater: */
     722    /* Host-screen-change updaters: */
    721723    connect(uisession(), SIGNAL(sigHostScreenCountChanged(int)),
    722724            this, SLOT(sltHostScreenCountChanged(int)));
    723 
    724     /* Host-screen-resize updaters: */
    725     connect(uisession(), SIGNAL(sigHostScreenFullGeometryResized(int)),
    726             this, SLOT(sltHostScreenResized(int)));
    727     connect(uisession(), SIGNAL(sigHostScreenAvailableGeometryResized(int)),
    728             this, SLOT(sltHostScreenResized(int)));
     725    connect(uisession(), SIGNAL(sigHostScreenGeometryChanged()),
     726            this, SLOT(sltHostScreenGeometryChanged()));
    729727}
    730728
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineLogic.h

    r48832 r49013  
    113113    /* Qt callback handler: */
    114114    virtual void sltHostScreenCountChanged(int cHostScreenCount);
    115     virtual void sltHostScreenResized(int iHostScreenNumber);
     115    virtual void sltHostScreenGeometryChanged();
    116116
    117117protected:
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.cpp

    r48832 r49013  
    439439}
    440440
    441 void UIMachineWindow::handleScreenResize()
     441void UIMachineWindow::handleScreenGeometryChange()
    442442{
    443443    showInNecessaryMode();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineWindow.h

    r48832 r49013  
    111111    /* Visibility stuff: */
    112112    void handleScreenCountChange();
    113     void handleScreenResize();
     113    void handleScreenGeometryChange();
    114114
    115115    /* Update stuff: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r48920 r49013  
    2222#include <QDesktopWidget>
    2323#include <QWidget>
     24#ifdef Q_WS_MAC
     25# include <QTimer>
     26#endif /* Q_WS_MAC */
    2427
    2528/* GUI includes: */
     
    4144# include "VBoxFBOverlay.h"
    4245#endif /* VBOX_WITH_VIDEOHWACCEL */
     46#ifdef Q_WS_MAC
     47# include "VBoxUtils-darwin.h"
     48#endif /* Q_WS_MAC */
    4349
    4450#ifdef Q_WS_X11
     
    7278#include "CSnapshot.h"
    7379#include "CMedium.h"
     80
     81#ifdef Q_WS_MAC
     82/**
     83 * Application Services: Core Graphics: Display reconfiguration callback.
     84 *
     85 * Notifies about @a display configuration change.
     86 * Corresponding change described by CoreGraphics @a flags.
     87 * UISession::sltHandleHostScreenGeometryChange() is called through @a pHandlerObject to handle this callback.
     88 *
     89 * @note Last argument (@a pHandlerObject) must always be valid pointer to UISession object.
     90 */
     91void cgDisplayReconfigurationCallback(CGDirectDisplayID display, CGDisplayChangeSummaryFlags flags, void *pHandlerObject)
     92{
     93    /* Handle 'mode-set' case: */
     94    if (flags & kCGDisplaySetModeFlag)
     95    {
     96        /* Which resolution we received? */
     97        size_t iWid = CGDisplayPixelsWide(display);
     98        size_t iHig = CGDisplayPixelsHigh(display);
     99        LogRelFlow(("UISession::cgDisplayReconfigurationCallback: Display mode changed to: %dx%d.\n", (int)iWid, (int)iHig));
     100
     101        /* Ask receiver to handle our callback, can't believe I'm using r_c here... */
     102        UISession *pReceiver = reinterpret_cast<UISession*>(pHandlerObject);
     103        QTimer::singleShot(0, pReceiver, SLOT(sltHandleHostScreenGeometryChange()));
     104    }
     105}
     106#endif /* Q_WS_MAC */
    74107
    75108UISession::UISession(UIMachine *pMachine, CSession &sessionReference)
     
    787820}
    788821
     822void UISession::sltHandleHostScreenGeometryChange()
     823{
     824    LogRelFlow(("UISession: Host-screen geometry changed.\n"));
     825
     826    /* Notify current machine-logic: */
     827    emit sigHostScreenGeometryChanged();
     828}
     829
    789830void UISession::sltAdditionsChange()
    790831{
     
    878919            this, SIGNAL(sigHostScreenCountChanged(int)));
    879920
     921    /* Install Qt reconfiguration callbacks: */
    880922    connect(QApplication::desktop(), SIGNAL(resized(int)),
    881             this, SIGNAL(sigHostScreenFullGeometryResized(int)));
     923            this, SLOT(sltHandleHostScreenGeometryChange()));
    882924    connect(QApplication::desktop(), SIGNAL(workAreaResized(int)),
    883             this, SIGNAL(sigHostScreenAvailableGeometryResized(int)));
     925            this, SLOT(sltHandleHostScreenGeometryChange()));
     926
     927#ifdef Q_WS_MAC
     928    /* Install display reconfiguration callback: */
     929    CGDisplayRegisterReconfigurationCallback(cgDisplayReconfigurationCallback, this);
     930#endif /* Q_WS_MAC */
    884931}
    885932
     
    10151062    /* Destroy console event-handler: */
    10161063    UIConsoleEventHandler::destroy();
     1064}
     1065
     1066void UISession::cleanupConnections()
     1067{
     1068#ifdef Q_WS_MAC
     1069    /* Remove display reconfiguration callback: */
     1070    CGDisplayRemoveReconfigurationCallback(cgDisplayReconfigurationCallback, this);
     1071#endif /* Q_WS_MAC */
    10171072}
    10181073
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r48920 r49013  
    158158    void setSeamlessModeRequested(bool fIsSeamlessModeRequested) { m_fIsSeamlessModeRequested = fIsSeamlessModeRequested; }
    159159    void setAutoCaptureDisabled(bool fIsAutoCaptureDisabled) { m_fIsAutoCaptureDisabled = fIsAutoCaptureDisabled; }
     160    void forgetPreviousMachineState() { m_machineStatePrevious = m_machineState; }
    160161
    161162    /* Keyboard setters: */
     
    207208    void sigGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo);
    208209
    209     /* Qt callback signal: */
     210    /* Notifiers: Qt callback stuff: */
    210211    void sigHostScreenCountChanged(int cHostScreenCount);
    211     void sigHostScreenFullGeometryResized(int iHostScreenNumber);
    212     void sigHostScreenAvailableGeometryResized(int iHostScreenNumber);
     212    void sigHostScreenGeometryChanged();
    213213
    214214    /* Session signals: */
     
    234234    void sltGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo);
    235235
     236    /* Handler: Host callback stuff: */
     237    void sltHandleHostScreenGeometryChange();
     238
    236239private:
    237240
     
    253256    //void cleanupScreens() {}
    254257    void cleanupConsoleEventHandlers();
    255     //void cleanupConnections() {}
     258    void cleanupConnections();
    256259
    257260    /* Update helpers: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineLogicFullscreen.cpp

    r48920 r49013  
    9797    if (uisession()->isRunning() && uisession()->wasPaused())
    9898    {
     99        LogRelFlow(("UIMachineLogicFullscreen: "
     100                    "Machine-state changed from 'paused' to 'running': "
     101                    "Updating screen-layout...\n"));
     102
     103        /* Make sure further code will be called just once: */
     104        uisession()->forgetPreviousMachineState();
    99105        /* We should rebuild screen-layout: */
    100106        m_pScreenLayout->rebuild();
    101107        /* We should update machine-windows sizes: */
    102108        foreach (UIMachineWindow *pMachineWindow, machineWindows())
    103             pMachineWindow->handleScreenResize();
     109            pMachineWindow->handleScreenGeometryChange();
    104110    }
    105111}
     
    119125void UIMachineLogicFullscreen::sltGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo)
    120126{
    121     LogRelFlow(("UIMachineLogicFullscreen::GuestScreenCountChanged.\n"));
     127    LogRelFlow(("UIMachineLogicFullscreen: Guest-screen count changed.\n"));
    122128
    123129    /* Update multi-screen layout before any window update: */
     
    132138void UIMachineLogicFullscreen::sltHostScreenCountChanged(int cScreenCount)
    133139{
    134     LogRelFlow(("UIMachineLogicFullscreen::HostScreenCountChanged.\n"));
     140    LogRelFlow(("UIMachineLogicFullscreen: Host-screen count changed.\n"));
    135141
    136142    /* Update multi-screen layout before any window update: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineWindowFullscreen.cpp

    r47478 r49013  
    2929#include "UIMachineLogicFullscreen.h"
    3030#include "UIMachineWindowFullscreen.h"
     31#include "UIMachineView.h"
    3132#include "UIMachineDefs.h"
    3233#include "UIMiniToolBar.h"
     
    164165    /* Resize to the appropriate size: */
    165166    resize(workingArea.size());
     167    /* Adjust guest if necessary: */
     168    machineView()->normalizeGeometry(false);
    166169    /* Move mini-toolbar into appropriate place: */
    167170    if (m_pMiniToolBar)
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineLogicSeamless.cpp

    r48920 r49013  
    109109    if (uisession()->isRunning() && uisession()->wasPaused())
    110110    {
     111        LogRelFlow(("UIMachineLogicSeamless: "
     112                    "Machine-state changed from 'paused' to 'running': "
     113                    "Updating screen-layout...\n"));
     114
     115        /* Make sure further code will be called just once: */
     116        uisession()->forgetPreviousMachineState();
    111117        /* We should rebuild screen-layout: */
    112118        m_pScreenLayout->rebuild();
    113119        /* We should update machine-windows sizes: */
    114120        foreach (UIMachineWindow *pMachineWindow, machineWindows())
    115             pMachineWindow->handleScreenResize();
     121            pMachineWindow->handleScreenGeometryChange();
    116122    }
    117123}
     
    119125void UIMachineLogicSeamless::sltGuestMonitorChange(KGuestMonitorChangedEventType changeType, ulong uScreenId, QRect screenGeo)
    120126{
    121     LogRelFlow(("UIMachineLogicSeamless::GuestScreenCountChanged.\n"));
     127    LogRelFlow(("UIMachineLogicSeamless: Guest-screen count changed.\n"));
    122128
    123129    /* Update multi-screen layout before any window update: */
     
    132138void UIMachineLogicSeamless::sltHostScreenCountChanged(int cScreenCount)
    133139{
    134     LogRelFlow(("UIMachineLogicSeamless::HostScreenCountChanged.\n"));
     140    LogRelFlow(("UIMachineLogicSeamless: Host-screen count changed.\n"));
    135141
    136142    /* Update multi-screen layout before any window update: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp

    r48705 r49013  
    2929#include "UIMachineLogicSeamless.h"
    3030#include "UIMachineWindowSeamless.h"
    31 #include "UIMachineViewSeamless.h"
     31#include "UIMachineView.h"
    3232#ifndef Q_WS_MAC
    3333# include "UIMachineDefs.h"
     
    197197    /* Resize to the appropriate size: */
    198198    resize(workingArea.size());
     199    /* Adjust guest if necessary: */
     200    machineView()->normalizeGeometry(false);
    199201#ifndef Q_WS_MAC
    200202    /* Move mini-toolbar into appropriate place: */
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