summaryrefslogtreecommitdiffstats
path: root/src/android/jar/src
diff options
context:
space:
mode:
authorBartlomiej Moskal <bartlomiej.moskal@qt.io>2021-03-18 07:54:20 +0100
committerBartlomiej Moskal <bartlomiej.moskal@qt.io>2021-05-21 16:19:30 +0000
commit9e4f23b2aae814d69db82621484da5d28229fb7f (patch)
tree1fe9560801d54ae552e7bdf04da3ea2be64a7c14 /src/android/jar/src
parent05408a4e5fd1c411371983d75e361f23597cf4c7 (diff)
Android: fix wrong position of cursor hander in split screen
Use activity window position to fix position of cursor hander. In case without splti sceen, position of activity window is equal (0, 0), so it does not have any effect. Fixes: QTBUG-91362 Change-Id: Icae9f19308112a78bdddf168abe81ffe7b6e4fae Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io> (cherry picked from commit 547228bf86281733c09a0638c57a4384c664f66e)
Diffstat (limited to 'src/android/jar/src')
-rw-r--r--src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java b/src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java
index 38cc695c37..feb47c8f90 100644
--- a/src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java
+++ b/src/android/jar/src/org/qtproject/qt5/android/CursorHandle.java
@@ -159,11 +159,15 @@ public class CursorHandle implements ViewTreeObserver.OnPreDrawListener
public void setPosition(final int x, final int y){
initOverlay();
- final int[] location = new int[2];
- m_layout.getLocationOnScreen(location);
+ final int[] layoutLocation = new int[2];
+ m_layout.getLocationOnScreen(layoutLocation);
+
+ // This value is used for handling split screen case
+ final int[] activityLocation = new int[2];
+ m_activity.getWindow().getDecorView().getLocationOnScreen(activityLocation);
- int x2 = x + location[0];
- int y2 = y + location[1] + m_yShift;
+ int x2 = x + layoutLocation[0] - activityLocation[0];
+ int y2 = y + layoutLocation[1] + m_yShift - activityLocation[1];
if (m_id == QtNative.IdCursorHandle) {
x2 -= m_popup.getWidth() / 2 ;