VirtualBox

Changeset 75938 in vbox


Ignore:
Timestamp:
Dec 4, 2018 8:42:19 AM (6 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
127147
Message:

FE/Qt: bugref:9309: Windows host: Filter out rare duplicated mouse events on the border of endless movement triggers.

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

Legend:

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

    r75936 r75938  
    527527    , m_iLastMouseWheelDelta(0)
    528528    , m_iMouseCaptureViewIndex(-1)
     529#ifdef VBOX_WS_WIN
     530    , m_fCursorPositionReseted(false)
     531#endif
    529532{
    530533    /* Machine state-change updater: */
     
    948951        ::UpdateWindow((HWND)m_viewports[uScreenId]->winId());
    949952#endif
     953
     954#ifdef VBOX_WS_WIN
     955        // WORKAROUND:
     956        // There are situations at least on Windows host that we are receiving
     957        // previously posted (but not yet handled) mouse event right after we
     958        // have manually teleported mouse cursor to simulate infinite movement,
     959        // this makes cursor blink for a large amount of space, so we should
     960        // ignore such blinks .. well, at least once.
     961        const QPoint shiftingSpace = globalPos - m_lastMousePos;
     962        if (m_fCursorPositionReseted && shiftingSpace.manhattanLength() >= 10)
     963        {
     964            m_fCursorPositionReseted = false;
     965            return true;
     966        }
     967#endif
     968
     969        /* Pass event to the guest: */
    950970        mouse().PutMouseEvent(globalPos.x() - m_lastMousePos.x(),
    951971                              globalPos.y() - m_lastMousePos.y(),
     
    9861006            QCursor::setPos(requiredMousePos / dDprPrimary);
    9871007            m_lastMousePos = requiredMousePos / dDprCurrent;
     1008            m_fCursorPositionReseted = true;
    9881009        }
    9891010        else
     1011        {
    9901012            m_lastMousePos = globalPos;
     1013            m_fCursorPositionReseted = false;
     1014        }
    9911015#else /* VBOX_WS_WIN */
    9921016        int iWe = gpDesktop->overallDesktopWidth() - 1;
  • trunk/src/VBox/Frontends/VirtualBox/src/runtime/UIMouseHandler.h

    r69500 r75938  
    139139    int m_iLastMouseWheelDelta;
    140140    int m_iMouseCaptureViewIndex;
     141
     142#ifdef VBOX_WS_WIN
     143    /** Holds whether cursor position was just
     144      * reseted to simulate infinite mouse moving. */
     145    bool m_fCursorPositionReseted;
     146#endif
    141147};
    142148
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