diff options
-rw-r--r-- | sway/input/keyboard.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/sway/input/keyboard.c b/sway/input/keyboard.c index 71737cc4..420cefa6 100644 --- a/sway/input/keyboard.c +++ b/sway/input/keyboard.c | |||
@@ -17,9 +17,8 @@ static void update_shortcut_state(struct sway_shortcut_state *state, | |||
17 | bool last_key_was_a_modifier) { | 17 | bool last_key_was_a_modifier) { |
18 | if (event->state == WLR_KEY_PRESSED) { | 18 | if (event->state == WLR_KEY_PRESSED) { |
19 | if (last_key_was_a_modifier && state->last_key_index >= 0) { | 19 | if (last_key_was_a_modifier && state->last_key_index >= 0) { |
20 | // Last pressed key before this one was a modifier. We nullify | 20 | // Last pressed key before this one was a modifier |
21 | // the key id but not the keycode (as that is used for erasure | 21 | state->pressed_keycodes[state->last_key_index] = 0; |
22 | // on release) | ||
23 | state->pressed_keys[state->last_key_index] = 0; | 22 | state->pressed_keys[state->last_key_index] = 0; |
24 | state->last_key_index = -1; | 23 | state->last_key_index = -1; |
25 | } | 24 | } |
@@ -62,8 +61,8 @@ static struct sway_binding *get_active_binding( | |||
62 | struct sway_binding *binding = bindings->items[i]; | 61 | struct sway_binding *binding = bindings->items[i]; |
63 | 62 | ||
64 | if (modifiers ^ binding->modifiers || | 63 | if (modifiers ^ binding->modifiers || |
65 | npressed_keys != binding->keys->length || | 64 | npressed_keys != binding->keys->length || |
66 | locked > binding->locked) { | 65 | locked > binding->locked) { |
67 | continue; | 66 | continue; |
68 | } | 67 | } |
69 | 68 | ||
@@ -219,12 +218,12 @@ static void handle_keyboard_key(struct wl_listener *listener, void *data) { | |||
219 | for (size_t i = 0; i < translated_keysyms_len; ++i) { | 218 | for (size_t i = 0; i < translated_keysyms_len; ++i) { |
220 | update_shortcut_state(&keyboard->state_keysyms_translated, | 219 | update_shortcut_state(&keyboard->state_keysyms_translated, |
221 | event, (uint32_t)translated_keysyms[i], | 220 | event, (uint32_t)translated_keysyms[i], |
222 | last_key_was_a_modifier); | 221 | last_key_was_a_modifier && i == 0); |
223 | } | 222 | } |
224 | for (size_t i = 0; i < raw_keysyms_len; ++i) { | 223 | for (size_t i = 0; i < raw_keysyms_len; ++i) { |
225 | update_shortcut_state(&keyboard->state_keysyms_raw, | 224 | update_shortcut_state(&keyboard->state_keysyms_raw, |
226 | event, (uint32_t)raw_keysyms[i], | 225 | event, (uint32_t)raw_keysyms[i], |
227 | last_key_was_a_modifier); | 226 | last_key_was_a_modifier && i == 0); |
228 | } | 227 | } |
229 | 228 | ||
230 | // identify which binding should be executed. | 229 | // identify which binding should be executed. |