From f8da14eed5a4cf2826ba96ca9ff5f3b8ef83b78a Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Tue, 2 Feb 2021 09:51:22 +0100 Subject: term: term_mouse_grabbed: return true if mouse tracking is disabled --- terminal.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'terminal.c') diff --git a/terminal.c b/terminal.c index 6f8130fa..7b0ba599 100644 --- a/terminal.c +++ b/terminal.c @@ -2431,9 +2431,10 @@ term_mouse_grabbed(const struct terminal *term, struct seat *seat) /* * Mouse is grabbed by us, regardless of whether mouse tracking has been enabled or not. */ - return seat->kbd_focus == term && - seat->kbd.shift && - !seat->kbd.alt && /*!seat->kbd.ctrl &&*/ !seat->kbd.meta; + return term->mouse_tracking == MOUSE_NONE || + (seat->kbd_focus == term && + seat->kbd.shift && + !seat->kbd.alt && /*!seat->kbd.ctrl &&*/ !seat->kbd.meta); } void -- cgit v1.3 From eff8481cdc6c37407faaa3167ea6f6897b12f544 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Tue, 2 Feb 2021 09:52:22 +0100 Subject: selection: remove selection_enabled() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Its name did not reflect its semantics. Since it was only used in a single place, “inline” it there, and get rid of it. --- selection.c | 10 ---------- selection.h | 1 - terminal.c | 5 ++++- 3 files changed, 4 insertions(+), 12 deletions(-) (limited to 'terminal.c') diff --git a/selection.c b/selection.c index e9c3fce6..90c6c392 100644 --- a/selection.c +++ b/selection.c @@ -33,16 +33,6 @@ static const char *const mime_type_map[] = { [DATA_OFFER_MIME_URI_LIST] = "text/uri-list", }; -bool -selection_enabled(const struct terminal *term, struct seat *seat) -{ - return - seat->mouse.col >= 0 && seat->mouse.row >= 0 && - (term->mouse_tracking == MOUSE_NONE || - term_mouse_grabbed(term, seat) || - term->is_searching); -} - bool selection_on_rows(const struct terminal *term, int row_start, int row_end) { diff --git a/selection.h b/selection.h index aa027d3e..241ec262 100644 --- a/selection.h +++ b/selection.h @@ -8,7 +8,6 @@ extern const struct wl_data_device_listener data_device_listener; extern const struct zwp_primary_selection_device_v1_listener primary_selection_device_listener; -bool selection_enabled(const struct terminal *term, struct seat *seat); void selection_start( struct terminal *term, int col, int row, enum selection_kind new_kind, bool spaces_only); diff --git a/terminal.c b/terminal.c index 7b0ba599..701313cc 100644 --- a/terminal.c +++ b/terminal.c @@ -2570,7 +2570,10 @@ 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 - : selection_enabled(term, seat) ? XCURSOR_TEXT + : (seat->mouse.col >= 0 && + seat->mouse.row >= 0 && + term_mouse_grabbed(term, seat)) ? XCURSOR_TEXT + : term->is_searching ? XCURSOR_TEXT : XCURSOR_LEFT_PTR; render_xcursor_set(seat, term, xcursor); -- cgit v1.3