Windows QPA: Fix local position reported for enter events

Use QPlatformWindow::mapFromGlobal() instead of QWindow:::mapFromGlobal()
as QPA operates in device pixels.

Task-number: QTBUG-62028
Change-Id: I64ec4f4c9a536e122676d738db58805b98a45c82
Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
This commit is contained in:
Friedemann Kleint 2017-07-19 11:02:05 +02:00
parent e7471da4d6
commit 13bceecc6b

View File

@ -387,12 +387,13 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd,
&& (!hasCapture || currentWindowUnderMouse == window))
|| (m_previousCaptureWindow && window != m_previousCaptureWindow && currentWindowUnderMouse
&& currentWindowUnderMouse != m_previousCaptureWindow)) {
QPoint localPosition;
qCDebug(lcQpaEvents) << "Entering " << currentWindowUnderMouse;
if (QWindowsWindow *wumPlatformWindow = QWindowsWindow::windowsWindowOf(currentWindowUnderMouse))
if (QWindowsWindow *wumPlatformWindow = QWindowsWindow::windowsWindowOf(currentWindowUnderMouse)) {
localPosition = wumPlatformWindow->mapFromGlobal(globalPosition);
wumPlatformWindow->applyCursor();
QWindowSystemInterface::handleEnterEvent(currentWindowUnderMouse,
currentWindowUnderMouse->mapFromGlobal(globalPosition),
globalPosition);
}
QWindowSystemInterface::handleEnterEvent(currentWindowUnderMouse, localPosition, globalPosition);
}
// We need to track m_windowUnderMouse separately from m_trackedWindow, as
// Windows mouse tracking will not trigger WM_MOUSELEAVE for leaving window when