diff options
author | Juha Vuolle <juha.vuolle@qt.io> | 2023-09-18 15:11:25 +0300 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2023-10-13 05:06:50 +0000 |
commit | bd188231a856634da85a597b7292e1a6f54a1a7c (patch) | |
tree | a2a60f13a5992eeefe9302dbbf0035a20b59c5d6 | |
parent | f476a68ee9678f4f2db6585868937d42d7fbfbd6 (diff) |
Handle ACTION_POINTER_UP with tablet events
The ACTION_POINTER_UP is used when a non-primary pointer (touch, mouse
stylus, eraser) goes up. Without handling this action in these
cases, the table event remains in 'down' state (misses the
QEvent::TabletRelease) and as a consequence when it is next put on the
screen, eg. a line will be drawn to the new position (in case of a drawing
application).
In addition use getActionMasked() to get the action; non-masked
events would contain the index of the pointer too, and wouldn't
match with ACTION_POINTER_UP whose numeric value is 6. Rather the
actions would be in the lines of:
261, // ACTION_POINTER_DOWN(1), 6 with getActionMasked()
517, // ACTION_POINTER_DOWN(2), 6 with getActionMasked()
And so on.
Fixes: QTBUG-86297
Change-Id: I1b50ca4d19b611aec8a5c280ed0521e2f11797b0
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit 3ee57b83870567d52acc00e534ef022a6d3b150e)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
(cherry picked from commit c17a1432cf63b225c05ce2779fbecb83111870bc)
-rw-r--r-- | src/android/jar/src/org/qtproject/qt/android/QtNative.java | 2 | ||||
-rw-r--r-- | src/plugins/platforms/android/androidjniinput.cpp | 1 |
2 files changed, 2 insertions, 1 deletions
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtNative.java b/src/android/jar/src/org/qtproject/qt/android/QtNative.java index 161a489a56..260e6d414e 100644 --- a/src/android/jar/src/org/qtproject/qt/android/QtNative.java +++ b/src/android/jar/src/org/qtproject/qt/android/QtNative.java @@ -581,7 +581,7 @@ public class QtNative if (event.getToolType(0) == MotionEvent.TOOL_TYPE_MOUSE) { sendMouseEvent(event, id); } else if (m_tabletEventSupported && pointerType != 0) { - tabletEvent(id, event.getDeviceId(), event.getEventTime(), event.getAction(), pointerType, + tabletEvent(id, event.getDeviceId(), event.getEventTime(), event.getActionMasked(), pointerType, event.getButtonState(), event.getX(), event.getY(), event.getPressure()); } else { touchBegin(id); diff --git a/src/plugins/platforms/android/androidjniinput.cpp b/src/plugins/platforms/android/androidjniinput.cpp index dbe59050b1..89ecddeeb9 100644 --- a/src/plugins/platforms/android/androidjniinput.cpp +++ b/src/plugins/platforms/android/androidjniinput.cpp @@ -314,6 +314,7 @@ namespace QtAndroidInput Qt::MouseButtons buttons = Qt::NoButton; switch (action) { case 1: // ACTION_UP + case 6: // ACTION_POINTER_UP, happens if stylus is not the primary pointer case 212: // stylus release while side-button held on Galaxy Note 4 buttons = Qt::NoButton; break; |