mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-22 05:33:45 -04:00
term: xcursor: use 'hand2' instead of 'left_ptr' when mouse tracking
Mouse tracking always reports clicks, so using a cursor that suggests you can click makes sense I think.
This commit is contained in:
parent
f41788c185
commit
bf9a9e7b90
2 changed files with 7 additions and 15 deletions
18
terminal.c
18
terminal.c
|
|
@ -1433,19 +1433,11 @@ term_mouse_motion(struct terminal *term, int button, int row, int col,
|
||||||
void
|
void
|
||||||
term_xcursor_update(struct terminal *term)
|
term_xcursor_update(struct terminal *term)
|
||||||
{
|
{
|
||||||
const bool no_mouse_tracking = term->mouse_tracking == MOUSE_NONE;
|
term->xcursor =
|
||||||
const bool is_searching = term->is_searching;
|
term->is_searching ? "left_ptr" :
|
||||||
const bool is_focused = term->wl->focused == term;
|
term->mouse_tracking == MOUSE_NONE ? "text" :
|
||||||
const bool forced_selection = is_focused && term->wl->kbd.shift;
|
term->wl->focused == term && term->wl->kbd.shift ? "text" :
|
||||||
|
"hand2";
|
||||||
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);
|
|
||||||
|
|
||||||
wayl_cursor_set(term->wl, term);
|
wayl_cursor_set(term->wl, term);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -141,9 +141,9 @@ struct charsets {
|
||||||
enum mouse_tracking {
|
enum mouse_tracking {
|
||||||
MOUSE_NONE,
|
MOUSE_NONE,
|
||||||
MOUSE_X10, /* ?9h */
|
MOUSE_X10, /* ?9h */
|
||||||
MOUSE_CLICK, /* ?1000h - report mouse clicks*/
|
MOUSE_CLICK, /* ?1000h - report mouse clicks */
|
||||||
MOUSE_DRAG, /* ?1002h - report clicks and drag motions */
|
MOUSE_DRAG, /* ?1002h - report clicks and drag motions */
|
||||||
MOUSE_MOTION, /* ?1003h - report clicks and motion*/
|
MOUSE_MOTION, /* ?1003h - report clicks and motion */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* *How* to report */
|
/* *How* to report */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue