VirtualBox

Changeset 55939 in vbox


Ignore:
Timestamp:
May 19, 2015 3:53:48 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: always save mode hints to extra data and restore them on non-full-screen-mode start-up too.

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

Legend:

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

    r55346 r55939  
    113113const char* UIExtraDataDefs::GUI_AutoresizeGuest = "GUI/AutoresizeGuest";
    114114const char* UIExtraDataDefs::GUI_LastGuestSizeHint = "GUI/LastGuestSizeHint";
    115 const char* UIExtraDataDefs::GUI_LastGuestSizeHintWasFullscreen = "GUI/LastGuestSizeHintWasFullscreen";
    116115const char* UIExtraDataDefs::GUI_VirtualScreenToHostScreen = "GUI/VirtualScreenToHostScreen";
    117116const char* UIExtraDataDefs::GUI_AutomountGuestScreens = "GUI/AutomountGuestScreens";
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataDefs.h

    r55401 r55939  
    193193        extern const char* GUI_LastGuestSizeHint;
    194194        /** Prefix used by composite extra-data keys,
    195           * which holds whether guest size-hint was for full or seamless screen per screen-index. */
    196         extern const char* GUI_LastGuestSizeHintWasFullscreen;
    197         /** Prefix used by composite extra-data keys,
    198195          * which holds host-screen index per guest-screen index. */
    199196        extern const char* GUI_VirtualScreenToHostScreen;
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.cpp

    r55726 r55939  
    17771777           << GUI_Fullscreen_LegacyMode
    17781778#endif /* Q_WS_X11 */
    1779            << GUI_AutoresizeGuest << GUI_LastGuestSizeHint << GUI_LastGuestSizeHintWasFullscreen
     1779           << GUI_AutoresizeGuest << GUI_LastGuestSizeHint
    17801780           << GUI_VirtualScreenToHostScreen << GUI_AutomountGuestScreens
    17811781#ifdef VBOX_WITH_VIDEOHWACCEL
     
    31083108    /* Re-cache corresponding extra-data: */
    31093109    setExtraDataStringList(strKey, data, strID);
    3110 }
    3111 
    3112 bool UIExtraDataManager::wasLastGuestSizeHintForFullScreen(ulong uScreenIndex, const QString &strID)
    3113 {
    3114     /* Choose corresponding key: */
    3115     const QString strKey = extraDataKeyPerScreen(GUI_LastGuestSizeHintWasFullscreen, uScreenIndex);
    3116 
    3117     /* 'True' only if feature is allowed: */
    3118     return isFeatureAllowed(strKey, strID);
    3119 }
    3120 
    3121 void UIExtraDataManager::markLastGuestSizeHintAsFullScreen(ulong uScreenIndex, bool fWas, const QString &strID)
    3122 {
    3123     /* Choose corresponding key: */
    3124     const QString strKey = extraDataKeyPerScreen(GUI_LastGuestSizeHintWasFullscreen, uScreenIndex);
    3125 
    3126     /* 'True' if feature allowed, null-string otherwise: */
    3127     return setExtraDataString(strKey, toFeatureAllowed(fWas), strID);
    31283110}
    31293111
  • trunk/src/VBox/Frontends/VirtualBox/src/extradata/UIExtraDataManager.h

    r55726 r55939  
    383383        /** Defines last guest-screen @a sizeHint for screen with @a uScreenIndex. */
    384384        void setLastGuestSizeHint(ulong uScreenIndex, const QSize &sizeHint, const QString &strID);
    385         /** Returns whether guest size-hint was for full or seamless screen with @a uScreenIndex. */
    386         bool wasLastGuestSizeHintForFullScreen(ulong uScreenIndex, const QString &strID);
    387         /** Defines whether guest size-hint @a fWas for full or seamless screen with @a uScreenIndex. */
    388         void markLastGuestSizeHintAsFullScreen(ulong uScreenIndex, bool fWas, const QString &strID);
    389385
    390386        /** Returns host-screen index corresponding to passed guest-screen @a iGuestScreenIndex. */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.cpp

    r55854 r55939  
    237237                               false, 0, 0, size.width(), size.height(), 0);
    238238
    239     /* And track whether we have a "normal" or "fullscreen"/"seamless" size-hint sent: */
    240     gEDataManager->markLastGuestSizeHintAsFullScreen(m_uScreenId, isFullscreenOrSeamless(), vboxGlobal().managedVMUuid());
     239    /* If we are in normal or scaled mode, remember the size sent for the next
     240     * time we have to restore one of those two modes: */
     241    if (!isFullscreenOrSeamless())
     242        storeGuestSizeHint(size);
    241243}
    242244
     
    826828QSize UIMachineView::sizeHint() const
    827829{
    828     if (m_sizeHintOverride.isValid())
     830    if (m_sizeHintOverride.isValid() && uisession()->isGuestSupportsGraphics())
    829831        return m_sizeHintOverride;
    830832
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp

    r54160 r55939  
    5555    , m_bIsGuestAutoresizeEnabled(actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize)->isChecked())
    5656{
    57     /* Resend the last resize hint if necessary: */
    58     maybeResendSizeHint();
     57    /* Resend the last resize hint: */
     58    resendSizeHint();
    5959}
    6060
    6161UIMachineViewNormal::~UIMachineViewNormal()
    6262{
    63     /* Save machine view settings: */
    64     saveMachineViewSettings();
    65 
    6663    /* Cleanup frame buffer: */
    6764    cleanupFrameBuffer();
     
    127124}
    128125
    129 void UIMachineViewNormal::saveMachineViewSettings()
    130 {
    131     /* If guest screen-still visible => store it's size-hint: */
    132     if (uisession()->isScreenVisible(screenId()))
    133         storeGuestSizeHint(QSize(frameBuffer()->width(), frameBuffer()->height()));
    134 }
    135 
    136126void UIMachineViewNormal::setGuestAutoresizeEnabled(bool fEnabled)
    137127{
     
    145135}
    146136
    147 void UIMachineViewNormal::maybeResendSizeHint()
     137void UIMachineViewNormal::resendSizeHint()
    148138{
    149     if (m_bIsGuestAutoresizeEnabled && uisession()->isGuestSupportsGraphics())
    150     {
    151         /* Send guest-screen size-hint if needed to reverse a transition to fullscreen or seamless: */
    152         if (gEDataManager->wasLastGuestSizeHintForFullScreen(m_uScreenId, vboxGlobal().managedVMUuid()))
    153         {
    154             const QSize sizeHint = guestSizeHint();
    155             LogRel(("UIMachineViewNormal::maybeResendSizeHint: "
    156                     "Restoring guest size-hint for screen %d to %dx%d\n",
    157                     (int)screenId(), sizeHint.width(), sizeHint.height()));
    158             /* Temporarily restrict the size to prevent a brief resize to the
    159              * framebuffer dimensions (see @a UIMachineView::sizeHint()) before
    160              * the following resize() is acted upon. */
    161             setMaximumSize(sizeHint);
    162             m_sizeHintOverride = sizeHint;
    163             sltPerformGuestResize(sizeHint);
    164         }
    165     }
     139    const QSize sizeHint = guestSizeHint();
     140    LogRel(("GUI: UIMachineViewNormal::resendSizeHint: Restoring guest size-hint for screen %d to %dx%d\n",
     141            (int)screenId(), sizeHint.width(), sizeHint.height()));
     142    /* Temporarily restrict the size to prevent a brief resize to the
     143     * framebuffer dimensions (see @a UIMachineView::sizeHint()) before
     144     * the following resize() is acted upon. */
     145    setMaximumSize(sizeHint);
     146    m_sizeHintOverride = sizeHint;
     147    sltPerformGuestResize(sizeHint);
    166148}
    167149
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.h

    r55401 r55939  
    5252    void prepareFilters();
    5353    void prepareConsoleConnections();
    54     //void loadMachineViewSettings();
    5554
    5655    /* Cleanup helpers: */
    57     void saveMachineViewSettings();
    5856    //void cleanupConsoleConnections() {}
    5957    //void cleanupFilters() {}
     
    6361    void setGuestAutoresizeEnabled(bool bEnabled);
    6462
    65     /** Resends guest size-hint if necessary. */
    66     void maybeResendSizeHint();
     63    /** Resends guest size-hint. */
     64    void resendSizeHint();
    6765
    6866    /** Adjusts guest-screen size to correspond current <i>machine-window</i> size. */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp

    r54603 r55939  
    5757                    )
    5858{
    59     /* Resend the last resize hint if necessary: */
    60     maybeResendSizeHint();
     59    /* Resend the last resize hint: */
     60    resendSizeHint();
    6161}
    6262
    6363UIMachineViewScale::~UIMachineViewScale()
    6464{
    65     /* Save machine view settings: */
    66     saveMachineViewSettings();
    67 
    6865    /* Cleanup frame buffer: */
    6966    cleanupFrameBuffer();
     
    121118}
    122119
    123 void UIMachineViewScale::saveMachineViewSettings()
    124 {
    125     /* If guest screen-still visible => store it's size-hint: */
    126     if (uisession()->isScreenVisible(screenId()))
    127         storeGuestSizeHint(QSize(frameBuffer()->width(), frameBuffer()->height()));
    128 }
    129 
    130120void UIMachineViewScale::applyMachineViewScaleFactor()
    131121{
     
    161151}
    162152
    163 void UIMachineViewScale::maybeResendSizeHint()
    164 {
    165     if (uisession()->isGuestSupportsGraphics())
    166     {
    167         /* Send guest-screen size-hint if needed to reverse a transition to fullscreen or seamless: */
    168         if (gEDataManager->wasLastGuestSizeHintForFullScreen(m_uScreenId, vboxGlobal().managedVMUuid()))
    169         {
    170             const QSize sizeHint = guestSizeHint();
    171             LogRel(("UIMachineViewScale::maybeResendSizeHint: "
    172                     "Restoring guest size-hint for screen %d to %dx%d\n",
    173                     (int)screenId(), sizeHint.width(), sizeHint.height()));
    174             sltPerformGuestResize(sizeHint);
    175         }
    176     }
     153void UIMachineViewScale::resendSizeHint()
     154{
     155    const QSize sizeHint = guestSizeHint();
     156    LogRel(("GUI: UIMachineViewScale::resendSizeHint: Restoring guest size-hint for screen %d to %dx%d\n",
     157            (int)screenId(), sizeHint.width(), sizeHint.height()));
     158    sltPerformGuestResize(sizeHint);
    177159}
    178160
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.h

    r55401 r55939  
    4848    bool eventFilter(QObject *pWatched, QEvent *pEvent);
    4949
    50     /* Prepare helpers: */
    51     //void loadMachineViewSettings() {}
    52 
    53     /* Cleanup helpers: */
    54     void saveMachineViewSettings();
    55 
    5650    /** Applies machine-view scale-factor. */
    5751    void applyMachineViewScaleFactor();
    5852
    59     /** Resends guest size-hint if necessary. */
    60     void maybeResendSizeHint();
     53    /** Resends guest size-hint. */
     54    void resendSizeHint();
    6155
    6256    /* Private helpers: */
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