VirtualBox

Changeset 52794 in vbox


Ignore:
Timestamp:
Sep 19, 2014 2:33:37 PM (11 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
96186
Message:

FE/Qt: X11: Runtime UI: Seamless mode: Calcualte available-regions using Qt again.

Location:
trunk/src/VBox/Frontends/VirtualBox/src
Files:
5 edited

Legend:

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

    r52733 r52794  
    613613}
    614614#endif /* ifdef Q_WS_X11 */
    615 
    616 const QRect VBoxGlobal::availableGeometry(int iScreen) const
    617 {
    618     /* Prepare empty result: */
    619     QRect result;
    620 
    621 #ifdef Q_WS_X11
    622 
    623     /* Get current display: */
    624     Display* pDisplay = QX11Info::display();
    625 
    626     /* Get current application desktop: */
    627     QDesktopWidget *pDesktopWidget = QApplication::desktop();
    628 
    629     /* If it's a virtual desktop: */
    630     if (pDesktopWidget->isVirtualDesktop())
    631     {
    632         /* If it's a Xinerama desktop: */
    633         if (XineramaIsActive(pDisplay))
    634         {
    635             /* Get desktops list: */
    636             QList<QRect> desktops = XGetDesktopList();
    637 
    638             /* Combine to get full virtual region: */
    639             QRegion virtualRegion;
    640             foreach (QRect desktop, desktops)
    641                 virtualRegion += desktop;
    642             virtualRegion = virtualRegion.boundingRect();
    643 
    644             /* Remember initial virtual desktop: */
    645             QRect virtualDesktop = virtualRegion.boundingRect();
    646             //AssertMsgFailed(("LOG... Virtual desktop is: %dx%dx%dx%d\n", virtualDesktop.x(), virtualDesktop.y(),
    647             //                                                             virtualDesktop.width(), virtualDesktop.height()));
    648 
    649             /* Set available geometry to screen geometry initially: */
    650             result = desktops[iScreen];
    651 
    652             /* Feat available geometry of virtual desktop to respect all the struts: */
    653             QList<Window> list = XGetWindowIDList();
    654             for (int i = 0; i < list.size(); ++ i)
    655             {
    656                 /* Get window: */
    657                 Window wid = list[i];
    658                 QList<ulong> struts = XGetStrut(wid);
    659 
    660                 /* If window has strut: */
    661                 if (struts.size())
    662                 {
    663                     ulong uLeftShift = struts[0];
    664                     ulong uLeftFromY = struts[4];
    665                     ulong uLeftToY = struts[5];
    666 
    667                     ulong uRightShift = struts[1];
    668                     ulong uRightFromY = struts[6];
    669                     ulong uRightToY = struts[7];
    670 
    671                     ulong uTopShift = struts[2];
    672                     ulong uTopFromX = struts[8];
    673                     ulong uTopToX = struts[9];
    674 
    675                     ulong uBottomShift = struts[3];
    676                     ulong uBottomFromX = struts[10];
    677                     ulong uBottomToX = struts[11];
    678 
    679                     if (uLeftShift)
    680                     {
    681                         QRect sr(QPoint(0, uLeftFromY),
    682                                  QSize(uLeftShift, uLeftToY - uLeftFromY + 1));
    683 
    684                         //AssertMsgFailed(("LOG... Subtract left strut: top-left: %dx%d, size: %dx%d\n", sr.x(), sr.y(), sr.width(), sr.height()));
    685                         virtualRegion -= sr;
    686                     }
    687 
    688                     if (uRightShift)
    689                     {
    690                         QRect sr(QPoint(virtualDesktop.x() + virtualDesktop.width() - uRightShift, uRightFromY),
    691                                  QSize(virtualDesktop.x() + virtualDesktop.width(), uRightToY - uRightFromY + 1));
    692 
    693                         //AssertMsgFailed(("LOG... Subtract right strut: top-left: %dx%d, size: %dx%d\n", sr.x(), sr.y(), sr.width(), sr.height()));
    694                         virtualRegion -= sr;
    695                     }
    696 
    697                     if (uTopShift)
    698                     {
    699                         QRect sr(QPoint(uTopFromX, 0),
    700                                  QSize(uTopToX - uTopFromX + 1, uTopShift));
    701 
    702                         //AssertMsgFailed(("LOG... Subtract top strut: top-left: %dx%d, size: %dx%d\n", sr.x(), sr.y(), sr.width(), sr.height()));
    703                         virtualRegion -= sr;
    704                     }
    705 
    706                     if (uBottomShift)
    707                     {
    708                         QRect sr(QPoint(uBottomFromX, virtualDesktop.y() + virtualDesktop.height() - uBottomShift),
    709                                  QSize(uBottomToX - uBottomFromX + 1, uBottomShift));
    710 
    711                         //AssertMsgFailed(("LOG... Subtract bottom strut: top-left: %dx%d, size: %dx%d\n", sr.x(), sr.y(), sr.width(), sr.height()));
    712                         virtualRegion -= sr;
    713                     }
    714                 }
    715             }
    716 
    717             /* Get final available geometry: */
    718             result = (virtualRegion & result).boundingRect();
    719         }
    720     }
    721 
    722     /* If result is still NULL: */
    723     if (result.isNull())
    724     {
    725         /* Use QT default functionality: */
    726         result = pDesktopWidget->availableGeometry(iScreen);
    727     }
    728 
    729     //AssertMsgFailed(("LOG... Final geometry: %dx%dx%dx%d\n", result.x(), result.y(), result.width(), result.height()));
    730 
    731 #else /* ifdef Q_WS_X11 */
    732 
    733     result = QApplication::desktop()->availableGeometry(iScreen);
    734 
    735 #endif /* ifndef Q_WS_X11 */
    736 
    737     return result;
    738 }
    739615
    740616/**
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/VBoxGlobal.h

    r52320 r52794  
    127127
    128128    bool isKWinManaged() const { return mIsKWinManaged; }
    129 
    130     const QRect availableGeometry(int iScreen = 0) const;
    131129
    132130    bool shouldRestoreCurrentSnapshot() const { return mRestoreCurrentSnapshot; }
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineViewSeamless.cpp

    r52730 r52794  
    179179    int iScreen = static_cast<UIMachineLogicSeamless*>(machineLogic())->hostScreenForGuestScreen(screenId());
    180180    /* Return available geometry for that screen: */
    181     return vboxGlobal().availableGeometry(iScreen);
     181    return QApplication::desktop()->availableGeometry(iScreen);
    182182}
    183183
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/seamless/UIMachineWindowSeamless.cpp

    r52730 r52794  
    165165    int iScreen = qobject_cast<UIMachineLogicSeamless*>(machineLogic())->hostScreenForGuestScreen(m_uScreenId);
    166166    /* Calculate working area: */
    167     QRect workingArea = vboxGlobal().availableGeometry(iScreen);
     167    QRect workingArea = QApplication::desktop()->availableGeometry(iScreen);
    168168
    169169    /* Move to the appropriate position: */
  • trunk/src/VBox/Frontends/VirtualBox/src/widgets/UIMiniToolBar.cpp

    r52783 r52794  
    147147    switch (m_geometryType)
    148148    {
    149         case GeometryType_Available: screenRect = vboxGlobal().availableGeometry(iHostScreen); break;
     149        case GeometryType_Available: screenRect = QApplication::desktop()->availableGeometry(iHostScreen); break;
    150150        case GeometryType_Full:      screenRect = QApplication::desktop()->screenGeometry(iHostScreen); break;
    151151        default: break;
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