VirtualBox

Changeset 75935 in vbox


Ignore:
Timestamp:
Dec 4, 2018 7:27:44 AM (6 years ago)
Author:
vboxsync
Message:

FE/Qt: bugref:9309: Windows host: Fixing endless movement technique for HiDPI case.

File:
1 edited

Legend:

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

    r75900 r75935  
    976976        if (p != relativePos)
    977977        {
    978             m_lastMousePos = m_viewports[uScreenId]->mapToGlobal(p);
    979             QCursor::setPos(m_lastMousePos);
     978            // WORKAROUND:
     979            // Underlying QCursor::setPos call requires coordinates, rescaled according to primary screen.
     980            // For that we have to map logical coordinates to relative origin (to make logical=>physical conversion).
     981            // Besides that we have to make sure m_lastMousePos still uses logical coordinates afterwards.
     982            const double dDprPrimary = gpDesktop->devicePixelRatio(gpDesktop->primaryScreen());
     983            const double dDprCurrent = gpDesktop->devicePixelRatio(m_windows.value(m_iMouseCaptureViewIndex));
     984            const QRect screenGeometry = gpDesktop->screenGeometry(m_windows.value(m_iMouseCaptureViewIndex));
     985            QPoint requiredMousePos = (m_viewports[uScreenId]->mapToGlobal(p) - screenGeometry.topLeft()) * dDprCurrent + screenGeometry.topLeft();
     986            QCursor::setPos(requiredMousePos / dDprPrimary);
     987            m_lastMousePos = requiredMousePos / dDprCurrent;
    980988        }
    981989        else
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