mirror of
https://github.com/swaywm/sway.git
synced 2026-04-29 06:46:22 -04:00
Merge e6a6bdbac1 into 89f4ebef06
This commit is contained in:
commit
560cbfe223
1 changed files with 12 additions and 17 deletions
|
|
@ -263,8 +263,10 @@ static void handle_keyboard_key(struct wl_listener *listener, void *data) {
|
||||||
keyboard->held_binding = binding_released;
|
keyboard->held_binding = binding_released;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Clear keyboard repeat
|
||||||
|
keyboard->repeat_binding = NULL;
|
||||||
|
|
||||||
// Identify and execute active pressed binding
|
// Identify and execute active pressed binding
|
||||||
struct sway_binding *next_repeat_binding = NULL;
|
|
||||||
if (event->state == WLR_KEY_PRESSED) {
|
if (event->state == WLR_KEY_PRESSED) {
|
||||||
struct sway_binding *binding_pressed = NULL;
|
struct sway_binding *binding_pressed = NULL;
|
||||||
get_active_binding(&keyboard->state_keycodes,
|
get_active_binding(&keyboard->state_keycodes,
|
||||||
|
|
@ -278,28 +280,21 @@ static void handle_keyboard_key(struct wl_listener *listener, void *data) {
|
||||||
raw_modifiers, false, input_inhibited);
|
raw_modifiers, false, input_inhibited);
|
||||||
|
|
||||||
if (binding_pressed) {
|
if (binding_pressed) {
|
||||||
if ((binding_pressed->flags & BINDING_RELOAD) == 0) {
|
// Set up keyboard repeat for a pressed binding, except for reloads
|
||||||
next_repeat_binding = binding_pressed;
|
if ((binding_pressed->flags & BINDING_RELOAD) == 0 &&
|
||||||
|
wlr_device->keyboard->repeat_info.delay > 0) {
|
||||||
|
keyboard->repeat_binding = binding_pressed;
|
||||||
|
if (wl_event_source_timer_update(keyboard->key_repeat_source,
|
||||||
|
wlr_device->keyboard->repeat_info.delay) < 0) {
|
||||||
|
wlr_log(WLR_DEBUG, "failed to set key repeat timer");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
seat_execute_command(seat, binding_pressed);
|
seat_execute_command(seat, binding_pressed);
|
||||||
handled = true;
|
handled = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up (or clear) keyboard repeat for a pressed binding
|
|
||||||
if (next_repeat_binding && wlr_device->keyboard->repeat_info.delay > 0) {
|
|
||||||
keyboard->repeat_binding = next_repeat_binding;
|
|
||||||
if (wl_event_source_timer_update(keyboard->key_repeat_source,
|
|
||||||
wlr_device->keyboard->repeat_info.delay) < 0) {
|
|
||||||
wlr_log(WLR_DEBUG, "failed to set key repeat timer");
|
|
||||||
}
|
|
||||||
} else if (keyboard->repeat_binding) {
|
|
||||||
keyboard->repeat_binding = NULL;
|
|
||||||
if (wl_event_source_timer_update(keyboard->key_repeat_source, 0) < 0) {
|
|
||||||
wlr_log(WLR_DEBUG, "failed to disarm key repeat timer");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Compositor bindings
|
// Compositor bindings
|
||||||
if (!handled && event->state == WLR_KEY_PRESSED) {
|
if (!handled && event->state == WLR_KEY_PRESSED) {
|
||||||
handled = keyboard_execute_compositor_binding(
|
handled = keyboard_execute_compositor_binding(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue