VirtualBox

Changeset 53389 in vbox for trunk/src


Ignore:
Timestamp:
Nov 24, 2014 4:19:34 PM (10 years ago)
Author:
vboxsync
Message:

FE/Qt: 6278: Support for scaled video-output: Handle runtime scale-factor changes.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp

    r53372 r53389  
    35683568                 strKey == GUI_StatusBar_IndicatorOrder)
    35693569            emit sigStatusBarConfigurationChange(strMachineID);
     3570        /* Scale-factor change: */
     3571        else if (strKey == GUI_ScaleFactor)
     3572            emit sigScaleFactorChange(strMachineID);
    35703573    }
    35713574
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h

    r53372 r53389  
    7575    /** Notifies about HID LEDs synchronization state change. */
    7676    void sigHidLedsSyncStateChange(bool fEnabled);
     77
     78    /** Notifies about the scale-factor change. */
     79    void sigScaleFactorChange(const QString &strMachineID);
    7780
    7881#ifdef RT_OS_DARWIN
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.cpp

    r53372 r53389  
    764764#endif /* VBOX_WITH_VIDEOHWACCEL */
    765765
     766void UIFrameBuffer::sltHandleScaleFactorChange(const QString &strMachineID)
     767{
     768    /* Skip unrelated machine IDs: */
     769    if (strMachineID != vboxGlobal().managedVMUuid())
     770        return;
     771
     772    /* Fetch new scale-factor: */
     773    m_dScaleFactor = gEDataManager->scaleFactor(vboxGlobal().managedVMUuid());
     774}
     775
    766776void UIFrameBuffer::prepareConnections()
    767777{
     778    /* EMT connections: */
    768779    connect(this, SIGNAL(sigNotifyChange(int, int)),
    769780            m_pMachineView, SLOT(sltHandleNotifyChange(int, int)),
     
    778789            m_pMachineView, SLOT(sltHandle3DOverlayVisibilityChange(bool)),
    779790            Qt::QueuedConnection);
     791
     792    /* Extra-data manager connections: */
     793    connect(gEDataManager, SIGNAL(sigScaleFactorChange(const QString&)),
     794            this, SLOT(sltHandleScaleFactorChange(const QString&)));
    780795}
    781796
    782797void UIFrameBuffer::cleanupConnections()
    783798{
     799    /* EMT connections: */
    784800    disconnect(this, SIGNAL(sigNotifyChange(int, int)),
    785801               m_pMachineView, SLOT(sltHandleNotifyChange(int, int)));
     
    790806    disconnect(this, SIGNAL(sigNotifyAbout3DOverlayVisibilityChange(bool)),
    791807               m_pMachineView, SLOT(sltHandle3DOverlayVisibilityChange(bool)));
     808
     809    /* Extra-data manager connections: */
     810    disconnect(gEDataManager, SIGNAL(sigScaleFactorChange(const QString&)),
     811               this, SLOT(sltHandleScaleFactorChange(const QString&)));
    792812}
    793813
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIFrameBuffer.h

    r53372 r53389  
    223223    void setBackingScaleFactor(double dBackingScaleFactor) { m_dBackingScaleFactor = dBackingScaleFactor; }
    224224
     225protected slots:
     226
     227    /** Handles the scale-factor change. */
     228    void sltHandleScaleFactorChange(const QString &strMachineID);
     229
    225230protected:
    226231
     
    278283     * @{ */
    279284    /** Holds the scale-factor used by the scaled-size. */
    280     const double m_dScaleFactor;
     285    double m_dScaleFactor;
    281286    /** Holds the frame-buffer's scaled-size. */
    282287    QSize m_scaledSize;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r53388 r53389  
    316316{
    317317    setMaxGuestSize();
     318}
     319
     320void UIMachineView::sltHandleScaleFactorChange(const QString &strMachineID)
     321{
     322    /* Skip unrelated machine IDs: */
     323    if (strMachineID != vboxGlobal().managedVMUuid())
     324        return;
     325
     326    /* Adjust frame-buffer, machine-window and guest-screen size if necessary: */
     327    sltHandleNotifyChange(frameBuffer()->width(), frameBuffer()->height());
     328    machineWindow()->normalizeGeometry(true /* adjust position */);
     329    adjustGuestScreenSize();
    318330}
    319331
     
    540552    connect(QApplication::desktop(), SIGNAL(resized(int)), this,
    541553            SLOT(sltDesktopResized()));
     554    /* Scale-factor change: */
     555    connect(gEDataManager, SIGNAL(sigScaleFactorChange(const QString&)),
     556            this, SLOT(sltHandleScaleFactorChange(const QString&)));
    542557}
    543558
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h

    r53372 r53389  
    113113    /* Watch dog for desktop resizes: */
    114114    void sltDesktopResized();
     115
     116    /** Handles the scale-factor change. */
     117    void sltHandleScaleFactorChange(const QString &strMachineID);
    115118
    116119    /* Console callback handlers: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.cpp

    r52730 r53389  
    3737# include "UIMachineViewFullscreen.h"
    3838# include "UIFrameBuffer.h"
     39# include "UIExtraDataManager.h"
    3940
    4041#endif /* !VBOX_WITH_PRECOMPILED_HEADERS */
     
    144145void UIMachineViewFullscreen::adjustGuestScreenSize()
    145146{
     147    /* Acquire working-area size: */
     148    const QSize workingAreaSize = workingArea().size();
     149    /* Acquire frame-buffer size: */
     150    QSize frameBufferSize(frameBuffer()->width(), frameBuffer()->height());
     151    /* Take the scale-factor into account: */
     152    frameBufferSize *= gEDataManager->scaleFactor(vboxGlobal().managedVMUuid());
    146153    /* Check if we should adjust guest-screen to new size: */
    147154    if (frameBuffer()->isAutoEnabled() ||
    148         (int)frameBuffer()->width() != workingArea().size().width() ||
    149         (int)frameBuffer()->height() != workingArea().size().height())
     155        frameBufferSize != workingAreaSize)
    150156        if (m_bIsGuestAutoresizeEnabled &&
    151157            uisession()->isGuestSupportsGraphics() &&
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp

    r52730 r53389  
    168168void UIMachineViewNormal::adjustGuestScreenSize()
    169169{
     170    /* Acquire central-widget size: */
     171    const QSize centralWidgetSize = machineWindow()->centralWidget()->size();
     172    /* Acquire frame-buffer size: */
     173    QSize frameBufferSize(frameBuffer()->width(), frameBuffer()->height());
     174    /* Take the scale-factor into account: */
     175    frameBufferSize *= gEDataManager->scaleFactor(vboxGlobal().managedVMUuid());
    170176    /* Check if we should adjust guest-screen to new size: */
    171     const QSize centralWidgetSize = machineWindow()->centralWidget()->size();
    172     if ((int)frameBuffer()->width() != centralWidgetSize.width() ||
    173         (int)frameBuffer()->height() != centralWidgetSize.height())
     177    if (frameBufferSize != centralWidgetSize)
    174178        if (m_bIsGuestAutoresizeEnabled && uisession()->isGuestSupportsGraphics())
    175179            sltPerformGuestResize(centralWidgetSize);
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp

    r53076 r53389  
    3636# include "UIMachineViewSeamless.h"
    3737# include "UIFrameBuffer.h"
     38# include "UIExtraDataManager.h"
    3839
    3940/* COM includes: */
     
    161162void UIMachineViewSeamless::adjustGuestScreenSize()
    162163{
     164    /* Acquire working-area size: */
     165    const QSize workingAreaSize = workingArea().size();
     166    /* Acquire frame-buffer size: */
     167    QSize frameBufferSize(frameBuffer()->width(), frameBuffer()->height());
     168    /* Take the scale-factor into account: */
     169    frameBufferSize *= gEDataManager->scaleFactor(vboxGlobal().managedVMUuid());
    163170    /* Check if we should adjust guest-screen to new size: */
    164171    if (frameBuffer()->isAutoEnabled() ||
    165         (int)frameBuffer()->width() != workingArea().size().width() ||
    166         (int)frameBuffer()->height() != workingArea().size().height())
     172        frameBufferSize != workingAreaSize)
    167173        if (uisession()->isGuestSupportsGraphics() &&
    168174            uisession()->isScreenVisible(screenId()))
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