diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-08-07 17:59:03 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-08-07 17:59:03 +0000 |
| commit | 4178418010f571c3744129a3c294660e9019da0e (patch) | |
| tree | 108f75d71d6d020b1427204b709edcd7a4247ef9 /input.c | |
| parent | input: motion: do selection update even if cursor is outside the grid (diff) | |
input: button: button events aren't passed to clients, when cursor is outside grid
Don't send mouse button escapes to a mouse grabbing client when the
cursor is outside the grid (i.e. when it is inside the margins).
Also don't do *any* kind of selection when the cursor is outside the
grid. Previously, we only checked this for selection_start(), but
e.g. double clicking would run selection_extend(), or
selection_mark_word() etc.
Diffstat (limited to 'input.c')
| -rw-r--r-- | input.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -1410,19 +1410,19 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer, case TERM_SURF_GRID: { search_cancel(term); + bool cursor_is_on_grid = seat->mouse.col >= 0 && seat->mouse.row >= 0; + switch (state) { case WL_POINTER_BUTTON_STATE_PRESSED: { if (button == BTN_LEFT && seat->mouse.count <= 3) { selection_cancel(term); - if (selection_enabled(term, seat)) { + if (selection_enabled(term, seat) && cursor_is_on_grid) { switch (seat->mouse.count) { case 1: - if (seat->mouse.col >= 0 && seat->mouse.row >= 0) { - selection_start( - term, seat->mouse.col, seat->mouse.row, - seat->kbd.ctrl ? SELECTION_BLOCK : SELECTION_NORMAL); - } + selection_start( + term, seat->mouse.col, seat->mouse.row, + seat->kbd.ctrl ? SELECTION_BLOCK : SELECTION_NORMAL); break; case 2: @@ -1439,7 +1439,7 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer, } else if (button == BTN_RIGHT && seat->mouse.count == 1) { - if (selection_enabled(term, seat)) { + if (selection_enabled(term, seat) && cursor_is_on_grid) { selection_extend( seat, term, seat->mouse.col, seat->mouse.row, serial); } @@ -1464,7 +1464,7 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer, } } - if (!term_mouse_grabbed(term, seat)) { + if (!term_mouse_grabbed(term, seat) && cursor_is_on_grid) { term_mouse_down( term, button, seat->mouse.row, seat->mouse.col, seat->kbd.shift, seat->kbd.alt, seat->kbd.ctrl); @@ -1476,7 +1476,7 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer, if (button == BTN_LEFT && term->selection.end.col != -1) selection_finalize(seat, term, serial); - if (!term_mouse_grabbed(term, seat)) { + if (!term_mouse_grabbed(term, seat) && cursor_is_on_grid) { term_mouse_up( term, button, seat->mouse.row, seat->mouse.col, seat->kbd.shift, seat->kbd.alt, seat->kbd.ctrl); |
