From 71ad500aae76ae0604b7d21cceb1cfef5b492271 Mon Sep 17 00:00:00 2001 From: Sky Date: Wed, 16 Aug 2023 01:55:06 -0700 Subject: [PATCH] Fixed Joystick and Gamepad Detection --- sokol_app.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sokol_app.h b/sokol_app.h index 83e5d76b0..7fce0fdf0 100644 --- a/sokol_app.h +++ b/sokol_app.h @@ -8280,7 +8280,8 @@ _SOKOL_PRIVATE bool _sapp_android_key_event(const AInputEvent* e) { return false; } // Don't relay key press events from joysticks or game pads as Sokol key down events - if((AInputEvent_getSource(e) & AINPUT_SOURCE_GAMEPAD) || (AInputEvent_getSource(e) & AINPUT_SOURCE_JOYSTICK)) { + if ((AInputEvent_getSource(e) & AINPUT_SOURCE_GAMEPAD) == AINPUT_SOURCE_GAMEPAD || + (AInputEvent_getSource(e) & AINPUT_SOURCE_JOYSTICK) == AINPUT_SOURCE_JOYSTICK) { return false; } sapp_event_type type = SAPP_EVENTTYPE_INVALID; @@ -8315,7 +8316,7 @@ _SOKOL_PRIVATE bool _sapp_android_key_event(const AInputEvent* e) { _sapp_init_event(SAPP_EVENTTYPE_CLIPBOARD_PASTED); _sapp_call_event(&_sapp.event); } - return false; + return _sapp.event.key_code != SAPP_KEYCODE_INVALID; } _SOKOL_PRIVATE int _sapp_android_input_cb(int fd, int events, void* data) {