Skip to content

Commit

Permalink
Fixed bug 3464 - Fix for Android hint SDL_HINT_ANDROID_SEPARATE_MOUSE…
Browse files Browse the repository at this point in the history
…_AND_TOUCH

ny00

According to the current documentation in SDL_hints.h, if SDL_HINT_ANDROID_SEPARATE_MOUSE_AND_TOUCH is set to "0" (or not set at all) then mouse input should lead to touch events, along with corresponding *fake* mouse events with mouse id SDL_TOUCH_MOUSEID.

However, while moving a mouse around (actually using a trackpad identified as a mouse), I get SDL mouse motion events with differing mouse ids, as follows:
- If the mouse is moved while a mouse button is pressed, the mouse id is SDL_TOUCH_MOUSEID.
- Otherwise, the mouse id for mouse motion events is 0.

I've attached sample code for reference, which includes logs of the various mouse events (the "which" field is covered).

I believe that no actual mouse event should arrive, if the hint is unset. In particular, no mouse motion event should arrive while no mouse button is pressed.

I'm going to attach a patch which resolves this, while also disabling mouse wheel motion events.
  • Loading branch information
slouken committed Aug 11, 2017
1 parent b3589ed commit df5898b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions android-project/src/org/libsdl/app/SDLActivity.java
Expand Up @@ -1748,6 +1748,9 @@ public boolean onGenericMotion(View v, MotionEvent event) {
return SDLActivity.handleJoystickMotionEvent(event);

case InputDevice.SOURCE_MOUSE:
if (!SDLActivity.mSeparateMouseAndTouch) {
break;
}
action = event.getActionMasked();
switch (action) {
case MotionEvent.ACTION_SCROLL:
Expand Down

0 comments on commit df5898b

Please sign in to comment.