aboutsummaryrefslogtreecommitdiff
path: root/sway/input/keyboard.c
diff options
context:
space:
mode:
authorfrsfnrrg <frsfnrrg@users.noreply.github.com>2018-06-01 18:40:51 -0400
committerfrsfnrrg <frsfnrrg@users.noreply.github.com>2018-06-01 18:52:36 -0400
commit78b7b468954c561bb9f800aef54afacbbe6d3d40 (patch)
tree2cf25755635de21ab89d5a6d6ce82c516451112b /sway/input/keyboard.c
parent480f0c593cc99a1a77b8b26027f2c9e065fb790c (diff)
Style fix, redundant entry removal, fix extra keysym delete
Diffstat (limited to 'sway/input/keyboard.c')
-rw-r--r--sway/input/keyboard.c13
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,
bool last_key_was_a_modifier) {
if (event->state == WLR_KEY_PRESSED) {
if (last_key_was_a_modifier && state->last_key_index >= 0) {
- // Last pressed key before this one was a modifier. We nullify
- // the key id but not the keycode (as that is used for erasure
- // on release)
+ // Last pressed key before this one was a modifier
+ state->pressed_keycodes[state->last_key_index] = 0;
state->pressed_keys[state->last_key_index] = 0;
state->last_key_index = -1;
}
@@ -62,8 +61,8 @@ static struct sway_binding *get_active_binding(
struct sway_binding *binding = bindings->items[i];
if (modifiers ^ binding->modifiers ||
- npressed_keys != binding->keys->length ||
- locked > binding->locked) {
+ npressed_keys != binding->keys->length ||
+ locked > binding->locked) {
continue;
}
@@ -219,12 +218,12 @@ static void handle_keyboard_key(struct wl_listener *listener, void *data) {
for (size_t i = 0; i < translated_keysyms_len; ++i) {
update_shortcut_state(&keyboard->state_keysyms_translated,
event, (uint32_t)translated_keysyms[i],
- last_key_was_a_modifier);
+ last_key_was_a_modifier && i == 0);
}
for (size_t i = 0; i < raw_keysyms_len; ++i) {
update_shortcut_state(&keyboard->state_keysyms_raw,
event, (uint32_t)raw_keysyms[i],
- last_key_was_a_modifier);
+ last_key_was_a_modifier && i == 0);
}
// identify which binding should be executed.