From fc9fde88c3ea2f9a5d4923229df146d3b96bab9f Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Thu, 9 Jul 2020 08:46:25 +0200 Subject: input: only call term_kbd_focus_{in,out}() on actual state change That is, only call term_kbd_focus_in() if we're the *first* seat focusing that terminal, and only call term_kbd_focus_out() if we're the *last* seat that focused it. --- terminal.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'terminal.c') diff --git a/terminal.c b/terminal.c index e4197a2a..fa1816ae 100644 --- a/terminal.c +++ b/terminal.c @@ -1964,6 +1964,8 @@ term_has_kbd_focus(struct terminal *term) void term_kbd_focus_in(struct terminal *term) { + assert(term_has_kbd_focus(term)); + if (term->focus_events) term_to_slave(term, "\033[I", 3); } @@ -1971,6 +1973,8 @@ term_kbd_focus_in(struct terminal *term) void term_kbd_focus_out(struct terminal *term) { + assert(!term_has_kbd_focus(term)); + if (term->focus_events) term_to_slave(term, "\033[O", 3); } -- cgit v1.3