VirtualBox

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


Ignore:
Timestamp:
Sep 23, 2013 4:23:31 PM (11 years ago)
Author:
vboxsync
Message:

FE/Qt: limit the maximum recommended guest screen size before the window is visible.

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

Legend:

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

    r47493 r48642  
    172172     * but not for Fullscreen and Scale.  However for Scale it is a no op.,
    173173     * so it would not hurt.  Would it hurt for Fullscreen? */
     174
     175    /* Set a preliminary maximum size: */
     176    pMachineView->setMaxGuestSize();
    174177
    175178    return pMachineView;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp

    r46361 r48642  
    257257    /* The current size of the machine display. */
    258258    QSize centralWidgetSize = machineWindow()->centralWidget()->size();
     259    /* The calculation below is not reliable on some (X11) platforms until we
     260     * have been visible for a fraction of a second, so so the best we can
     261     * otherwise. */
     262    if (!isVisible())
     263        return workingArea().size() * 0.95;
    259264    /* To work out how big the guest display can get without the window going
    260265     * over the maximum size we calculated above, we work out how much space
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/scale/UIMachineViewScale.cpp

    r46361 r48642  
    196196QSize UIMachineViewScale::calculateMaxGuestSize() const
    197197{
    198     /* The area taken up by the machine window on the desktop,
    199      * including window frame, title, menu bar and status bar: */
    200     QRect windowGeo = machineWindow()->frameGeometry();
    201     /* The area taken up by the machine central widget, so excluding all decorations: */
    202     QRect centralWidgetGeo = machineWindow()->centralWidget()->geometry();
    203     /* To work out how big we can make the console window while still fitting on the desktop,
    204      * we calculate workingArea() - (windowGeo - centralWidgetGeo).
    205      * This works because the difference between machine window and machine central widget
    206      * (or at least its width and height) is a constant. */
    207     return QSize(  workingArea().width()
    208                  - (windowGeo.width() - centralWidgetGeo.width()),
    209                    workingArea().height()
    210                  - (windowGeo.height() - centralWidgetGeo.height()));
     198    /* The area taken up by the machine window on the desktop, including window
     199     * frame, title, menu bar and status bar. */
     200    QSize windowSize = machineWindow()->frameGeometry().size();
     201    /* The window shouldn't be allowed to expand beyond the working area
     202     * unless it already does.  In that case the guest shouldn't expand it
     203     * any further though. */
     204    QSize maximumSize = workingArea().size().expandedTo(windowSize);
     205    /* The current size of the machine display. */
     206    QSize centralWidgetSize = machineWindow()->centralWidget()->size();
     207    /* The calculation below is not reliable on some (X11) platforms until we
     208     * have been visible for a fraction of a second, so so the best we can
     209     * otherwise. */
     210    if (!isVisible())
     211        return workingArea().size() * 0.95;
     212    /* To work out how big the guest display can get without the window going
     213     * over the maximum size we calculated above, we work out how much space
     214     * the other parts of the window (frame, menu bar, status bar and so on)
     215     * take up and subtract that space from the maximum window size. The
     216     * central widget shouldn't be bigger than the window, but we bound it for
     217     * sanity (or insanity) reasons. */
     218    return maximumSize - (windowSize - centralWidgetSize.boundedTo(windowSize));
    211219}
    212220
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