From 06b0b2be160e6122d1a80e7c37916512429cd145 Mon Sep 17 00:00:00 2001 From: Bartlomiej Moskal Date: Fri, 26 Mar 2021 12:03:27 +0100 Subject: 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 Reviewed-by: Ville Voutilainen --- src/android/jar/src/org/qtproject/qt/android/QtSurface.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/android') 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; -- cgit v1.2.3