input: may get keyboard_exit() event with no focused terminal

This happens on Sway when exiting a screen locker. Or at least that's
when we see the problem; it's unclear if the event occurs when
starting the screen locker, or when exiting it. Or maybe its both.

Anyway, don't try to unfocus a NULL-terminal.
This commit is contained in:
Daniel Eklöf 2019-11-21 18:17:02 +01:00
parent 55a23a5b29
commit 8c945c9832
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -138,8 +138,12 @@ keyboard_leave(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial,
{
struct wayland *wayl = data;
assert(wayl->focused == NULL ||
wayl_terminal_from_surface(wayl, surface) == wayl->focused);
stop_repeater(wayl, -1);
term_focus_out(wayl->focused);
if (wayl->focused != NULL)
term_focus_out(wayl->focused);
wayl->focused = NULL;
}