Skip to content

Commit

Permalink
Android: Fixed finishing Activity on some devices if right mouse butt…
Browse files Browse the repository at this point in the history
…on pressed.

Partially fixes Bugzilla #3227.
  • Loading branch information
philippwiesemann committed Jan 13, 2016
1 parent 28817c9 commit 2191abb
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions android-project/src/org/libsdl/app/SDLActivity.java
Expand Up @@ -1196,6 +1196,20 @@ else if (event.getAction() == KeyEvent.ACTION_UP) {
}
}

if ((event.getSource() & InputDevice.SOURCE_MOUSE) != 0) {
// on some devices key events are sent for mouse BUTTON_BACK/FORWARD presses
// they are ignored here because sending them as mouse input to SDL is messy
if ((keyCode == KeyEvent.KEYCODE_BACK) || (keyCode == KeyEvent.KEYCODE_FORWARD)) {
switch (event.getAction()) {
case KeyEvent.ACTION_DOWN:
case KeyEvent.ACTION_UP:
// mark the event as handled or it will be handled by system
// handling KEYCODE_BACK by system will call onBackPressed()
return true;
}
}
}

return false;
}

Expand Down

0 comments on commit 2191abb

Please sign in to comment.