VirtualBox

Ignore:
Timestamp:
Dec 9, 2022 12:23:08 PM (2 years ago)
Author:
vboxsync
Message:

FE/Qt: Fixing Runtime UI bug with invisible borders for captured mouse cursor on X11 and macOS hosts.

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

Legend:

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

    r97754 r97771  
    463463    /* Return region: */
    464464    return region;
    465 }
    466 
    467 /* static */
    468 int UIDesktopWidgetWatchdog::overallDesktopWidth()
    469 {
    470     return overallScreenRegion().boundingRect().width();
    471 }
    472 
    473 /* static */
    474 int UIDesktopWidgetWatchdog::overallDesktopHeight()
    475 {
    476     return overallScreenRegion().boundingRect().height();
    477465}
    478466
  • trunk/src/VBox/Frontends/VirtualBox/src/globals/UIDesktopWidgetWatchdog.h

    r97715 r97771  
    117117    /** Returns overall region unifying all the host-screen available-geometries. */
    118118    static QRegion overallAvailableRegion();
    119     /** Returns overall desktop width. */
    120     static int overallDesktopWidth();
    121     /** Returns overall desktop height. */
    122     static int overallDesktopHeight();
    123119
    124120#ifdef VBOX_WS_X11
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.cpp

    r97706 r97771  
    174174        /* Memorize the host position where the cursor was captured: */
    175175        m_capturedMousePos = QCursor::pos();
     176        /* Determine geometry of screen cursor was captured at: */
     177        m_capturedScreenGeo = gpDesktop->screenGeometry(m_capturedMousePos);
    176178
    177179        /* Acquiring visible viewport rectangle in global coodrinates: */
     
    10341036            m_fCursorPositionReseted = false;
    10351037        }
    1036 #else /* VBOX_WS_WIN */
    1037         int iWe = UIDesktopWidgetWatchdog::overallDesktopWidth() - 1;
    1038         int iHe = UIDesktopWidgetWatchdog::overallDesktopHeight() - 1;
     1038#else /* !VBOX_WS_WIN */
     1039        /* Compose boundaries: */
     1040        const int iX1 = m_capturedScreenGeo.left() + 1;
     1041        const int iY1 = m_capturedScreenGeo.top() + 1;
     1042        const int iX2 = m_capturedScreenGeo.right() - 1;
     1043        const int iY2 = m_capturedScreenGeo.bottom() - 1;
     1044
     1045        /* Simulate infinite movement: */
    10391046        QPoint p = globalPos;
    1040         if (globalPos.x() == 0)
    1041             p.setX(iWe - 1);
    1042         else if (globalPos.x() == iWe)
    1043             p.setX( 1 );
    1044         if (globalPos.y() == 0)
    1045             p.setY(iHe - 1);
    1046         else if (globalPos.y() == iHe)
    1047             p.setY(1);
     1047        if (globalPos.x() <= iX1)
     1048            p.setX(iX2 - 1);
     1049        else if (globalPos.x() >= iX2)
     1050            p.setX(iX1 + 1);
     1051        if (globalPos.y() <= iY1)
     1052            p.setY(iY2 - 1);
     1053        else if (globalPos.y() >= iY2)
     1054            p.setY(iY1 + 1);
    10481055
    10491056        if (p != globalPos)
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.h

    r96407 r97771  
    150150    QPoint m_lastMousePos;
    151151    QPoint m_capturedMousePos;
     152    QRect m_capturedScreenGeo;
    152153    int m_iLastMouseWheelDelta;
    153154    int m_iMouseCaptureViewIndex;
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