mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-21 05:33:45 -04:00
term: cache kbd-focused state, just like we cache visual focus state
There's one difference however, when we receive a kbd unfocus call, *all* seats must have us unfocused before we actually change the state.
This commit is contained in:
parent
ed0cb06b48
commit
8c72e9434e
2 changed files with 12 additions and 2 deletions
13
terminal.c
13
terminal.c
|
|
@ -1967,13 +1967,16 @@ term_has_kbd_focus(struct terminal *term)
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void
|
void
|
||||||
term_kbd_focus_in(struct terminal *term)
|
term_kbd_focus_in(struct terminal *term)
|
||||||
{
|
{
|
||||||
if (term_has_kbd_focus(term))
|
if (term->kbd_focus)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
term->kbd_focus = true;
|
||||||
|
|
||||||
if (term->focus_events)
|
if (term->focus_events)
|
||||||
term_to_slave(term, "\033[I", 3);
|
term_to_slave(term, "\033[I", 3);
|
||||||
}
|
}
|
||||||
|
|
@ -1981,9 +1984,15 @@ term_kbd_focus_in(struct terminal *term)
|
||||||
void
|
void
|
||||||
term_kbd_focus_out(struct terminal *term)
|
term_kbd_focus_out(struct terminal *term)
|
||||||
{
|
{
|
||||||
if (term_has_kbd_focus(term))
|
if (!term->kbd_focus)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
tll_foreach(term->wl->seats, it)
|
||||||
|
if (it->item.kbd_focus == term)
|
||||||
|
return;
|
||||||
|
|
||||||
|
term->kbd_focus = false;
|
||||||
|
|
||||||
if (term->focus_events)
|
if (term->focus_events)
|
||||||
term_to_slave(term, "\033[O", 3);
|
term_to_slave(term, "\033[O", 3);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -336,6 +336,7 @@ struct terminal {
|
||||||
struct wayland *wl;
|
struct wayland *wl;
|
||||||
struct wl_window *window;
|
struct wl_window *window;
|
||||||
bool visual_focus;
|
bool visual_focus;
|
||||||
|
bool kbd_focus;
|
||||||
enum term_surface active_surface;
|
enum term_surface active_surface;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue