Style fix, redundant entry removal, fix extra keysym delete

master
frsfnrrg 7 years ago
parent 480f0c593c
commit 78b7b46895

@ -17,9 +17,8 @@ static void update_shortcut_state(struct sway_shortcut_state *state,
bool last_key_was_a_modifier) { bool last_key_was_a_modifier) {
if (event->state == WLR_KEY_PRESSED) { if (event->state == WLR_KEY_PRESSED) {
if (last_key_was_a_modifier && state->last_key_index >= 0) { if (last_key_was_a_modifier && state->last_key_index >= 0) {
// Last pressed key before this one was a modifier. We nullify // Last pressed key before this one was a modifier
// the key id but not the keycode (as that is used for erasure state->pressed_keycodes[state->last_key_index] = 0;
// on release)
state->pressed_keys[state->last_key_index] = 0; state->pressed_keys[state->last_key_index] = 0;
state->last_key_index = -1; state->last_key_index = -1;
} }
@ -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) { for (size_t i = 0; i < translated_keysyms_len; ++i) {
update_shortcut_state(&keyboard->state_keysyms_translated, update_shortcut_state(&keyboard->state_keysyms_translated,
event, (uint32_t)translated_keysyms[i], 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) { for (size_t i = 0; i < raw_keysyms_len; ++i) {
update_shortcut_state(&keyboard->state_keysyms_raw, update_shortcut_state(&keyboard->state_keysyms_raw,
event, (uint32_t)raw_keysyms[i], event, (uint32_t)raw_keysyms[i],
last_key_was_a_modifier); last_key_was_a_modifier && i == 0);
} }
// identify which binding should be executed. // identify which binding should be executed.

Loading…
Cancel
Save