VirtualBox

Changeset 76062 in vbox


Ignore:
Timestamp:
Dec 7, 2018 3:34:38 PM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:8694: Provide UIActionPoolRuntime with information about current guest-to-host screen mapping; This allows to update View/Scale-factor menu (for that cases when host-screens have different device-pixel-ratios) accordingly.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolRuntime.cpp

    r76056 r76062  
    31253125}
    31263126
    3127 void UIActionPoolRuntime::setHostScreenForGuestScreenMap(const QMap<int, int> &map)
    3128 {
    3129     m_mapHostScreenForGuestScreen = map;
     3127void UIActionPoolRuntime::setHostScreenForGuestScreenMap(const QMap<int, int> &scheme)
     3128{
     3129    m_mapHostScreenForGuestScreen = scheme;
    31303130    m_invalidations << UIActionIndexRT_M_View << UIActionIndexRT_M_ViewPopup;
     3131}
     3132
     3133QMap<int, int> UIActionPoolRuntime::hostScreenForGuestScreenMap() const
     3134{
     3135    return m_mapHostScreenForGuestScreen;
    31313136}
    31323137
     
    33003305}
    33013306
    3302 void UIActionPoolRuntime::sltHandleActionTriggerViewRescale(QAction *pAction)
     3307void UIActionPoolRuntime::sltHandleActionTriggerViewScreenRescale(QAction *pAction)
    33033308{
    33043309    /* Make sure sender is valid: */
     
    39843989        /* Get device-pixel-ratio: */
    39853990        bool fDevicePixelRatioMentioned = false;
    3986         const double dDevicePixelRatioActual = qMin(gpDesktop->devicePixelRatioActual(),
     3991        const double dDevicePixelRatioActual = qMin(gpDesktop->devicePixelRatioActual(m_mapHostScreenForGuestScreen.value(iGuestScreenIndex)),
    39873992                                                    10.0 /* meh, who knows? */);
    39883993
     
    40454050        /* Install listener for exclusive action-group: */
    40464051        connect(pActionGroup, &QActionGroup::triggered,
    4047                 this, &UIActionPoolRuntime::sltHandleActionTriggerViewRescale);
     4052                this, &UIActionPoolRuntime::sltHandleActionTriggerViewScreenRescale);
    40484053    }
    40494054}
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIActionPoolRuntime.h

    r76006 r76062  
    166166    void setGuestSupportsGraphics(bool fSupports);
    167167
    168     /** Defines host-to-guest mapping scheme. */
    169     void setHostScreenForGuestScreenMap(const QMap<int, int> &map);
     168    /** Defines host-to-guest mapping @a scheme. */
     169    void setHostScreenForGuestScreenMap(const QMap<int, int> &scheme);
     170    /** Returns host-to-guest mapping scheme. */
     171    QMap<int, int> hostScreenForGuestScreenMap() const;
    170172
    171173    /** Returns whether the action with passed @a type is allowed in the 'Machine' menu. */
     
    211213    void sltHandleActionTriggerViewScreenRemap(QAction *pAction);
    212214    /** Handles 'View' : 'Virtual Screen #' menu : 'Rescale' @a pAction trigger. */
    213     void sltHandleActionTriggerViewRescale(QAction *pAction);
     215    void sltHandleActionTriggerViewScreenRescale(QAction *pAction);
    214216
    215217protected:
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r76016 r76062  
    2828/* GUI includes: */
    2929# include "VBoxGlobal.h"
     30# include "UIActionPoolRuntime.h"
    3031# include "UIDesktopWidgetWatchdog.h"
    3132# include "UIExtraDataManager.h"
     
    14711472                    /* Reapply machine-view scale-factor if necessary: */
    14721473                    applyMachineViewScaleFactor();
     1474                    /* For 'normal'/'scaled' visual state type: */
     1475                    if (   visualStateType() == UIVisualStateType_Normal
     1476                        || visualStateType() == UIVisualStateType_Scale)
     1477                    {
     1478                        /* Make sure action-pool is of 'runtime' type: */
     1479                        UIActionPoolRuntime *pActionPool = actionPool() && actionPool()->toRuntime() ? actionPool()->toRuntime() : 0;
     1480                        AssertPtr(pActionPool);
     1481                        if (pActionPool)
     1482                        {
     1483                            /* Inform action-pool about current guest-to-host screen mapping: */
     1484                            QMap<int, int> screenMap = pActionPool->hostScreenForGuestScreenMap();
     1485                            screenMap[m_uScreenId] = m_iHostScreenNumber;
     1486                            pActionPool->setHostScreenForGuestScreenMap(screenMap);
     1487                        }
     1488                    }
    14731489                }
    14741490                break;
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