diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-01-02 18:35:32 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-01-02 18:35:32 +0000 |
| commit | 6f281cebfb5db24c10a2cd0a10e2175fe9f6b514 (patch) | |
| tree | 64b013816508c4267b43c4d29f19b25f1a4cdf95 | |
| parent | input: keyboard-leave: move comment to where it belongs (diff) | |
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.
| -rw-r--r-- | terminal.c | 25 | ||||
| -rw-r--r-- | terminal.h | 2 |
2 files changed, 19 insertions, 8 deletions
@@ -1392,27 +1392,36 @@ term_restore_cursor(struct terminal *term) } void -term_kbd_focus_in(struct terminal *term) +term_visual_focus_in(struct terminal *term) { + term->visual_focus = true; if (term->cursor_blink.active) cursor_blink_start_timer(term); - - if (term->focus_events) - term_to_slave(term, "\033[I", 3); - cursor_refresh(term); } void -term_kbd_focus_out(struct terminal *term) +term_visual_focus_out(struct terminal *term) { + term->visual_focus = false; if (term->cursor_blink.active) cursor_blink_stop_timer(term); + cursor_refresh(term); +} + +void +term_kbd_focus_in(struct terminal *term) +{ if (term->focus_events) - term_to_slave(term, "\033[O", 3); + term_to_slave(term, "\033[I", 3); +} - cursor_refresh(term); +void +term_kbd_focus_out(struct terminal *term) +{ + if (term->focus_events) + term_to_slave(term, "\033[O", 3); } static int @@ -378,6 +378,8 @@ void term_arm_blink_timer(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_out(struct terminal *term); void term_mouse_down(struct terminal *term, int button, int row, int col); |
