aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--terminal.c13
-rw-r--r--terminal.h1
2 files changed, 12 insertions, 2 deletions
diff --git a/terminal.c b/terminal.c
index 1e7ddabe..64d4d643 100644
--- a/terminal.c
+++ b/terminal.c
@@ -1967,13 +1967,16 @@ term_has_kbd_focus(struct terminal *term)
return false;
}
+#endif
void
term_kbd_focus_in(struct terminal *term)
{
- if (term_has_kbd_focus(term))
+ if (term->kbd_focus)
return;
+ term->kbd_focus = true;
+
if (term->focus_events)
term_to_slave(term, "\033[I", 3);
}
@@ -1981,9 +1984,15 @@ term_kbd_focus_in(struct terminal *term)
void
term_kbd_focus_out(struct terminal *term)
{
- if (term_has_kbd_focus(term))
+ if (!term->kbd_focus)
return;
+ tll_foreach(term->wl->seats, it)
+ if (it->item.kbd_focus == term)
+ return;
+
+ term->kbd_focus = false;
+
if (term->focus_events)
term_to_slave(term, "\033[O", 3);
}
diff --git a/terminal.h b/terminal.h
index 8316795f..c56f9531 100644
--- a/terminal.h
+++ b/terminal.h
@@ -336,6 +336,7 @@ struct terminal {
struct wayland *wl;
struct wl_window *window;
bool visual_focus;
+ bool kbd_focus;
enum term_surface active_surface;
struct {