diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-08-08 08:00:18 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-08-08 08:00:18 +0000 |
| commit | 7497e448265c2924031f7e2feca7373a34578994 (patch) | |
| tree | 9429fa5384735aa1c92a7348e793de060e849130 | |
| parent | input: scrolling: don't send events to client if cursor is outside grid (diff) | |
input: motion: regression: check for RMB when updating selection
While refactoring this code, the check for LMB or RMB got changed to
LMB or "any button".
This fixes that.
It also adds a boolean 'cursor_is_on_grid', which should make the code
easier to read and understand.
| -rw-r--r-- | input.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -1247,17 +1247,19 @@ wl_pointer_motion(void *data, struct wl_pointer *wl_pointer, bool cursor_is_on_new_cell = old_col != seat->mouse.col || old_row != seat->mouse.row; + /* Cursor is inside the grid, or in the margins (or even + * outside the terminal window) */ + bool cursor_is_on_grid = seat->mouse.col >= 0 && seat->mouse.row >= 0; + /* Update selection */ - if (seat->mouse.button == BTN_LEFT || seat->mouse.button) { + if (seat->mouse.button == BTN_LEFT || seat->mouse.button == BTN_RIGHT) { if (cursor_is_on_new_cell || term->selection.end.row < 0) selection_update(term, selection_col, selection_row); } /* Send mouse event to client application */ if (!term_mouse_grabbed(term, seat) && - cursor_is_on_new_cell && - seat->mouse.col >= 0 && - seat->mouse.row >= 0) + cursor_is_on_new_cell && cursor_is_on_grid) { assert(seat->mouse.col < term->cols); assert(seat->mouse.row < term->rows); |
