VirtualBox

Changeset 97674 in vbox for trunk/src/VBox


Ignore:
Timestamp:
Nov 24, 2022 11:50:41 AM (2 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
154729
Message:

FE/Qt: bugref:10326: Bugfix for UIMachineWindowNormal; When scrollbars have to be visible because of lack of real screen estate we should take their geometry into account.

File:
1 edited

Legend:

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

    r96808 r97674  
    657657    const int db = frGeo.bottom() - geo.bottom();
    658658
     659    /* Get the best size w/o scroll-bars: */
    659660    if (fResizeToGuestDisplay)
    660661    {
    661         /* Get the best size w/o scroll-bars: */
     662        /* Get widget size-hint: */
    662663        QSize sh = sizeHint();
    663664
    664665        /* If guest-screen auto-resize is not enabled
    665          * or the guest-additions doesn't support graphics
    666          * we should take scroll-bars size-hints into account: */
    667         if (!machineView()->isGuestAutoresizeEnabled() || !uisession()->isGuestSupportsGraphics())
     666         * or guest-additions doesn't support graphics
     667         * we should deduce widget's size-hint on visible scroll-bar's hint: */
     668        if (   !machineView()->isGuestAutoresizeEnabled()
     669            || !uisession()->isGuestSupportsGraphics())
    668670        {
    669671            if (machineView()->verticalScrollBar()->isVisible())
     
    679681    }
    680682
    681     /* Adjust position if necessary: */
    682     if (fAdjustPosition)
    683         frGeo = UIDesktopWidgetWatchdog::normalizeGeometry(frGeo, gpDesktop->overallAvailableRegion());
     683    /* Adjust size/position if necessary: */
     684    QRect frGeoNew = fAdjustPosition
     685                   ? UIDesktopWidgetWatchdog::normalizeGeometry(frGeo, gpDesktop->overallAvailableRegion())
     686                   : frGeo;
     687
     688    /* If guest-screen auto-resize is not enabled
     689     * or the guest-additions doesn't support graphics
     690     * we should take scroll-bars size-hints into account: */
     691    if (   frGeoNew != frGeo
     692        && (   !machineView()->isGuestAutoresizeEnabled()
     693            || !uisession()->isGuestSupportsGraphics()))
     694    {
     695        /* Determine whether we need additional space for one or both scroll-bars: */
     696        QSize addition;
     697        if (frGeoNew.height() < frGeo.height())
     698            addition += QSize(machineView()->verticalScrollBar()->sizeHint().width() + 1, 0);
     699        if (frGeoNew.width() < frGeo.width())
     700            addition += QSize(0, machineView()->horizontalScrollBar()->sizeHint().height() + 1);
     701
     702        /* Resize the frame to fit the contents: */
     703        frGeoNew.setRight(frGeoNew.right() + addition.width());
     704        frGeoNew.setBottom(frGeoNew.bottom() + addition.height());
     705
     706        /* Adjust size/position again: */
     707        frGeoNew = UIDesktopWidgetWatchdog::normalizeGeometry(frGeoNew, gpDesktop->overallAvailableRegion());
     708    }
    684709
    685710    /* Finally, set the frame geometry: */
    686     UIDesktopWidgetWatchdog::setTopLevelGeometry(this, frGeo.left() + dl, frGeo.top() + dt,
    687                                     frGeo.width() - dl - dr, frGeo.height() - dt - db);
     711    UIDesktopWidgetWatchdog::setTopLevelGeometry(this,
     712                                                 frGeoNew.left() + dl, frGeoNew.top() + dt,
     713                                                 frGeoNew.width() - dl - dr, frGeoNew.height() - dt - db);
    688714#else /* VBOX_GUI_WITH_CUSTOMIZATIONS1 */
    689715    /* Customer request: There should no be
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