summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre de la Rocha <andre.rocha@qt.io>2020-07-18 01:52:49 -0300
committerAndre de la Rocha <andre.rocha@qt.io>2020-07-21 15:53:08 -0300
commitb50daef9771d8829fc7f808898cbe051a5464b79 (patch)
treeeaaaa3174a4438771c9424a32ef0603cc19c2d5b
parente4e4bb78b769c80bba6391636442e74aa9ed7772 (diff)
Discard extra mouse move event generated by touchpad
On Windows, and possibly other platforms, a touchpad can send a mouse button press followed by an unexpected mouse move event to the same coordinates, before sending a mouse button release, which may confuse applications. Before the enhanced mouse event processing was added, the code in QGuiApplication was responsible for deducing the mouse event type and other info, and in the process performed a checking that discarded events that did not change state. The enhanced mouse processing code lacked this checking. This change adds an equivalent checking to the enhanced mouse event processing. Fixes: QTBUG-85431 Pick-to: 5.15 Change-Id: Ie3e2ae8cbf9870d465dfd2c8808942dd6fc647d2 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
-rw-r--r--src/gui/kernel/qguiapplication.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index a1d5a6e737..2df5933879 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -2110,6 +2110,13 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
processMouseEvent(e); // the original mouse event
return;
}
+ if (mouseMove && !positionChanged) {
+ // On Windows, and possibly other platforms, a touchpad can send a mouse move
+ // that does not change position, between a press and a release. This may
+ // confuse applications, so we always filter out these mouse events for
+ // consistent behavior among platforms.
+ return;
+ }
} else {
Qt::MouseButtons stateChange = e->buttons ^ mouse_buttons;
if (positionChanged && (stateChange != Qt::NoButton)) {