Skip to content

Commit

Permalink
Fixed Joystick and Gamepad Detection
Browse files Browse the repository at this point in the history
  • Loading branch information
skylersaleh committed Aug 16, 2023
1 parent fdde814 commit 71ad500
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions sokol_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 71ad500

Please sign in to comment.