aboutsummaryrefslogtreecommitdiff
path: root/terminal.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2023-06-27 16:40:44 +0000
committerDaniel Eklöf <daniel@ekloef.se>2023-07-03 12:36:32 +0000
commitddd6004b275dd9a24f26e03dead90f0fffb0cc3e (patch)
tree8cb3b31121a5e5a690ccbbd205642bbfbe3eef4a /terminal.c
parentcursor-shape: assert lookup succeeded (diff)
render: don’t (can’t) use cursor-shape-v1 when user has set a custom cursor
Well, we _could_, but we’d have to reverse map the string to a cursor-shape-v1 enum value. Let’s not do that, for now at least.
Diffstat (limited to 'terminal.c')
-rw-r--r--terminal.c27
1 files changed, 16 insertions, 11 deletions
diff --git a/terminal.c b/terminal.c
index 3591040b..3f2c9095 100644
--- a/terminal.c
+++ b/terminal.c
@@ -3126,19 +3126,24 @@ term_xcursor_update_for_seat(struct terminal *term, struct seat *seat)
enum cursor_shape shape = CURSOR_SHAPE_NONE;
switch (term->active_surface) {
- case TERM_SURF_GRID: {
- bool have_custom_cursor =
- render_xcursor_is_valid(seat, term->mouse_user_cursor);
+ case TERM_SURF_GRID:
+ if (seat->pointer.hidden)
+ shape = CURSOR_SHAPE_HIDDEN;
- shape = seat->pointer.hidden ? CURSOR_SHAPE_HIDDEN
- : have_custom_cursor ? CURSOR_SHAPE_CUSTOM //term->mouse_user_cursor
- : term->is_searching ? CURSOR_SHAPE_LEFT_PTR
- : (seat->mouse.col >= 0 &&
- seat->mouse.row >= 0 &&
- term_mouse_grabbed(term, seat)) ? CURSOR_SHAPE_TEXT
- : CURSOR_SHAPE_LEFT_PTR;
+ else if (render_xcursor_is_valid(seat, term->mouse_user_cursor))
+ shape = CURSOR_SHAPE_CUSTOM;
+
+ else if (seat->mouse.col >= 0 &&
+ seat->mouse.row >= 0 &&
+ term_mouse_grabbed(term, seat))
+ {
+ shape = CURSOR_SHAPE_TEXT;
+ }
+
+ else
+ shape = CURSOR_SHAPE_LEFT_PTR;
break;
- }
+
case TERM_SURF_TITLE:
case TERM_SURF_BUTTON_MINIMIZE:
case TERM_SURF_BUTTON_MAXIMIZE: