VirtualBox

Changeset 57495 in vbox


Ignore:
Timestamp:
Aug 21, 2015 12:50:43 PM (9 years ago)
Author:
vboxsync
Message:

FE/Qt: better fix for temporary over-sized windows when exiting full-screen and seamless.

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

Legend:

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

    r57080 r57495  
    280280            /* Assign new frame-buffer logical-size: */
    281281            frameBuffer()->setScaledSize(size());
     282
     283            /* Forget the last full-screen size: */
     284            uisession()->setLastFullScreenSize(screenId(), QSize(-1, -1));
    282285        }
    283286        /* For other than 'scale' mode: */
     
    287290            setMaximumSize(sizeHint());
    288291
    289             /* Disable the resize hint override hack: */
     292            /* Disable the resize hint override hack and forget the last full-screen size: */
    290293            m_sizeHintOverride = QSize(-1, -1);
     294            if (visualStateType() == UIVisualStateType_Normal)
     295                uisession()->setLastFullScreenSize(screenId(), QSize(-1, -1));
    291296
    292297            /* Force machine-window update own layout: */
     
    843848QSize UIMachineView::sizeHint() const
    844849{
    845     if (m_sizeHintOverride.isValid() && uisession()->isGuestSupportsGraphics())
     850    /* Temporarily restrict the size to prevent a brief resize to the
     851     * frame-buffer dimensions when we exit full-screen.  This is only
     852     * applied if the frame-buffer is at full-screen dimensions and
     853     * until the first machine view resize. */
     854
     855    /* Get the frame-buffer dimensions: */
     856    QSize frameBufferSize(frameBuffer()->width(), frameBuffer()->height());
     857    /* Take the scale-factor(s) into account: */
     858    frameBufferSize = scaledForward(frameBufferSize);
     859    /* Check against the last full-screen size. */
     860    if (frameBufferSize == uisession()->lastFullScreenSize(screenId()) && m_sizeHintOverride.isValid())
    846861        return m_sizeHintOverride;
    847862
     
    977992            /* Adjust maximum-size restriction for machine-view: */
    978993            setMaximumSize(sizeHint());
    979 
    980             /* Disable the resize hint override hack: */
    981             m_sizeHintOverride = QSize(-1, -1);
    982994
    983995            /* Force machine-window update own layout: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.cpp

    r57285 r57495  
    12431243    m_monitorVisibilityVector[0] = true;
    12441244
     1245    /* Prepare empty last full-screen size vector: */
     1246    m_monitorLastFullScreenSizeVector.resize(machine().GetMonitorCount());
     1247    m_monitorLastFullScreenSizeVector.fill(QSize(-1, -1));
     1248
    12451249    /* If machine is in 'saved' state: */
    12461250    if (isSaved())
     
    19251929}
    19261930
     1931QSize UISession::lastFullScreenSize(ulong uScreenId) const
     1932{
     1933    /* Make sure index fits the bounds: */
     1934    AssertReturn(uScreenId < (ulong)m_monitorLastFullScreenSizeVector.size(), QSize(-1, -1));
     1935
     1936    /* Return last full-screen size: */
     1937    return m_monitorLastFullScreenSizeVector.value((int)uScreenId);
     1938}
     1939
     1940void UISession::setLastFullScreenSize(ulong uScreenId, QSize size)
     1941{
     1942    /* Make sure index fits the bounds: */
     1943    AssertReturnVoid(uScreenId < (ulong)m_monitorLastFullScreenSizeVector.size());
     1944
     1945    /* Remember last full-screen size: */
     1946    m_monitorLastFullScreenSizeVector[(int)uScreenId] = size;
     1947}
     1948
    19271949int UISession::countOfVisibleWindows()
    19281950{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UISession.h

    r57178 r57495  
    227227    void setScreenVisible(ulong uScreenId, bool fIsMonitorVisible);
    228228
     229    /* Last screen full-screen size: */
     230    QSize lastFullScreenSize(ulong uScreenId) const;
     231    void setLastFullScreenSize(ulong uScreenId, QSize size);
     232
    229233    /* Returns existing framebuffer for the given screen-number;
    230234     * Returns 0 (asserts) if screen-number attribute is out of bounds: */
     
    407411    QVector<bool> m_monitorVisibilityVector;
    408412
     413    /* Screen last full-screen size vector: */
     414    QVector<QSize> m_monitorLastFullScreenSizeVector;
     415
    409416    /* Frame-buffers vector: */
    410417    QVector<UIFrameBuffer*> m_frameBufferVector;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.cpp

    r57483 r57495  
    209209        frameBuffer()->setAutoEnabled(false);
    210210        sltPerformGuestResize(workingArea().size());
     211        /* And remember the size to know what we are resizing out of when we exit: */
     212        uisession()->setLastFullScreenSize(screenId(), workingArea().size());
    211213    }
    212214}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp

    r57285 r57495  
    145145    setMaxGuestSize(sizeHint);
    146146
    147     if (uisession()->isGuestSupportsGraphics())
    148     {
    149         /* Temporarily restrict the size to prevent a brief resize to the
    150          * framebuffer dimensions (see @a UIMachineView::sizeHint()) before
    151          * the following resize() is acted upon.  Expand current limitations
    152          * too. */
    153         setMaximumSize(sizeHint);
    154         m_sizeHintOverride = sizeHint;
    155     }
     147    /* Temporarily restrict the size to prevent a brief resize to the
     148     * frame-buffer dimensions when we exit full-screen.  This is only
     149     * applied if the frame-buffer is at full-screen dimensions and
     150     * until the first machine view resize. */
     151    m_sizeHintOverride = QSize(800, 600).expandedTo(sizeHint);
    156152
    157153    /* Send saved size-hint to the guest: */
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp

    r57483 r57495  
    217217        frameBuffer()->setAutoEnabled(false);
    218218        sltPerformGuestResize(workingArea().size());
     219        /* And remember the size to know what we are resizing out of when we exit: */
     220        uisession()->setLastFullScreenSize(screenId(), workingArea().size());
    219221    }
    220222}
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