summaryrefslogtreecommitdiffstats
path: root/src/gui
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-08-18 03:26:31 -0300
commit44112d36c86149f41446bec72c38f82981ff6be6 (patch)
treec9b8e29e6f513fb06c4b9c144e283e168383560c /src/gui
parentf77bdd8d85e77aa1e3a87d6b04375d05f0bbad28 (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 Change-Id: Ie3e2ae8cbf9870d465dfd2c8808942dd6fc647d2 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io> (cherry picked from commit b50daef9771d8829fc7f808898cbe051a5464b79) Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Oliver Wolff <oliver.wolff@qt.io>
Diffstat (limited to 'src/gui')
-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 8c699ea4b3..42403f5dd5 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -2095,6 +2095,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)) {