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 Pick-to: 5.15 Change-Id: Icae9f19308112a78bdddf168abe81ffe7b6e4fae Reviewed-by: Rami Potinkara <rami.potinkara@qt.io> Reviewed-by: Ville Voutilainen <ville.voutilainen@qt.io>
This commit is contained in:
parent
e402e1103b
commit
547228bf86
@ -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);
|
||||
|
||||
int x2 = x + location[0];
|
||||
int y2 = y + location[1] + m_yShift;
|
||||
// This value is used for handling split screen case
|
||||
final int[] activityLocation = new int[2];
|
||||
m_activity.getWindow().getDecorView().getLocationOnScreen(activityLocation);
|
||||
|
||||
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 ;
|
||||
|
Loading…
Reference in New Issue
Block a user