From 41667f7f14bb6f40d14d240c9f74d87de8435398 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Mon, 30 Oct 2017 10:53:03 +0100 Subject: Android: fix scrolling using a touch keyboard on Blackberry This is a follow-up commit to 97eec16e. Blackberry tries sending touchpad events first, and if not consumed, it sends synthetic mouse wheel events as a fallback. This makes touch keyboard scrolling work in native Android ListViews and other views that do not handle SOURCE_TOUCHPAD motion events. Qt apps, however, blindly accepted all generic motion events, so synthesized mouse wheel events were never sent. => Make QtSurface & QtNative accept only those motions events that are actually handled. Task-number: QTBUG-51165 Change-Id: Iefbbf1e3e1cc3da86afc4c87c19671cc6c5fa145 Reviewed-by: Kai Uwe Broulik Reviewed-by: BogDan Vatra --- src/android/jar/src/org/qtproject/qt5/android/QtNative.java | 5 +++-- src/android/jar/src/org/qtproject/qt5/android/QtSurface.java | 3 +-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java index 902e2f68e7..ab6d556768 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtNative.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtNative.java @@ -471,15 +471,16 @@ public class QtNative } } - static public void sendGenericMotionEvent(MotionEvent event, int id) + static public boolean sendGenericMotionEvent(MotionEvent event, int id) { if (event.getActionMasked() != MotionEvent.ACTION_SCROLL || (event.getSource() & InputDevice.SOURCE_CLASS_POINTER) != InputDevice.SOURCE_CLASS_POINTER) { - return; + return false; } mouseWheel(id, (int) event.getX(), (int) event.getY(), event.getAxisValue(MotionEvent.AXIS_HSCROLL), event.getAxisValue(MotionEvent.AXIS_VSCROLL)); + return true; } public static Context getContext() { diff --git a/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java b/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java index e994002dd3..08b5a80f7e 100644 --- a/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java +++ b/src/android/jar/src/org/qtproject/qt5/android/QtSurface.java @@ -116,7 +116,6 @@ public class QtSurface extends SurfaceView implements SurfaceHolder.Callback @Override public boolean onGenericMotionEvent(MotionEvent event) { - QtNative.sendGenericMotionEvent(event, getId()); - return true; + return QtNative.sendGenericMotionEvent(event, getId()); } } -- cgit v1.2.3