aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Rodrigues Lordello <[email protected]>2026-06-23 23:08:38 +0200
committerNicholas Rodrigues Lordello <[email protected]>2026-06-23 23:08:38 +0200
commit1eac4cb95f7a7962238df1206174da891272dc17 (patch)
treedcc9b3dd71abee5da6af37c84a950d2dd33c4fb7
parentc6998a85bd3ef983f3a29ff6067dacf815caf67a (diff)
Improve Layered Keyboard Support
Pressing both arrow keys and button keys we not possible with my keyboard configuration. Make `hjkl` also usable as arrows when using the keyboard as an input source.
-rw-r--r--src/picow.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/picow.c b/src/picow.c
index b912899..0ad6041 100644
--- a/src/picow.c
+++ b/src/picow.c
@@ -212,7 +212,7 @@ static void update_gamepad_state(struct pw_appstate *state, union pw_gamepad_sta
break;
}
- if (state->ncarts > 0 && pressed) {
+ if (state->ncarts > 0 && pressed && gamepad == &state->gamepads[0].state) {
switch (button) {
case PW_BUTTON_LEFT:
state->cartidx2 = SDL_max(0, state->cartidx2 - 1);
@@ -406,15 +406,19 @@ static SDL_AppResult handle_keyboard(struct pw_appstate *state,
update_gamepad_state(state, gamepad, PW_BUTTON_X, event->down);
break;
case SDLK_UP:
+ case SDLK_K:
update_gamepad_state(state, gamepad, PW_BUTTON_UP, event->down);
break;
case SDLK_DOWN:
+ case SDLK_J:
update_gamepad_state(state, gamepad, PW_BUTTON_DOWN, event->down);
break;
case SDLK_LEFT:
+ case SDLK_H:
update_gamepad_state(state, gamepad, PW_BUTTON_LEFT, event->down);
break;
case SDLK_RIGHT:
+ case SDLK_L:
update_gamepad_state(state, gamepad, PW_BUTTON_RIGHT, event->down);
break;
case SDLK_RETURN: