mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-01-05 14:35:31 +00:00
Accept key events from any source
This allows TV remotes to navigate SDL applications (with source HDMI) Fixes https://github.com/libsdl-org/SDL/issues/8137
This commit is contained in:
parent
8e27a69370
commit
862a654b70
|
@ -1345,7 +1345,20 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((source & InputDevice.SOURCE_KEYBOARD) == InputDevice.SOURCE_KEYBOARD) {
|
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)) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
if (event.getAction() == KeyEvent.ACTION_DOWN) {
|
||||||
if (isTextInputEvent(event)) {
|
if (isTextInputEvent(event)) {
|
||||||
if (ic != null) {
|
if (ic != null) {
|
||||||
|
@ -1360,21 +1373,6 @@ public class SDLActivity extends Activity implements View.OnSystemUiVisibilityCh
|
||||||
onNativeKeyUp(keyCode);
|
onNativeKeyUp(keyCode);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
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)) {
|
|
||||||
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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue