diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2019-11-29 21:15:03 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2019-11-29 21:15:03 +0000 |
| commit | f41788c185d9fb5335fe1f3f191900db5e0792eb (patch) | |
| tree | 372e7b34e81e6ce81e3874c515a159c1955055c3 | |
| parent | input: pointer-leave: reset moused *before* doing anything else (diff) | |
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.
| -rw-r--r-- | terminal.c | 15 |
1 files changed, 11 insertions, 4 deletions
@@ -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); } |
