summaryrefslogtreecommitdiffstats
path: root/src/android/jar
diff options
context:
space:
mode:
authorBartlomiej Moskal <bartlomiej.moskal@qt.io>2021-03-26 12:03:27 +0100
committerBartlomiej Moskal <bartlomiej.moskal@qt.io>2021-03-30 12:01:02 +0000
commit06b0b2be160e6122d1a80e7c37916512429cd145 (patch)
tree3bda0d730ee88fffe93dd6e080c3bc0b9aad0005 /src/android/jar
parent32fd331bcecfb3c7148864630268a29bfd178283 (diff)
Android: Fix Touch event position depending on Surface
Touch event position is counted from begin of Surface. Later method QAndroidPlatformScreen::topLevelAt(..) is trying to return the top level window at the touch event position. In case when Surface is moved, we should also add this move to event position. If it is not happening, touch event will not be assigned to correct window. Fixes: QTBUG-65927 Pick-to: 5.15 Change-Id: I549b9ec964cb09607153c60b9d9f6e0068a04cc2 Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
Diffstat (limited to 'src/android/jar')
-rw-r--r--src/android/jar/src/org/qtproject/qt/android/QtSurface.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/android/jar/src/org/qtproject/qt/android/QtSurface.java b/src/android/jar/src/org/qtproject/qt/android/QtSurface.java
index 1d89aeebef..bd52f34abd 100644
--- a/src/android/jar/src/org/qtproject/qt/android/QtSurface.java
+++ b/src/android/jar/src/org/qtproject/qt/android/QtSurface.java
@@ -101,6 +101,11 @@ public class QtSurface extends SurfaceView implements SurfaceHolder.Callback
@Override
public boolean onTouchEvent(MotionEvent event)
{
+ // QTBUG-65927
+ // Fix event positions depending on Surface position.
+ // In case when Surface is moved, we should also add this move to event position
+ event.setLocation(event.getX() + getX(), event.getY() + getY());
+
QtNative.sendTouchEvent(event, getId());
m_gestureDetector.onTouchEvent(event);
return true;