From aeeac48cbdea744406f0c8abefe271f571b61d07 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Tue, 12 Jan 2021 20:17:15 +0100 Subject: AA_SynthesizeTouchForUnhandledMouseEvents: keep correct coordinates QGuiApplicationPrivate::processMouseEvent() sends a QWindowSystemInterfacePrivate::TouchEvent if the mouse event is not accepted and AA_SynthesizeTouchForUnhandledMouseEvents is enabled. A QPA TouchEvent always contains native touch points, which is why it calls QWindowSystemInterfacePrivate::fromNativeTouchPoints to translate the QMouseEvent's device-independent position back to the raw position that it would have had if it came from a real touchscreen. Therefore we must give that function touchpoints that are actually in native coordinates. It may be that some of this transformation could be avoided entirely, but here we prove that the existing way works correctly, by adding coordinate checking to the tst_QWindow::mouseToTouchTranslation() test. Pick-to: 6.0 Task-number: QTBUG-86165 Change-Id: I4c9ca2b11e9eb76d79712c187db3eb9865da581a Reviewed-by: Volker Hilsheimer --- src/gui/kernel/qguiapplication.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gui/kernel/qguiapplication.cpp') diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index d3ed576220..d607e75ecc 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -2269,7 +2269,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo QList points; QWindowSystemInterface::TouchPoint point; point.id = 1; - point.area = QRectF(globalPoint.x() - 2, globalPoint.y() - 2, 4, 4); + point.area = QHighDpi::toNativePixels(QRectF(globalPoint.x() - 2, globalPoint.y() - 2, 4, 4), window); // only translate left button related events to // avoid strange touch event sequences when several -- cgit v1.2.3