From 8fb529bc31951cbd58a0eb1c1761975c01fed456 Mon Sep 17 00:00:00 2001 From: Hideyuki Nagase Date: Thu, 10 Mar 2022 08:51:34 -0600 Subject: [PATCH] input: Fix bug in idle inhibition Server generated key repeats are ignored - and they don't generate matching release events. We early return to avoid generating events for them. We also need to push the idle inhibition counting after that early return to prevent breaking idle inhibition with unmatched events. Co-authored-by: Steve Pronovost Co-authored-by: Brenton DeGeer Signed-off-by: Hideyuki Nagase Signed-off-by: Steve Pronovost Signed-off-by: Brenton DeGeer --- libweston/input.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libweston/input.c b/libweston/input.c index 6fb4bed3..7c8559ae 100644 --- a/libweston/input.c +++ b/libweston/input.c @@ -2197,12 +2197,6 @@ notify_key(struct weston_seat *seat, const struct timespec *time, uint32_t key, struct weston_keyboard_grab *grab = keyboard->grab; uint32_t *k, *end; - if (state == WL_KEYBOARD_KEY_STATE_PRESSED) { - weston_compositor_idle_inhibit(compositor); - } else { - weston_compositor_idle_release(compositor); - } - end = keyboard->keys.data + keyboard->keys.size; for (k = keyboard->keys.data; k < end; k++) { if (*k == key) { @@ -2218,6 +2212,12 @@ notify_key(struct weston_seat *seat, const struct timespec *time, uint32_t key, *k = key; } + if (state == WL_KEYBOARD_KEY_STATE_PRESSED) { + weston_compositor_idle_inhibit(compositor); + } else { + weston_compositor_idle_release(compositor); + } + if (grab == &keyboard->default_grab || grab == &keyboard->input_method_grab) { weston_compositor_run_key_binding(compositor, keyboard, time,