mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-07 04:34:03 -05:00
term: add term_visual_focus_{in,out}
These functions should be called when the terminal gets or loses visual focus. Note that this isn't necessarily the same as having keyboard focus.
This commit is contained in:
parent
4be3c04999
commit
6f281cebfb
2 changed files with 19 additions and 8 deletions
25
terminal.c
25
terminal.c
|
|
@ -1392,27 +1392,36 @@ term_restore_cursor(struct terminal *term)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
term_kbd_focus_in(struct terminal *term)
|
term_visual_focus_in(struct terminal *term)
|
||||||
{
|
{
|
||||||
|
term->visual_focus = true;
|
||||||
if (term->cursor_blink.active)
|
if (term->cursor_blink.active)
|
||||||
cursor_blink_start_timer(term);
|
cursor_blink_start_timer(term);
|
||||||
|
cursor_refresh(term);
|
||||||
|
}
|
||||||
|
|
||||||
if (term->focus_events)
|
void
|
||||||
term_to_slave(term, "\033[I", 3);
|
term_visual_focus_out(struct terminal *term)
|
||||||
|
{
|
||||||
|
term->visual_focus = false;
|
||||||
|
if (term->cursor_blink.active)
|
||||||
|
cursor_blink_stop_timer(term);
|
||||||
|
|
||||||
cursor_refresh(term);
|
cursor_refresh(term);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
term_kbd_focus_in(struct terminal *term)
|
||||||
|
{
|
||||||
|
if (term->focus_events)
|
||||||
|
term_to_slave(term, "\033[I", 3);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
term_kbd_focus_out(struct terminal *term)
|
term_kbd_focus_out(struct terminal *term)
|
||||||
{
|
{
|
||||||
if (term->cursor_blink.active)
|
|
||||||
cursor_blink_stop_timer(term);
|
|
||||||
|
|
||||||
if (term->focus_events)
|
if (term->focus_events)
|
||||||
term_to_slave(term, "\033[O", 3);
|
term_to_slave(term, "\033[O", 3);
|
||||||
|
|
||||||
cursor_refresh(term);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
|
|
||||||
|
|
@ -378,6 +378,8 @@ void term_arm_blink_timer(struct terminal *term);
|
||||||
|
|
||||||
void term_restore_cursor(struct terminal *term);
|
void term_restore_cursor(struct terminal *term);
|
||||||
|
|
||||||
|
void term_visual_focus_in(struct terminal *term);
|
||||||
|
void term_visual_focus_out(struct terminal *term);
|
||||||
void term_kbd_focus_in(struct terminal *term);
|
void term_kbd_focus_in(struct terminal *term);
|
||||||
void term_kbd_focus_out(struct terminal *term);
|
void term_kbd_focus_out(struct terminal *term);
|
||||||
void term_mouse_down(struct terminal *term, int button, int row, int col);
|
void term_mouse_down(struct terminal *term, int button, int row, int col);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue