From e333bd2176ee3c9ec5aaa8864b36b9bcdf7e3b6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sun, 24 Nov 2019 00:06:50 +0100 Subject: [PATCH] input: document why wayl->focused may be NULL --- input.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/input.c b/input.c index 319b9f1c..803eff76 100644 --- a/input.c +++ b/input.c @@ -142,8 +142,14 @@ keyboard_leave(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial, wayl_terminal_from_surface(wayl, surface) == wayl->focused); stop_repeater(wayl, -1); - if (wayl->focused != NULL) + if (wayl->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); + } wayl->focused = NULL; }