VirtualBox

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


Ignore:
Timestamp:
Mar 6, 2008 2:10:52 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
28738
Message:

Frontends/VirtualBox: added an initial size hint for VMs

File:
1 edited

Legend:

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

    r7319 r7322  
    28582858                }
    28592859            }
     2860            else if (mLastState == KMachineState_Starting)
     2861            {
     2862                /* Suggest an initial size. */
     2863                sendInitialSizeHint ();
     2864            }
    28602865            /* reuse the focus event handler to capture input */
    28612866            if (hasFocus())
     
    35653570}
    35663571
     3572
     3573/**
     3574 * We send an initial size hint to the VM on startup, so that it can choose
     3575 * an initial size which is well-readable on the host screen.
     3576 */
     3577void VBoxConsoleView::sendInitialSizeHint(void)
     3578{
     3579    enum { NUM_RES = 4 };
     3580
     3581    const int sizeList[NUM_RES][2] =
     3582    {
     3583        { 640, 480 },
     3584        { 800, 600 },
     3585        { 1024, 768 },
     3586        { 1280, 960 }
     3587    };
     3588    /** @todo save the last resize hint sent before a VM shutdown in
     3589        the XML and send that on next startup. */
     3590    QRect screen = QApplication::desktop()->screenGeometry (this);
     3591    unsigned i = 0;
     3592    /* Find a size that is smaller than three quarters of the reported
     3593       screen geometry. */
     3594    while (   (i + 1 < NUM_RES)
     3595           && (sizeList[i + 1][0] < screen.width() * 3 / 4)
     3596           && (sizeList[i + 1][1] < screen.height() * 3 / 4))
     3597        ++i;
     3598    LogFlowFunc (("Will suggest %d x %d\n", sizeList[i][0], sizeList[i][1]));
     3599    mConsole.GetDisplay().SetVideoModeHint (sizeList[i][0], sizeList[i][1], 0, 0);
     3600}
     3601
    35673602/**
    35683603 *  Sets the the minimum size restriction depending on the auto-resize feature
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette