Android: test for SOURCE_KEYBOARD / SOURCE_MOUSE. Don't compare to 0, since there are several bits (see #5322, #2718)

This commit is contained in:
Sylvain 2022-02-08 17:41:17 +01:00
parent 7935cfacc5
commit 1fc5dba3d5
No known key found for this signature in database
GPG key ID: 5F87E02E5BC0939E

View file

@ -1905,7 +1905,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
}
}
if ((source & InputDevice.SOURCE_KEYBOARD) != 0) {
if ((source & InputDevice.SOURCE_KEYBOARD) == InputDevice.SOURCE_KEYBOARD) {
if (event.getAction() == KeyEvent.ACTION_DOWN) {
if (SDLActivity.isTextInputEvent(event)) {
SDLInputConnection.nativeCommitText(String.valueOf((char) event.getUnicodeChar()), 1);
@ -1918,7 +1918,7 @@ class SDLSurface extends SurfaceView implements SurfaceHolder.Callback,
}
}
if ((source & InputDevice.SOURCE_MOUSE) != 0) {
if ((source & InputDevice.SOURCE_MOUSE) == InputDevice.SOURCE_MOUSE) {
// 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)) {