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>
This commit is contained in:
parent
32fd331bce
commit
06b0b2be16
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user