VirtualBox

Ignore:
Timestamp:
Feb 14, 2023 11:18:01 AM (2 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:10322: Runtime UI: Reworking CDisplay wrapper usage step-by-step; This one is about various seamless/scaled modes flags.

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

Legend:

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

    r98548 r98556  
    459459{
    460460    return uisession()->acquireScreenShot(uScreenId, uWidth, uHeight, enmFormat, pBits);
     461}
     462
     463bool UIMachine::notifyScaleFactorChange(ulong uScreenId, ulong uScaleFactorWMultiplied, ulong uScaleFactorHMultiplied)
     464{
     465    return uisession()->notifyScaleFactorChange(uScreenId, uScaleFactorWMultiplied, uScaleFactorHMultiplied);
     466}
     467
     468bool UIMachine::notifyHiDPIOutputPolicyChange(bool fUnscaledHiDPI)
     469{
     470    return uisession()->notifyHiDPIOutputPolicyChange(fUnscaledHiDPI);
     471}
     472
     473bool UIMachine::setSeamlessMode(bool fEnabled)
     474{
     475    return uisession()->setSeamlessMode(fEnabled);
    461476}
    462477
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachine.h

    r98548 r98556  
    291291        /** Acquires screen-shot for guest-screen with passed uScreenId. */
    292292        bool acquireScreenShot(ulong uScreenId, ulong uWidth, ulong uHeight, KBitmapFormat enmFormat, uchar *pBits);
     293        /** Notifies guest-screen with passed uScreenId about scale-factor change. */
     294        bool notifyScaleFactorChange(ulong uScreenId, ulong uScaleFactorWMultiplied, ulong uScaleFactorHMultiplied);
     295        /** Notifies display about unscaled HiDPI policy change. */
     296        bool notifyHiDPIOutputPolicyChange(bool fUnscaledHiDPI);
     297        /** Defines whether seamless mode is enabled for display. */
     298        bool setSeamlessMode(bool fEnabled);
    293299    /** @} */
    294300
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r98555 r98556  
    249249            dScaleFactorFor3D *= frameBuffer()->devicePixelRatioActual();
    250250#endif /* VBOX_WS_WIN || VBOX_WS_X11 */
    251         display().NotifyScaleFactorChange(m_uScreenId,
    252                                           (uint32_t)(dScaleFactorFor3D * VBOX_OGL_SCALE_FACTOR_MULTIPLIER),
    253                                           (uint32_t)(dScaleFactorFor3D * VBOX_OGL_SCALE_FACTOR_MULTIPLIER));
    254         display().NotifyHiDPIOutputPolicyChange(fUseUnscaledHiDPIOutput);
     251        uimachine()->notifyScaleFactorChange(m_uScreenId,
     252                                             (uint32_t)(dScaleFactorFor3D * VBOX_OGL_SCALE_FACTOR_MULTIPLIER),
     253                                             (uint32_t)(dScaleFactorFor3D * VBOX_OGL_SCALE_FACTOR_MULTIPLIER));
     254        uimachine()->notifyHiDPIOutputPolicyChange(fUseUnscaledHiDPIOutput);
    255255    }
    256256
     
    10021002            dScaleFactorFor3D *= frameBuffer()->devicePixelRatioActual();
    10031003#endif /* VBOX_WS_WIN || VBOX_WS_X11 */
    1004         display().NotifyScaleFactorChange(m_uScreenId,
    1005                                           (uint32_t)(dScaleFactorFor3D * VBOX_OGL_SCALE_FACTOR_MULTIPLIER),
    1006                                           (uint32_t)(dScaleFactorFor3D * VBOX_OGL_SCALE_FACTOR_MULTIPLIER));
    1007         display().NotifyHiDPIOutputPolicyChange(fUseUnscaledHiDPIOutput);
     1004        uimachine()->notifyScaleFactorChange(m_uScreenId,
     1005                                             (uint32_t)(dScaleFactorFor3D * VBOX_OGL_SCALE_FACTOR_MULTIPLIER),
     1006                                             (uint32_t)(dScaleFactorFor3D * VBOX_OGL_SCALE_FACTOR_MULTIPLIER));
     1007        uimachine()->notifyHiDPIOutputPolicyChange(fUseUnscaledHiDPIOutput);
    10081008    }
    10091009
     
    12341234                dScaleFactorFor3D *= dDevicePixelRatioActual;
    12351235#endif /* VBOX_WS_WIN || VBOX_WS_X11 */
    1236             display().NotifyScaleFactorChange(m_uScreenId,
    1237                                               (uint32_t)(dScaleFactorFor3D * VBOX_OGL_SCALE_FACTOR_MULTIPLIER),
    1238                                               (uint32_t)(dScaleFactorFor3D * VBOX_OGL_SCALE_FACTOR_MULTIPLIER));
    1239             display().NotifyHiDPIOutputPolicyChange(fUseUnscaledHiDPIOutput);
     1236            uimachine()->notifyScaleFactorChange(m_uScreenId,
     1237                                                 (uint32_t)(dScaleFactorFor3D * VBOX_OGL_SCALE_FACTOR_MULTIPLIER),
     1238                                                 (uint32_t)(dScaleFactorFor3D * VBOX_OGL_SCALE_FACTOR_MULTIPLIER));
     1239            uimachine()->notifyHiDPIOutputPolicyChange(fUseUnscaledHiDPIOutput);
    12401240        }
    12411241
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r98548 r98556  
    483483            UINotificationMessage::cannotAcquireDisplayParameter(comDisplay);
    484484    }
     485    return fSuccess;
     486}
     487
     488bool UISession::notifyScaleFactorChange(ulong uScreenId, ulong uScaleFactorWMultiplied, ulong uScaleFactorHMultiplied)
     489{
     490    CDisplay comDisplay = display();
     491    comDisplay.NotifyScaleFactorChange(uScreenId, uScaleFactorWMultiplied, uScaleFactorHMultiplied);
     492    const bool fSuccess = comDisplay.isOk();
     493    if (!fSuccess)
     494        UINotificationMessage::cannotChangeDisplayParameter(comDisplay);
     495    return fSuccess;
     496}
     497
     498bool UISession::notifyHiDPIOutputPolicyChange(bool fUnscaledHiDPI)
     499{
     500    CDisplay comDisplay = display();
     501    comDisplay.NotifyHiDPIOutputPolicyChange(fUnscaledHiDPI);
     502    const bool fSuccess = comDisplay.isOk();
     503    if (!fSuccess)
     504        UINotificationMessage::cannotChangeDisplayParameter(comDisplay);
     505    return fSuccess;
     506}
     507
     508bool UISession::setSeamlessMode(bool fEnabled)
     509{
     510    CDisplay comDisplay = display();
     511    comDisplay.SetSeamlessMode(fEnabled);
     512    const bool fSuccess = comDisplay.isOk();
     513    if (!fSuccess)
     514        UINotificationMessage::cannotChangeDisplayParameter(comDisplay);
    485515    return fSuccess;
    486516}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r98548 r98556  
    309309        /** Acquires screen-shot for guest-screen with passed uScreenId. */
    310310        bool acquireScreenShot(ulong uScreenId, ulong uWidth, ulong uHeight, KBitmapFormat enmFormat, uchar *pBits);
     311        /** Notifies guest-screen with passed uScreenId about scale-factor change. */
     312        bool notifyScaleFactorChange(ulong uScreenId, ulong uScaleFactorWMultiplied, ulong uScaleFactorHMultiplied);
     313        /** Notifies display about unscaled HiDPI policy change. */
     314        bool notifyHiDPIOutputPolicyChange(bool fUnscaledHiDPI);
     315        /** Defines whether seamless mode is enabled for display. */
     316        bool setSeamlessMode(bool fEnabled);
    311317    /** @} */
    312318
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineLogicNormal.cpp

    r98451 r98556  
    5151/* COM includes: */
    5252#include "CConsole.h"
    53 #include "CDisplay.h"
    5453#include "CGraphicsAdapter.h"
    5554
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp

    r98547 r98556  
    4141
    4242/* COM includes: */
    43 #include "CDisplay.h"
    4443#include "CGraphicsAdapter.h"
    4544
     
    8584            }
    8685#endif /* VBOX_WS_WIN || VBOX_WS_X11 */
    87             display().NotifyScaleFactorChange(m_uScreenId,
    88                                               (uint32_t)(xScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER),
    89                                               (uint32_t)(yScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER));
     86            uimachine()->notifyScaleFactorChange(m_uScreenId,
     87                                                 (uint32_t)(xScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER),
     88                                                 (uint32_t)(yScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER));
    9089        }
    9190    }
     
    144143            }
    145144#endif /* VBOX_WS_WIN || VBOX_WS_X11 */
    146             display().NotifyScaleFactorChange(m_uScreenId,
    147                                               (uint32_t)(xScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER),
    148                                               (uint32_t)(yScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER));
     145            uimachine()->notifyScaleFactorChange(m_uScreenId,
     146                                                 (uint32_t)(xScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER),
     147                                                 (uint32_t)(yScaleFactor * VBOX_OGL_SCALE_FACTOR_MULTIPLIER));
    149148        }
    150149    }
     
    154153    /* Propagate unscaled-hidpi-output feature to 3D service if necessary: */
    155154    if (machine().GetGraphicsAdapter().GetAccelerate3DEnabled())
    156         display().NotifyHiDPIOutputPolicyChange(fUseUnscaledHiDPIOutput);
     155        uimachine()->notifyHiDPIOutputPolicyChange(fUseUnscaledHiDPIOutput);
    157156
    158157    /* Perform frame-buffer rescaling: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp

    r98432 r98556  
    4646/* COM includes: */
    4747#include "CConsole.h"
    48 #include "CDisplay.h"
    4948
    5049/* Other VBox includes: */
     
    136135{
    137136    /* Set seamless feature flag to the guest: */
    138     display().SetSeamlessMode(true);
     137    uimachine()->setSeamlessMode(true);
    139138}
    140139
     
    143142    /* Reset seamless feature flag if possible: */
    144143    if (uimachine()->isRunning())
    145         display().SetSeamlessMode(false);
     144        uimachine()->setSeamlessMode(false);
    146145}
    147146
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