VirtualBox

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


Ignore:
Timestamp:
Jan 13, 2009 11:15:41 AM (16 years ago)
Author:
vboxsync
Message:

FE/Qt4: 2965: Main window and VM window should not appear outside the desktop: Main VM Selector window is now behaves according proposed rules.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Frontends/VirtualBox4/src/VBoxSelectorWnd.cpp

    r15185 r15910  
    591591        if (ok)
    592592            max = winPos.section (',', 4, 4) == VBoxDefs::GUI_LastWindowPosition_Max;
    593         if (ok && x > 0 && y > 0 /* to be sure it is not loaded out of the screen */)
    594         {
    595             QRect ar = QApplication::desktop()->availableGeometry (QPoint (x, y));
    596 
    597             /* Do some position checks */
    598             if (x < ar.left() || x > ar.right())
    599                 x = ar.left();
    600             if (y < ar.top() || y > ar.bottom())
    601                 y = ar.top();
    602 
     593
     594        QRect ar = ok ? QApplication::desktop()->availableGeometry (QPoint (x, y)) :
     595                        QApplication::desktop()->availableGeometry (this);
     596
     597        if (ok /* previous parameters were read correctly */
     598            && (y > 0) && (y < ar.bottom()) /* check vertical bounds */
     599            && (x + w > ar.left()) && (x < ar.right()) /* & horizontal bounds */)
     600        {
    603601            mNormalGeo.moveTo (x, y);
    604602            mNormalGeo.setSize (QSize (w, h).expandedTo (minimumSizeHint())
    605603                                            .boundedTo (ar.size()));
    606604            setGeometry (mNormalGeo);
    607 
    608             if (max)
    609                 /* maximize if needed */
     605            if (max) /* maximize if needed */
    610606                showMaximized();
    611607        }
    612608        else
    613609        {
    614             QRect ar = QApplication::desktop()->availableGeometry (this);
    615610            mNormalGeo.setSize (QSize (770, 550).expandedTo (minimumSizeHint())
    616611                                                .boundedTo (ar.size()));
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