VirtualBox

Changeset 52246 in vbox for trunk/src/VBox/Frontends


Ignore:
Timestamp:
Jul 31, 2014 12:09:47 PM (10 years ago)
Author:
vboxsync
Message:

FE/Qt: Runtime UI: More appropriate procedure of saving/restoring guest size-hints for normal/scale <=> fullscreen/seamless transitions.

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

Legend:

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

    r52202 r52246  
    181181
    182182    /* Send new size-hint to the guest: */
    183     LogRelFlow(("UIMachineView: Sending guest size-hint to screen %d: %dx%d\n",
    184                 (int)screenId(), newSize.width(), newSize.height()));
     183    LogRel(("UIMachineView::sltPerformGuestResize: "
     184            "Sending guest size-hint to screen %d as %dx%d\n",
     185            (int)screenId(), newSize.width(), newSize.height()));
    185186    session().GetConsole().GetDisplay().SetVideoModeHint(screenId(),
    186187                                                         uisession()->isScreenVisible(screenId()),
     
    654655{
    655656    /* Save guest-screen size-hint: */
     657    LogRel(("UIMachineView::storeGuestSizeHint: "
     658            "Storing guest size-hint for screen %d as %dx%d\n",
     659            (int)screenId(), size.width(), size.height()));
    656660    gEDataManager->setLastGuestSizeHint(m_uScreenId, size, vboxGlobal().managedVMUuid());
    657661}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp

    r52202 r52246  
    5050    , m_bIsGuestAutoresizeEnabled(actionPool()->action(UIActionIndexRT_M_View_T_GuestAutoresize)->isChecked())
    5151{
    52     /* Resend the last resize hint if there was a fullscreen or
    53      * seamless transition previously. If we were not in graphical
    54      * mode initially after the transition this happens when we switch. */
    55     maybeResendResizeHint();
     52    /* Resend the last resize hint if necessary: */
     53    maybeResendSizeHint();
    5654}
    5755
     
    146144void UIMachineViewNormal::saveMachineViewSettings()
    147145{
    148     /* Store guest size in case we are switching to fullscreen: */
    149     storeGuestSizeHint(QSize(frameBuffer()->width(), frameBuffer()->height()));
     146    /* If guest screen-still visible => store it's size-hint: */
     147    if (uisession()->isScreenVisible(screenId()))
     148        storeGuestSizeHint(QSize(frameBuffer()->width(), frameBuffer()->height()));
    150149}
    151150
     
    161160}
    162161
    163 /**
    164  * Resends guest size-hint if necessary.
    165  * If the last guest size hint was sent to switch to
    166  * fullscreen or seamless mode then send one to restore the old view size.
    167  * @note This method also does some hacks to suppress intermediary resizes
    168  *       to the old fullscreen size.
    169  */
    170 void UIMachineViewNormal::maybeResendResizeHint()
     162void UIMachineViewNormal::maybeResendSizeHint()
    171163{
    172164    if (m_bIsGuestAutoresizeEnabled && uisession()->isGuestSupportsGraphics())
     
    175167        if (gEDataManager->wasLastGuestSizeHintForFullScreen(m_uScreenId, vboxGlobal().managedVMUuid()))
    176168        {
    177             QSize hint = guestSizeHint();
     169            const QSize sizeHint = guestSizeHint();
     170            LogRel(("UIMachineViewNormal::maybeResendSizeHint: "
     171                    "Restoring guest size-hint for screen %d to %dx%d\n",
     172                    (int)screenId(), sizeHint.width(), sizeHint.height()));
    178173            /* Temporarily restrict the size to prevent a brief resize to the
    179174             * framebuffer dimensions (see @a UIMachineView::sizeHint()) before
    180175             * the following resize() is acted upon. */
    181             setMaximumSize(hint);
    182             m_sizeHintOverride = hint;
    183             sltPerformGuestResize(hint);
     176            setMaximumSize(sizeHint);
     177            m_sizeHintOverride = sizeHint;
     178            sltPerformGuestResize(sizeHint);
    184179        }
    185180    }
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.h

    r49177 r52246  
    6464    void setGuestAutoresizeEnabled(bool bEnabled);
    6565
     66    /** Resends guest size-hint if necessary. */
     67    void maybeResendSizeHint();
     68
    6669    /* Private helpers: */
    67     void maybeResendResizeHint();
    6870    void maybeAdjustGuestScreenSize();
    6971    QRect workingArea() const;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp

    r52200 r52246  
    2929#include "UIMachineWindow.h"
    3030#include "UIMachineViewScale.h"
     31#include "UIExtraDataManager.h"
    3132#include "UIFrameBuffer.h"
    3233
     
    4950    , m_pPauseImage(0)
    5051{
     52    /* Resend the last resize hint if necessary: */
     53    maybeResendSizeHint();
    5154}
    5255
     
    174177void UIMachineViewScale::saveMachineViewSettings()
    175178{
    176     /* Store guest size in case we are switching to fullscreen: */
    177     storeGuestSizeHint(QSize(frameBuffer()->width(), frameBuffer()->height()));
     179    /* If guest screen-still visible => store it's size-hint: */
     180    if (uisession()->isScreenVisible(screenId()))
     181        storeGuestSizeHint(QSize(frameBuffer()->width(), frameBuffer()->height()));
     182}
     183
     184void UIMachineViewScale::maybeResendSizeHint()
     185{
     186    if (uisession()->isGuestSupportsGraphics())
     187    {
     188        /* Send guest-screen size-hint if needed to reverse a transition to fullscreen or seamless: */
     189        if (gEDataManager->wasLastGuestSizeHintForFullScreen(m_uScreenId, vboxGlobal().managedVMUuid()))
     190        {
     191            const QSize sizeHint = guestSizeHint();
     192            LogRel(("UIMachineViewScale::maybeResendSizeHint: "
     193                    "Restoring guest size-hint for screen %d to %dx%d\n",
     194                    (int)screenId(), sizeHint.width(), sizeHint.height()));
     195            sltPerformGuestResize(sizeHint);
     196        }
     197    }
    178198}
    179199
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.h

    r49177 r52246  
    6363    void saveMachineViewSettings();
    6464
     65    /** Resends guest size-hint if necessary. */
     66    void maybeResendSizeHint();
     67
    6568    /* Private helpers: */
    6669    QSize sizeHint() const;
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