From 6b9837056e7c590bab299ea44a642cc5b85e4173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Fri, 29 Nov 2019 22:11:41 +0100 Subject: [PATCH] input: keyboard_leave: reset focused *before* doing anything else And update xcursor. This is necessary since we may still have mouse focus. But without keyboard focus, we don't display the 'text' xcursor. --- input.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/input.c b/input.c index 847a7fbe..07b9d551 100644 --- a/input.c +++ b/input.c @@ -147,21 +147,23 @@ keyboard_leave(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial, surface == NULL || /* Seen on Sway 1.2 */ wayl_terminal_from_surface(wayl, surface) == wayl->focused); + struct terminal *old_focused = wayl->focused; + wayl->focused = NULL; + stop_repeater(wayl, -1); - if (wayl->focused != NULL) { + if (old_focused != NULL) { /* * Sway bug - under certain conditions we get a * keyboard_leave() (and keyboard_key()) without first having * received a keyboard_enter() */ - term_focus_out(wayl->focused); + term_focus_out(old_focused); + term_xcursor_update(old_focused); } else { LOG_WARN( "compositor sent keyboard_leave event without a keyboard_enter " "event: surface=%p", surface); } - - wayl->focused = NULL; } static void