mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-07 04:06:07 -05:00
term: xcursor cleanup
Show 'text' cursor when: * we have no mouse tracking enabled * forced selection has been enabled (shift being held down) * We're *not* scrollback searching In all other cases, show the 'left_ptr' cursor.
This commit is contained in:
parent
2c12549f93
commit
f41788c185
1 changed files with 11 additions and 4 deletions
15
terminal.c
15
terminal.c
|
|
@ -1433,13 +1433,20 @@ term_mouse_motion(struct terminal *term, int button, int row, int col,
|
|||
void
|
||||
term_xcursor_update(struct terminal *term)
|
||||
{
|
||||
const bool no_mouse_tracking = term->mouse_tracking == MOUSE_NONE;
|
||||
const bool is_searching = term->is_searching;
|
||||
const bool is_focused = term->wl->focused == term;
|
||||
const char *new_cursor =
|
||||
is_focused && selection_enabled(term) ? "text" : "left_ptr";
|
||||
const bool forced_selection = is_focused && term->wl->kbd.shift;
|
||||
|
||||
LOG_DBG("setting xcursor to '%s' for term=%p", new_cursor, term);
|
||||
term->xcursor = (no_mouse_tracking || forced_selection) && !is_searching
|
||||
? "text" : "left_ptr";
|
||||
|
||||
LOG_DBG(
|
||||
"setting xcursor to '%s' for term=%p "
|
||||
"(is_focused=%d, tracking=%d, shift=%d, searching=%d)",
|
||||
term->xcursor, term, is_focused, term->mouse_tracking,
|
||||
term->wl->kbd.shift, is_searching);
|
||||
|
||||
term->xcursor = new_cursor;
|
||||
wayl_cursor_set(term->wl, term);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue