From 8c50a7afd401686f645fb26676fbcaedb8d4ab62 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Thu, 25 Nov 2021 19:22:52 +0100 Subject: osc8: update URI ranges as we print data, *not* when the URI is closed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit At first, an OSC-8 URI range was added when we received the closing OSC-8 escape (i.e. with an empty URI). But, this meant that cursor movements while the OSC-8 escape was in effect wasn’t handled correctly, since we’d add a range that spanned the cursor movements. Attempts were made to handle this in the cursor movement functions, by closing and re-opening the URI. However, there are too many corner cases to make this a viable approach. Scrolling is one such example, line-wrapping another. This patch takes a different approach; emit, or update the URI range when we print to the grid. This models the intended behavior much more closely, where an active OSC-8 URI act like any other SGR attribute - it is applied to all cells printed to, but otherwise have no effect. To avoid killing performance, this is only done in the “generic” printer. This means OSC-8 open/close calls must now “switch” the ASCII printer. Note that the “fast” printer still needs to *erase* pre-existing OSC-8 URIs. Closes #816 --- terminal.c | 101 +++++++++++++------------------------------------------------ 1 file changed, 21 insertions(+), 80 deletions(-) (limited to 'terminal.c') diff --git a/terminal.c b/terminal.c index 4cc9ed09..03ff1898 100644 --- a/terminal.c +++ b/terminal.c @@ -1134,9 +1134,6 @@ term_init(const struct config *conf, struct fdm *fdm, struct reaper *reaper, .blink = {.fd = -1}, .vt = { .state = 0, /* STATE_GROUND */ - .osc8 = { - .begin = {-1, -1}, - }, }, .colors = { .fg = conf->colors.fg, @@ -1826,7 +1823,6 @@ term_reset(struct terminal *term, bool hard) term->vt = (struct vt){ .state = 0, /* STATE_GROUND */ - .osc8 = {.begin = (struct coord){-1, -1}}, }; if (term->grid == &term->alt) { @@ -3151,7 +3147,8 @@ print_insert(struct terminal *term, int width) static void print_spacer(struct terminal *term, int col, int remaining) { - struct row *row = term->grid->cur_row; + struct grid *grid = term->grid; + struct row *row = grid->cur_row; struct cell *cell = &row->cells[col]; cell->wc = CELL_SPACER + remaining; @@ -3210,7 +3207,19 @@ term_print(struct terminal *term, wchar_t wc, int width) cell->wc = term->vt.last_printed = wc; cell->attrs = term->vt.attrs; - const int uri_start = col; + if (term->vt.osc8.uri != NULL) { + grid_row_uri_range_put( + row, col, term->vt.osc8.uri, term->vt.osc8.id); + + switch (term->conf->url.osc8_underline) { + case OSC8_UNDERLINE_ALWAYS: + cell->attrs.url = true; + break; + + case OSC8_UNDERLINE_URL_MODE: + break; + } + } /* Advance cursor the 'additional' columns while dirty:ing the cells */ for (int i = 1; i < width && col < term->cols - 1; i++) { @@ -3226,9 +3235,6 @@ term_print(struct terminal *term, wchar_t wc, int width) xassert(!grid->cursor.lcf); grid->cursor.point.col = col; - - if (unlikely(row->extra != NULL)) - grid_row_uri_range_erase(row, uri_start, uri_start + width - 1); } static void @@ -3260,7 +3266,6 @@ ascii_printer_fast(struct terminal *term, wchar_t wc) cell->wc = term->vt.last_printed = wc; cell->attrs = term->vt.attrs; - /* Advance cursor */ if (unlikely(++col >= term->cols)) { grid->cursor.lcf = true; @@ -3287,6 +3292,7 @@ term_update_ascii_printer(struct terminal *term) { void (*new_printer)(struct terminal *term, wchar_t wc) = unlikely(tll_length(term->grid->sixel_images) > 0 || + term->vt.osc8.uri != NULL || term->charsets.set[term->charsets.selected] == CHARSET_GRAPHIC || term->insert_mode) ? &ascii_printer_generic @@ -3294,7 +3300,7 @@ term_update_ascii_printer(struct terminal *term) #if defined(_DEBUG) && LOG_ENABLE_DBG if (term->ascii_printer != new_printer) { - LOG_DBG("switching ASCII printer %s -> %s", + LOG_DBG("§switching ASCII printer %s -> %s", term->ascii_printer == &ascii_printer_fast ? "fast" : "generic", new_printer == &ascii_printer_fast ? "fast" : "generic"); } @@ -3491,84 +3497,19 @@ term_ime_set_cursor_rect(struct terminal *term, int x, int y, int width, void term_osc8_open(struct terminal *term, uint64_t id, const char *uri) { - if (unlikely(term->vt.osc8.begin.row >= 0)) { - /* It’s valid to switch from one URI to another without - * closing the first one */ - term_osc8_close(term); - } - + term_osc8_close(term); xassert(term->vt.osc8.uri == NULL); - term->vt.osc8.begin = (struct coord){ - .col = term->grid->cursor.point.col, - .row = grid_row_absolute(term->grid, term->grid->cursor.point.row), - }; term->vt.osc8.id = id; term->vt.osc8.uri = xstrdup(uri); + term_update_ascii_printer(term); } void term_osc8_close(struct terminal *term) { - if (term->vt.osc8.begin.row < 0) - return; - - if (term->vt.osc8.uri[0] == '\0') - goto done; - - struct coord start = term->vt.osc8.begin; - struct coord end = (struct coord){ - .col = term->grid->cursor.point.col, - .row = grid_row_absolute(term->grid, term->grid->cursor.point.row), - }; - - if (start.row == end.row && start.col == end.col) { - /* Zero-length URL, e.g: \E]8;;http://foo\E\\\E]8;;\E\\ */ - goto done; - } - - /* end is *inclusive */ - if (--end.col < 0) { - end.row--; - end.col = term->cols - 1; - } - - int r = start.row; - int start_col = start.col; - while (true) { - int end_col = r == end.row ? end.col : term->cols - 1; - - struct row *row = term->grid->rows[r]; - - switch (term->conf->url.osc8_underline) { - case OSC8_UNDERLINE_ALWAYS: - for (int c = start_col; c <= end_col; c++) - row->cells[c].attrs.url = true; - break; - - case OSC8_UNDERLINE_URL_MODE: - break; - } - - struct row_uri_range range = { - .start = start_col, - .end = end_col, - .id = term->vt.osc8.id, - .uri = xstrdup(term->vt.osc8.uri), - }; - grid_row_uri_range_add(row, range); - start_col = 0; - - if (r == end.row) - break; - - r++; - r &= term->grid->num_rows - 1; - } - -done: free(term->vt.osc8.uri); - term->vt.osc8.id = 0; term->vt.osc8.uri = NULL; - term->vt.osc8.begin = (struct coord){-1, -1}; + term->vt.osc8.id = 0; + term_update_ascii_printer(term); } -- cgit v1.3 From fec42e5941c20f4b69164dd0d78ea7e7e0f17de5 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Tue, 16 Nov 2021 16:32:58 +0100 Subject: kitty kbd: add flag state, implement push/pop/update/query --- csi.c | 91 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ terminal.c | 4 +++ terminal.h | 15 +++++++++++ 3 files changed, 110 insertions(+) (limited to 'terminal.c') diff --git a/csi.c b/csi.c index 0224dd80..45bf1a16 100644 --- a/csi.c +++ b/csi.c @@ -1444,6 +1444,16 @@ csi_dispatch(struct terminal *term, uint8_t final) break; } + case 'u': { + enum kitty_kbd_flags flags = + term->grid->kitty_kbd.flags[term->grid->kitty_kbd.idx]; + + char reply[8]; + int chars = snprintf(reply, sizeof(reply), "\033[?%uu", flags); + term_to_slave(term, reply, chars); + break; + } + default: UNHANDLED(); break; @@ -1532,6 +1542,26 @@ csi_dispatch(struct terminal *term, uint8_t final) } break; /* final == 'm' */ + case 'u': { + int flags = vt_param_get(term, 0, 0) & KITTY_KBD_MASK; + + struct grid *grid = term->grid; + uint8_t idx = grid->kitty_kbd.idx; + + if (idx + 1 >= ALEN(grid->kitty_kbd.flags)) { + /* Stack full, evict oldest by wrapping around */ + idx = 0; + } else + idx++; + + grid->kitty_kbd.flags[idx] = flags; + grid->kitty_kbd.idx = idx; + + xassert(grid->kitty_kbd.idx < ALEN(grid->kitty_kbd.flags)); + LOG_DBG("kitty kbd: pushed new mode: 0x%03x", flags); + break; + } + case 'q': { /* XTVERSION */ if (vt_param_get(term, 0, 0) != 0) { @@ -1556,6 +1586,37 @@ csi_dispatch(struct terminal *term, uint8_t final) break; /* private[0] == '>' */ } + case '<': { + switch (final) { + case 'u': { + int count = vt_param_get(term, 0, 1); + LOG_DBG("kitty kbd: popping %d levels of flags", count); + + struct grid *grid = term->grid; + uint8_t idx = grid->kitty_kbd.idx; + + for (int i = 0; i < count; i++) { + /* Reset flags. This ensures we get flags=0 when + * over-popping */ + grid->kitty_kbd.flags[idx] = 0; + + if (idx == 0) + idx = ALEN(grid->kitty_kbd.flags) - 1; + else + idx--; + } + + grid->kitty_kbd.idx = idx; + xassert(grid->kitty_kbd.idx < ALEN(grid->kitty_kbd.flags)); + + LOG_DBG("kitty kbd: mode after pop: 0x%03x", + term->grid->kitty_kbd.flags[idx]); + break; + } + } + break; /* private[0] == ‘<’ */ + } + case ' ': { switch (final) { case 'q': { @@ -1633,6 +1694,36 @@ csi_dispatch(struct terminal *term, uint8_t final) term_to_slave(term, "\033P!|464f4f54\033\\", 14); /* FOOT */ break; + case 'u': { + int flag_set = vt_param_get(term, 0, 0) & KITTY_KBD_MASK; + int mode = vt_param_get(term, 1, 1); + + struct grid *grid = term->grid; + uint8_t idx = grid->kitty_kbd.idx; + + switch (mode) { + case 1: + /* set bits are set, unset bits are reset */ + grid->kitty_kbd.flags[idx] = flag_set; + break; + + case 2: + /* set bits are set, unset bits are left unchanged */ + grid->kitty_kbd.flags[idx] |= flag_set; + break; + + case 3: + /* set bits are reset, unset bits are left unchanged */ + grid->kitty_kbd.flags[idx] &= ~flag_set; + break; + + default: + UNHANDLED(); + break; + } + break; + } + default: UNHANDLED(); break; diff --git a/terminal.c b/terminal.c index 03ff1898..a56ead03 100644 --- a/terminal.c +++ b/terminal.c @@ -1815,6 +1815,10 @@ term_reset(struct terminal *term, bool hard) tll_free_and_free(term->window_title_stack, free); term_set_window_title(term, term->conf->title); + memset(term->normal.kitty_kbd.flags, 0, sizeof(term->normal.kitty_kbd.flags)); + memset(term->alt.kitty_kbd.flags, 0, sizeof(term->alt.kitty_kbd.flags)); + term->normal.kitty_kbd.idx = term->alt.kitty_kbd.idx = 0; + term->scroll_region.start = 0; term->scroll_region.end = term->rows; diff --git a/terminal.h b/terminal.h index 3096186f..c20e30fc 100644 --- a/terminal.h +++ b/terminal.h @@ -127,6 +127,15 @@ struct sixel { bool opaque; }; +enum kitty_kbd_flags { + KITTY_KBD_DISAMBIGUATE = 0x01, + KITTY_KBD_REPORT_EVENT = 0x02, + KITTY_BKD_REPORT_ALTERNATE = 0x04, + KITTY_KBD_REPORT_ALL = 0x08, + KITTY_KBD_REPORT_ASSOCIATED = 0x10, + KITTY_KBD_MASK = 0x1f, +}; + struct grid { int num_rows; int num_cols; @@ -149,6 +158,12 @@ struct grid { tll(struct damage) scroll_damage; tll(struct sixel) sixel_images; + + struct { + enum kitty_kbd_flags flags[8]; + uint8_t idx; + } kitty_kbd; + }; struct vt_subparams { -- cgit v1.3 From 66171f104588a280e598ceb38dc90d9acdce060f Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 21 Nov 2021 12:01:16 +0100 Subject: input: rename ‘meta’ to ‘super’ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- input.c | 22 +++++++++++----------- terminal.c | 2 +- wayland.h | 4 ++-- 3 files changed, 14 insertions(+), 14 deletions(-) (limited to 'terminal.c') diff --git a/input.c b/input.c index 06f5b731..fed52a49 100644 --- a/input.c +++ b/input.c @@ -368,8 +368,8 @@ conf_modifiers_to_mask(const struct seat *seat, mods |= modifiers->ctrl << seat->kbd.mod_ctrl; if (seat->kbd.mod_alt != XKB_MOD_INVALID) mods |= modifiers->alt << seat->kbd.mod_alt; - if (seat->kbd.mod_meta != XKB_MOD_INVALID) - mods |= modifiers->meta << seat->kbd.mod_meta; + if (seat->kbd.mod_super != XKB_MOD_INVALID) + mods |= modifiers->meta << seat->kbd.mod_super; return mods; } @@ -677,7 +677,7 @@ keyboard_keymap(void *data, struct wl_keyboard *wl_keyboard, seat->kbd.mod_shift = xkb_keymap_mod_get_index(seat->kbd.xkb_keymap, XKB_MOD_NAME_SHIFT); seat->kbd.mod_alt = xkb_keymap_mod_get_index(seat->kbd.xkb_keymap, XKB_MOD_NAME_ALT) ; seat->kbd.mod_ctrl = xkb_keymap_mod_get_index(seat->kbd.xkb_keymap, XKB_MOD_NAME_CTRL); - seat->kbd.mod_meta = xkb_keymap_mod_get_index(seat->kbd.xkb_keymap, XKB_MOD_NAME_LOGO); + seat->kbd.mod_super = xkb_keymap_mod_get_index(seat->kbd.xkb_keymap, XKB_MOD_NAME_LOGO); seat->kbd.mod_caps = xkb_keymap_mod_get_index(seat->kbd.xkb_keymap, XKB_MOD_NAME_CAPS); seat->kbd.mod_num = xkb_keymap_mod_get_index(seat->kbd.xkb_keymap, XKB_MOD_NAME_NUM); @@ -688,8 +688,8 @@ keyboard_keymap(void *data, struct wl_keyboard *wl_keyboard, seat->kbd.bind_significant |= 1 << seat->kbd.mod_alt; if (seat->kbd.mod_ctrl != XKB_MOD_INVALID) seat->kbd.bind_significant |= 1 << seat->kbd.mod_ctrl; - if (seat->kbd.mod_meta != XKB_MOD_INVALID) - seat->kbd.bind_significant |= 1 << seat->kbd.mod_meta; + if (seat->kbd.mod_super != XKB_MOD_INVALID) + seat->kbd.bind_significant |= 1 << seat->kbd.mod_super; seat->kbd.kitty_significant = seat->kbd.bind_significant; if (seat->kbd.mod_caps != XKB_MOD_INVALID) @@ -801,7 +801,7 @@ keyboard_leave(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial, seat->kbd.shift = false; seat->kbd.alt = false; seat->kbd.ctrl = false; - seat->kbd.meta = false; + seat->kbd.super = false; if (seat->kbd.xkb_compose_state != NULL) xkb_compose_state_reset(seat->kbd.xkb_compose_state); @@ -1028,7 +1028,7 @@ legacy_kbd_protocol(struct seat *seat, struct terminal *term, keymap_mods |= seat->kbd.shift ? MOD_SHIFT : MOD_NONE; keymap_mods |= seat->kbd.alt ? MOD_ALT : MOD_NONE; keymap_mods |= seat->kbd.ctrl ? MOD_CTRL : MOD_NONE; - keymap_mods |= seat->kbd.meta ? MOD_META : MOD_NONE; + keymap_mods |= seat->kbd.super ? MOD_META : MOD_NONE; const xkb_keysym_t sym = ctx->sym; const size_t count = ctx->utf8.count; @@ -1181,8 +1181,8 @@ kitty_kbd_protocol(struct seat *seat, struct terminal *term, encoded_mods |= mods & (1 << seat->kbd.mod_alt) ? (1 << 1) : 0; if (seat->kbd.mod_ctrl != XKB_MOD_INVALID) encoded_mods |= mods & (1 << seat->kbd.mod_ctrl) ? (1 << 2) : 0; - if (seat->kbd.mod_meta != XKB_MOD_INVALID) - encoded_mods |= mods & (1 << seat->kbd.mod_meta) ? (1 << 3) : 0; + if (seat->kbd.mod_super != XKB_MOD_INVALID) + encoded_mods |= mods & (1 << seat->kbd.mod_super) ? (1 << 3) : 0; if (seat->kbd.mod_caps != XKB_MOD_INVALID) encoded_mods |= mods & (1 << seat->kbd.mod_caps) ? (1 << 6) : 0; if (seat->kbd.mod_num != XKB_MOD_INVALID) @@ -1618,9 +1618,9 @@ keyboard_modifiers(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial, ? xkb_state_mod_index_is_active( seat->kbd.xkb_state, seat->kbd.mod_ctrl, XKB_STATE_MODS_EFFECTIVE) : false; - seat->kbd.meta = seat->kbd.mod_meta != XKB_MOD_INVALID + seat->kbd.super = seat->kbd.mod_super != XKB_MOD_INVALID ? xkb_state_mod_index_is_active( - seat->kbd.xkb_state, seat->kbd.mod_meta, XKB_STATE_MODS_EFFECTIVE) + seat->kbd.xkb_state, seat->kbd.mod_super, XKB_STATE_MODS_EFFECTIVE) : false; } diff --git a/terminal.c b/terminal.c index a56ead03..e5c3ac65 100644 --- a/terminal.c +++ b/terminal.c @@ -2829,7 +2829,7 @@ term_mouse_grabbed(const struct terminal *term, struct seat *seat) return term->mouse_tracking == MOUSE_NONE || (seat->kbd_focus == term && seat->kbd.shift && - !seat->kbd.alt && /*!seat->kbd.ctrl &&*/ !seat->kbd.meta); + !seat->kbd.alt && /*!seat->kbd.ctrl &&*/ !seat->kbd.super); } void diff --git a/wayland.h b/wayland.h index a2e1d17e..d415588b 100644 --- a/wayland.h +++ b/wayland.h @@ -194,7 +194,7 @@ struct seat { xkb_mod_index_t mod_shift; xkb_mod_index_t mod_alt; xkb_mod_index_t mod_ctrl; - xkb_mod_index_t mod_meta; + xkb_mod_index_t mod_super; xkb_mod_index_t mod_caps; xkb_mod_index_t mod_num; @@ -208,7 +208,7 @@ struct seat { bool shift; bool alt; bool ctrl; - bool meta; + bool super; struct { key_binding_list_t key; -- cgit v1.3 From 5c2557b42116dd6d0f86c90b2cf04cd43f80a36e Mon Sep 17 00:00:00 2001 From: Jonas Ådahl Date: Fri, 19 Nov 2021 15:02:48 +0100 Subject: terminal: Make seat xcursor update focus aware When term_xcursor_update_for_seat() was called on e.g. keyboard focus loss, it'd update the curret xcursor to 'text' even if it was e.g. on top of the window title, or resize areas. This makes the function a bit more focus aware, and will not be so eager to set the text xcursor. --- input.c | 2 +- input.h | 2 ++ terminal.c | 43 +++++++++++++++++++++++++++++++++++-------- 3 files changed, 38 insertions(+), 9 deletions(-) (limited to 'terminal.c') diff --git a/input.c b/input.c index 0aef43cc..5f864a8d 100644 --- a/input.c +++ b/input.c @@ -1372,7 +1372,7 @@ is_bottom_right(const struct terminal *term, int x, int y) (term->active_surface == TERM_SURF_BORDER_BOTTOM && x > term->width + 1 * csd_border_size * term->scale - 10 * term->scale))); } -static const char * +const char * xcursor_for_csd_border(struct terminal *term, int x, int y) { if (is_top_left(term, x, y)) return XCURSOR_TOP_LEFT_CORNER; diff --git a/input.h b/input.h index 68b8719d..5a2c7a67 100644 --- a/input.h +++ b/input.h @@ -26,3 +26,5 @@ extern const struct wl_keyboard_listener keyboard_listener; extern const struct wl_pointer_listener pointer_listener; void input_repeat(struct seat *seat, uint32_t key); + +const char * xcursor_for_csd_border(struct terminal *term, int x, int y); diff --git a/terminal.c b/terminal.c index df8128fc..83204675 100644 --- a/terminal.c +++ b/terminal.c @@ -3015,14 +3015,41 @@ term_mouse_motion(struct terminal *term, int button, int row, int col, void term_xcursor_update_for_seat(struct terminal *term, struct seat *seat) { - const char *xcursor - = seat->pointer.hidden ? XCURSOR_HIDDEN - : term->is_searching ? XCURSOR_LEFT_PTR - : (seat->mouse.col >= 0 && - seat->mouse.row >= 0 && - term_mouse_grabbed(term, seat)) ? XCURSOR_TEXT - : term->is_searching ? XCURSOR_TEXT - : XCURSOR_LEFT_PTR; + const char *xcursor; + + switch (term->active_surface) { + case TERM_SURF_GRID: { + xcursor = seat->pointer.hidden ? XCURSOR_HIDDEN + : term->is_searching ? XCURSOR_LEFT_PTR + : (seat->mouse.col >= 0 && + seat->mouse.row >= 0 && + term_mouse_grabbed(term, seat)) ? XCURSOR_TEXT + : term->is_searching ? XCURSOR_TEXT + : XCURSOR_LEFT_PTR; + break; + } + case TERM_SURF_SEARCH: + case TERM_SURF_SCROLLBACK_INDICATOR: + case TERM_SURF_RENDER_TIMER: + case TERM_SURF_JUMP_LABEL: + case TERM_SURF_TITLE: + case TERM_SURF_BUTTON_MINIMIZE: + case TERM_SURF_BUTTON_MAXIMIZE: + case TERM_SURF_BUTTON_CLOSE: + xcursor = XCURSOR_LEFT_PTR; + break; + + case TERM_SURF_BORDER_LEFT: + case TERM_SURF_BORDER_RIGHT: + case TERM_SURF_BORDER_TOP: + case TERM_SURF_BORDER_BOTTOM: + xcursor = xcursor_for_csd_border(term, seat->mouse.x, seat->mouse.y); + break; + + case TERM_SURF_NONE: + default: + return; + } render_xcursor_set(seat, term, xcursor); } -- cgit v1.3 From bfbb4b08308f6deb872a19c19e8481a907347be4 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Tue, 30 Nov 2021 22:12:56 +0100 Subject: term: xcursor_update_for_seat(): remove switch default case Let the compiler catch missing enum values --- terminal.c | 1 - 1 file changed, 1 deletion(-) (limited to 'terminal.c') diff --git a/terminal.c b/terminal.c index 10211ca6..09c3ec73 100644 --- a/terminal.c +++ b/terminal.c @@ -2994,7 +2994,6 @@ term_xcursor_update_for_seat(struct terminal *term, struct seat *seat) break; case TERM_SURF_NONE: - default: return; } -- cgit v1.3 From 59e6285037cba04d0ffdcd77cd27bf8aaa59fe8c Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Tue, 30 Nov 2021 22:14:05 +0100 Subject: term: xcursor_update_for_seat(): remove duplicate check for term->is_searching --- terminal.c | 1 - 1 file changed, 1 deletion(-) (limited to 'terminal.c') diff --git a/terminal.c b/terminal.c index 09c3ec73..d65c0bd0 100644 --- a/terminal.c +++ b/terminal.c @@ -2971,7 +2971,6 @@ term_xcursor_update_for_seat(struct terminal *term, struct seat *seat) : (seat->mouse.col >= 0 && seat->mouse.row >= 0 && term_mouse_grabbed(term, seat)) ? XCURSOR_TEXT - : term->is_searching ? XCURSOR_TEXT : XCURSOR_LEFT_PTR; break; } -- cgit v1.3 From b3029234af2a0f4ff92947ec6d83581c26e6d3e9 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Tue, 30 Nov 2021 22:25:32 +0100 Subject: term: xcursor_update_for_seat(): BUG on xcursor == NULL --- terminal.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'terminal.c') diff --git a/terminal.c b/terminal.c index d65c0bd0..25310d36 100644 --- a/terminal.c +++ b/terminal.c @@ -2962,7 +2962,7 @@ term_mouse_motion(struct terminal *term, int button, int row, int col, void term_xcursor_update_for_seat(struct terminal *term, struct seat *seat) { - const char *xcursor; + const char *xcursor = NULL; switch (term->active_surface) { case TERM_SURF_GRID: { @@ -2996,6 +2996,9 @@ term_xcursor_update_for_seat(struct terminal *term, struct seat *seat) return; } + if (xcursor == NULL) + BUG("xcursor not set"); + render_xcursor_set(seat, term, xcursor); } -- cgit v1.3