aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/keyboard.c
diff options
context:
space:
mode:
authorLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-01-09 00:52:47 -0500
committerLibravatar Brian Ashworth <bosrsf04@gmail.com>2019-01-09 01:07:29 -0500
commit1feb2ce064140ccd318f35eec2fa62c89ed4e9d9 (patch)
treeea273b5cc651b4977139f901db9cd767f0788ff5 /sway/input/keyboard.c
parentMerge pull request #3385 from robertgzr/reset_output_mapping (diff)
downloadsway-1feb2ce064140ccd318f35eec2fa62c89ed4e9d9.tar.gz
sway-1feb2ce064140ccd318f35eec2fa62c89ed4e9d9.tar.zst
sway-1feb2ce064140ccd318f35eec2fa62c89ed4e9d9.zip
keyboard: update repeat timer before execution
Since the keyboard can be destroyed by executing a binding (reloading with a different seat attachment config), update the repeat timer before executing the binding.
Diffstat (limited to 'sway/input/keyboard.c')
-rw-r--r--sway/input/keyboard.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/sway/input/keyboard.c b/sway/input/keyboard.c
index c1b53237..46286410 100644
--- a/sway/input/keyboard.c
+++ b/sway/input/keyboard.c
@@ -295,14 +295,10 @@ static void handle_keyboard_key(struct wl_listener *listener, void *data) {
295 get_active_binding(&keyboard->state_keysyms_raw, 295 get_active_binding(&keyboard->state_keysyms_raw,
296 config->current_mode->keysym_bindings, &binding, 296 config->current_mode->keysym_bindings, &binding,
297 raw_modifiers, false, input_inhibited, device_identifier); 297 raw_modifiers, false, input_inhibited, device_identifier);
298
299 if (binding) {
300 seat_execute_command(seat, binding);
301 handled = true;
302 }
303 } 298 }
304 299
305 // Set up (or clear) keyboard repeat for a pressed binding 300 // Set up (or clear) keyboard repeat for a pressed binding. Since the
301 // binding may remove the keyboard, the timer needs to be updated first
306 if (binding && wlr_device->keyboard->repeat_info.delay > 0) { 302 if (binding && wlr_device->keyboard->repeat_info.delay > 0) {
307 keyboard->repeat_binding = binding; 303 keyboard->repeat_binding = binding;
308 if (wl_event_source_timer_update(keyboard->key_repeat_source, 304 if (wl_event_source_timer_update(keyboard->key_repeat_source,
@@ -316,6 +312,11 @@ static void handle_keyboard_key(struct wl_listener *listener, void *data) {
316 } 312 }
317 } 313 }
318 314
315 if (binding) {
316 seat_execute_command(seat, binding);
317 handled = true;
318 }
319
319 // Compositor bindings 320 // Compositor bindings
320 if (!handled && event->state == WLR_KEY_PRESSED) { 321 if (!handled && event->state == WLR_KEY_PRESSED) {
321 handled = keyboard_execute_compositor_binding( 322 handled = keyboard_execute_compositor_binding(