diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-07-31 15:09:06 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-07-31 15:09:06 +0000 |
| commit | d4ee9be4d767ff4927c9e322bdbf958841dc091d (patch) | |
| tree | ab8adafe11e3bae878f38e9559b1abbf937f48a1 /terminal.c | |
| parent | config: configuration errors are no longer fatal (diff) | |
config: add 'hide-when-typing'
When enabled, the mouse cursor is hidden when the user types in the
terminal. It is un-hidden when the user moves the mouse, or when the
window loses keyboard focus.
Diffstat (limited to 'terminal.c')
| -rw-r--r-- | terminal.c | 23 |
1 files changed, 14 insertions, 9 deletions
@@ -36,6 +36,7 @@ #define PTMX_TIMING 0 +const char *const XCURSOR_HIDDEN = "hidden"; const char *const XCURSOR_LEFT_PTR = "left_ptr"; const char *const XCURSOR_TEXT = "text"; //const char *const XCURSOR_HAND2 = "hand2"; @@ -2207,18 +2208,22 @@ term_mouse_motion(struct terminal *term, int button, int row, int col, } void -term_xcursor_update(struct terminal *term) +term_xcursor_update_for_seat(struct terminal *term, struct seat *seat) { - tll_foreach(term->wl->seats, it) { - struct seat *seat = &it->item; + const char *xcursor + = seat->pointer.hidden ? XCURSOR_HIDDEN + : term->is_searching ? XCURSOR_LEFT_PTR + : selection_enabled(term, seat) ? XCURSOR_TEXT + : XCURSOR_LEFT_PTR; - const char *xcursor - = term->is_searching ? XCURSOR_LEFT_PTR : /* TODO: something different? */ - selection_enabled(term, seat) ? XCURSOR_TEXT : - XCURSOR_LEFT_PTR; + render_xcursor_set(seat, term, xcursor); +} - render_xcursor_set(seat, term, xcursor); - } +void +term_xcursor_update(struct terminal *term) +{ + tll_foreach(term->wl->seats, it) + term_xcursor_update_for_seat(term, &it->item); } void |
