VirtualBox

Changeset 7512 in vbox


Ignore:
Timestamp:
Mar 20, 2008 7:01:47 PM (17 years ago)
Author:
vboxsync
Message:

Frontends/VirtualBox: better handle VideoModeSupported requests - accept sizes less that 100 pixels below the screen size or sizes less than the last hint we sent, whichever is greater

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

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox/include/VBoxConsoleView.h

    r7463 r7512  
    196196private:
    197197
     198    void setDesktopGeometry(int minWidth, int minHeight);
    198199    void sendInitialSizeHint(void);
    199200    void maybeRestrictMinimumSize();
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxConsoleView.cpp

    r7483 r7512  
    755755    /* Remember the desktop geometry and register for geometry change
    756756       events for telling the guest about video modes we like. */
    757     mDesktopGeometry = QApplication::desktop()->screenGeometry (this);
     757
     758    doResizeDesktop(0);
    758759    connect (QApplication::desktop(), SIGNAL(workAreaResized(int)),
    759760             this, SLOT(doResizeDesktop(int)));
     
    35983599        LogFlowFunc (("Will suggest %d x %d\n", sz.width(), sz.height()));
    35993600
     3601        /* Increase the desktop geometry if needed */
     3602        setDesktopGeometry(sz.width(), sz.height());
     3603
    36003604        mConsole.GetDisplay().SetVideoModeHint (sz.width(), sz.height(), 0, 0);
    36013605    }
     
    36043608void VBoxConsoleView::doResizeDesktop (int)
    36053609{
    3606     mDesktopGeometry = QApplication::desktop()->screenGeometry (this);
    3607 }
     3610    setDesktopGeometry(0, 0);
     3611}
     3612
     3613/**
     3614 * Set the maximum size allowed for the guest desktop to the available area
     3615 * minus 100 pixels each way, or to the specified minimum width and height,
     3616 * whichever is greater.
     3617 *
     3618 * @param minWidth   The width that the guest screen should at least be
     3619 *                   allowed to increase to
     3620 * @param minHeight  The height that the guest screen should at least be
     3621 *                   allowed to increase to
     3622 */
     3623void VBoxConsoleView::setDesktopGeometry(int minWidth, int minHeight)
     3624{
     3625    LogFlowThisFunc(("minWidth=%d, minHeight=%d\n", minWidth, minHeight));
     3626    QRect desktopGeometry = QApplication::desktop()->screenGeometry (this);
     3627    int width = desktopGeometry.width();
     3628    if (width - 100 < minWidth)
     3629        width = minWidth;
     3630    else
     3631        width = width - 100;
     3632    int height = desktopGeometry.height();
     3633    if (height - 100 < minHeight)
     3634        height = minHeight;
     3635    else
     3636        height = height - 100;
     3637    LogFlowThisFunc(("Setting %d, %d\n", width, height));
     3638    mDesktopGeometry = QRect(0, 0, width, height);
     3639}
     3640
    36083641
    36093642/**
  • trunk/src/VBox/Frontends/VirtualBox/src/VBoxFrameBuffer.cpp

    r7482 r7512  
    194194                                                  ULONG aBPP, BOOL *aSupported)
    195195{
     196    LogFlowThisFunc(("aWidth=%lu, aHeight=%lu, aBPP=%lu\n",
     197                     (unsigned long) aWidth,  (unsigned long) aHeight,
     198                      (unsigned long) aBPP));
    196199    if (!aSupported)
    197200        return E_POINTER;
    198201    *aSupported = TRUE;
    199202    QRect screen = mView->getDesktopGeometry();
    200     /* Leave 200 pixels leeway. */
    201203    if (aWidth > (ULONG) screen.width())
    202204        *aSupported = FALSE;
     
    205207    if (aBPP != 32)
    206208        *aSupported = FALSE;
     209    LogFlowThisFunc(("returning aSupported=%d\n", *aSupported));
    207210    return S_OK;
    208211}
  • trunk/src/VBox/Frontends/VirtualBox4/include/VBoxConsoleView.h

    r7463 r7512  
    192192private:
    193193
     194    void setDesktopGeometry(int minWidth, int minHeight);
    194195    void sendInitialSizeHint(void);
    195196    void maybeRestrictMinimumSize();
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxConsoleView.cpp

    r7483 r7512  
    751751    /* Remember the desktop geometry and register for geometry change
    752752       events for telling the guest about video modes we like. */
    753     mDesktopGeometry = QApplication::desktop()->screenGeometry (this);
     753
     754    doResizeDesktop(0);
    754755    connect (QApplication::desktop(), SIGNAL(workAreaResized(int)),
    755756             this, SLOT(doResizeDesktop(int)));
     
    35923593        LogFlowFunc (("Will suggest %d x %d\n", sz.width(), sz.height()));
    35933594
     3595        /* Increase the desktop geometry if needed */
     3596        setDesktopGeometry(sz.width(), sz.height());
     3597
    35943598        mConsole.GetDisplay().SetVideoModeHint (sz.width(), sz.height(), 0, 0);
    35953599    }
     
    35983602void VBoxConsoleView::doResizeDesktop (int)
    35993603{
    3600     mDesktopGeometry = QApplication::desktop()->screenGeometry (this);
     3604    setDesktopGeometry(0, 0);
    36013605}
    36023606 
     3607/**
     3608 * Set the maximum size allowed for the guest desktop to the available area
     3609 * minus 100 pixels each way, or to the specified minimum width and height,
     3610 * whichever is greater.
     3611 *
     3612 * @param minWidth   The width that the guest screen should at least be
     3613 *                   allowed to increase to
     3614 * @param minHeight  The height that the guest screen should at least be
     3615 *                   allowed to increase to
     3616 */
     3617void VBoxConsoleView::setDesktopGeometry(int minWidth, int minHeight)
     3618{
     3619    LogFlowThisFunc(("minWidth=%d, minHeight=%d\n", minWidth, minHeight));
     3620    QRect desktopGeometry = QApplication::desktop()->screenGeometry (this);
     3621    int width = desktopGeometry.width();
     3622    if (width - 100 < minWidth)
     3623        width = minWidth;
     3624    else
     3625        width = width - 100;
     3626    int height = desktopGeometry.height();
     3627    if (height - 100 < minHeight)
     3628        height = minHeight;
     3629    else
     3630        height = height - 100;
     3631    LogFlowThisFunc(("Setting %d, %d\n", width, height));
     3632    mDesktopGeometry = QRect(0, 0, width, height);
     3633}
     3634
     3635
    36033636/**
    36043637 * We send an initial size hint to the VM on startup, based on the last
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxFrameBuffer.cpp

    r7463 r7512  
    195195                                                  ULONG aBPP, BOOL *aSupported)
    196196{
     197    LogFlowThisFunc(("aWidth=%lu, aHeight=%lu, aBPP=%lu\n",
     198                     (unsigned long) aWidth,  (unsigned long) aHeight,
     199                      (unsigned long) aBPP));
    197200    if (!aSupported)
    198201        return E_POINTER;
     
    205208    if (aBPP != 32)
    206209        *aSupported = FALSE;
     210    LogFlowThisFunc(("returning aSupported=%d\n", *aSupported));
    207211    return S_OK;
    208212}
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