mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
keyboard: handle onRelease keybind after long press
...that is longer than the specified repeatDelay interval.
This commit is contained in:
parent
067c59e526
commit
d4756f62eb
1 changed files with 22 additions and 2 deletions
|
|
@ -235,6 +235,20 @@ is_modifier_key(xkb_keysym_t sym)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool
|
||||||
|
is_modifier(struct wlr_keyboard *wlr_keyboard, uint32_t evdev_keycode)
|
||||||
|
{
|
||||||
|
const xkb_keysym_t *syms = NULL;
|
||||||
|
int nr_syms = xkb_state_key_get_syms(wlr_keyboard->xkb_state,
|
||||||
|
evdev_keycode + 8, &syms);
|
||||||
|
for (int i = 0; i < nr_syms; i++) {
|
||||||
|
if (is_modifier_key(syms[i])) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
static struct keyinfo
|
static struct keyinfo
|
||||||
get_keyinfo(struct wlr_keyboard *wlr_keyboard, uint32_t evdev_keycode)
|
get_keyinfo(struct wlr_keyboard *wlr_keyboard, uint32_t evdev_keycode)
|
||||||
{
|
{
|
||||||
|
|
@ -552,7 +566,13 @@ keyboard_key_notify(struct wl_listener *listener, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (handled) {
|
if (handled) {
|
||||||
if (event->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
/*
|
||||||
|
* We do not start the repeat-timer on pressed modifiers (like
|
||||||
|
* Super_L) because it is only for our own internal use with
|
||||||
|
* keybinds and it messes up modifier-onRelease-keybinds.
|
||||||
|
*/
|
||||||
|
if (!is_modifier(keyboard->wlr_keyboard, event->keycode)
|
||||||
|
&& event->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
||||||
start_keybind_repeat(seat->server, keyboard, event);
|
start_keybind_repeat(seat->server, keyboard, event);
|
||||||
}
|
}
|
||||||
} else if (!input_method_keyboard_grab_forward_key(keyboard, event)) {
|
} else if (!input_method_keyboard_grab_forward_key(keyboard, event)) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue