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 <kde@privat.broulik.de>
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
bb10
J-P Nurmi 2017-10-30 10:53:03 +01:00
parent 67391f0a57
commit 41667f7f14
2 changed files with 4 additions and 4 deletions

View File

@ -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() {

View File

@ -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());
}
}