aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-11-29 21:30:56 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-11-29 21:30:56 +0000
commitbf9a9e7b907d451b651ad78bf193cb8d66753f5a (patch)
treee17485d9f7f5c97350dc190e446e714da906681a
parentterm: xcursor cleanup (diff)
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.
-rw-r--r--terminal.c18
-rw-r--r--terminal.h4
2 files changed, 7 insertions, 15 deletions
diff --git a/terminal.c b/terminal.c
index 2b933fe6..14ee063c 100644
--- a/terminal.c
+++ b/terminal.c
@@ -1433,19 +1433,11 @@ 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 bool forced_selection = is_focused && term->wl->kbd.shift;
-
- 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 =
+ term->is_searching ? "left_ptr" :
+ term->mouse_tracking == MOUSE_NONE ? "text" :
+ term->wl->focused == term && term->wl->kbd.shift ? "text" :
+ "hand2";
wayl_cursor_set(term->wl, term);
}
diff --git a/terminal.h b/terminal.h
index 8e1ae4b7..a7fb2b06 100644
--- a/terminal.h
+++ b/terminal.h
@@ -141,9 +141,9 @@ struct charsets {
enum mouse_tracking {
MOUSE_NONE,
MOUSE_X10, /* ?9h */
- MOUSE_CLICK, /* ?1000h - report mouse clicks*/
+ MOUSE_CLICK, /* ?1000h - report mouse clicks */
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 */