VirtualBox

Changeset 27237 in vbox for trunk/src


Ignore:
Timestamp:
Mar 10, 2010 12:11:51 AM (15 years ago)
Author:
vboxsync
Message:

FE/Qt4: New running VM core: calculate geometry fix for normal, fullscreen, seamless modes.

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

Legend:

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

    r27236 r27237  
    340340{
    341341    m_storedConsoleSize = QSize(iWidth, iHeight);
    342 }
    343 
    344 void UIMachineView::calculateDesktopGeometry()
    345 {
    346     /* This method should not get called until we have initially set up the m_desktopGeometryType: */
    347     Assert((m_desktopGeometryType != DesktopGeo_Invalid));
    348     /* If we are not doing automatic geometry calculation then there is nothing to do: */
    349     if (DesktopGeo_Automatic == m_desktopGeometryType)
    350     {
    351         /* Available geometry of the desktop.  If the desktop is a single
    352          * screen, this will exclude space taken up by desktop taskbars
    353          * and things, but this is unfortunately not true for the more
    354          * complex case of a desktop spanning multiple screens: */
    355         QRect desktop = availableGeometry();
    356         /* The area taken up by the machine window on the desktop,
    357          * including window frame, title and menu bar and whatnot: */
    358         QRect frame = machineWindowWrapper()->machineWindow()->frameGeometry();
    359         /* The area taken up by the machine view, so excluding all decorations: */
    360         QRect window = geometry();
    361         /* To work out how big we can make the console window while still
    362          * fitting on the desktop, we calculate desktop - frame + window.
    363          * This works because the difference between frame and window
    364          * (or at least its width and height) is a constant. */
    365         m_desktopGeometry = QSize(desktop.width() - frame.width() + window.width(),
    366                                   desktop.height() - frame.height() + window.height());
    367     }
    368342}
    369343
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMachineView.h

    r27236 r27237  
    112112    const QPixmap& pauseShot() const { return m_pauseShot; }
    113113    QSize storedConsoleSize() const { return m_storedConsoleSize; }
    114     virtual QSize desktopGeometry() const;
     114    DesktopGeo desktopGeometryType() const { return m_desktopGeometryType; }
     115    QSize desktopGeometry() const;
    115116
    116117    /* Protected setters: */
     
    120121
    121122    /* Protected helpers: */
    122     void calculateDesktopGeometry();
    123123    void updateMouseCursorShape();
    124124#ifdef Q_WS_WIN32
     
    126126#endif
    127127    virtual QRect availableGeometry() = 0;
     128    virtual void calculateDesktopGeometry() = 0;
    128129    virtual void maybeRestrictMinimumSize() = 0;
    129130    virtual void updateSliders() =  0;
     
    153154    bool event(QEvent *pEvent);
    154155    bool eventFilter(QObject *pWatched, QEvent *pEvent);
     156
     157    /* Protected variables: */
     158    QSize m_desktopGeometry;
    155159
    156160protected slots:
     
    222226
    223227    DesktopGeo m_desktopGeometryType;
    224     QSize m_desktopGeometry;
    225228    QSize m_storedConsoleSize;
    226229
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.cpp

    r27236 r27237  
    267267}
    268268
     269void UIMachineViewFullscreen::calculateDesktopGeometry()
     270{
     271    /* This method should not get called until we have initially set up the desktop geometry type: */
     272    Assert((desktopGeometryType() != DesktopGeo_Invalid));
     273    /* If we are not doing automatic geometry calculation then there is nothing to do: */
     274    if (desktopGeometryType() == DesktopGeo_Automatic)
     275    {
     276        m_desktopGeometry = QSize(availableGeometry().width(), availableGeometry().height());
     277    }
     278}
     279
    269280void UIMachineViewFullscreen::maybeRestrictMinimumSize()
    270281{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/fullscreen/UIMachineViewFullscreen.h

    r27236 r27237  
    7979    void normalizeGeometry(bool /* fAdjustPosition */) {}
    8080    QRect availableGeometry();
     81    void calculateDesktopGeometry();
    8182    void maybeRestrictMinimumSize();
    8283    void updateSliders() {}
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.cpp

    r27236 r27237  
    322322}
    323323
     324void UIMachineViewNormal::calculateDesktopGeometry()
     325{
     326    /* This method should not get called until we have initially set up the desktop geometry type: */
     327    Assert((desktopGeometryType() != DesktopGeo_Invalid));
     328    /* If we are not doing automatic geometry calculation then there is nothing to do: */
     329    if (desktopGeometryType() == DesktopGeo_Automatic)
     330    {
     331        /* The area taken up by the machine window on the desktop,
     332         * including window frame, title, menu bar and status bar: */
     333        QRect windowGeo = machineWindowWrapper()->machineWindow()->frameGeometry();
     334        /* The area taken up by the machine central widget, so excluding all decorations: */
     335        QRect centralWidgetGeo = static_cast<QIMainDialog*>(machineWindowWrapper()->machineWindow())->centralWidget()->geometry();
     336        /* To work out how big we can make the console window while still fitting on the desktop,
     337         * we calculate availableGeometry() - (windowGeo - centralWidgetGeo).
     338         * This works because the difference between machine window and machine central widget
     339         * (or at least its width and height) is a constant. */
     340        m_desktopGeometry = QSize(availableGeometry().width() - (windowGeo.width() - centralWidgetGeo.width()),
     341                                  availableGeometry().height() - (windowGeo.height() - centralWidgetGeo.height()));
     342    }
     343}
     344
    324345void UIMachineViewNormal::maybeRestrictMinimumSize()
    325346{
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/normal/UIMachineViewNormal.h

    r27236 r27237  
    7777    void normalizeGeometry(bool fAdjustPosition);
    7878    QRect availableGeometry();
     79    void calculateDesktopGeometry();
    7980    void maybeRestrictMinimumSize();
    8081    void updateSliders();
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp

    r27236 r27237  
    274274}
    275275
     276void UIMachineViewSeamless::calculateDesktopGeometry()
     277{
     278    /* This method should not get called until we have initially set up the desktop geometry type: */
     279    Assert((desktopGeometryType() != DesktopGeo_Invalid));
     280    /* If we are not doing automatic geometry calculation then there is nothing to do: */
     281    if (desktopGeometryType() == DesktopGeo_Automatic)
     282    {
     283        m_desktopGeometry = QSize(availableGeometry().width(), availableGeometry().height());
     284    }
     285}
     286
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.h

    r27236 r27237  
    7676    void normalizeGeometry(bool /* fAdjustPosition */) {}
    7777    QRect availableGeometry();
     78    void calculateDesktopGeometry();
    7879    void maybeRestrictMinimumSize() {}
    7980    void updateSliders() {}
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