aboutsummaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-11-21 17:17:02 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-11-21 17:17:02 +0000
commit8c945c9832f94835cd6482a6525217cd21da08af (patch)
tree169914e9122f92272f81a09a68d5daba7c7b9047 /input.c
parentlog: set syslog facility to LOG_DAEMON when run in server mode (diff)
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.
Diffstat (limited to 'input.c')
-rw-r--r--input.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/input.c b/input.c
index 40cfa613..d47cf889 100644
--- a/input.c
+++ b/input.c
@@ -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;
}