diff options
| author | Daniel Eklöf <daniel@ekloef.se> | 2020-08-07 20:07:16 +0000 |
|---|---|---|
| committer | Daniel Eklöf <daniel@ekloef.se> | 2020-08-07 20:07:16 +0000 |
| commit | d49d1fd59dc7d67ee60e8ec7e95aa8d7200e2264 (patch) | |
| tree | 836fee726392fcd58b5038935c044d844da5f5a1 /input.c | |
| parent | input: mouse: motion/enter: cleanup inside/outside grid handling (diff) | |
input: scrolling: don't send events to client if cursor is outside grid
Diffstat (limited to 'input.c')
| -rw-r--r-- | input.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -1548,16 +1548,23 @@ mouse_scroll(struct seat *seat, int amount) keyboard_key(seat, NULL, seat->kbd.serial, 0, key - 8, XKB_KEY_DOWN); keyboard_key(seat, NULL, seat->kbd.serial, 0, key - 8, XKB_KEY_UP); } else { - if (!term_mouse_grabbed(term, seat)) { + if (!term_mouse_grabbed(term, seat) && + seat->mouse.col >= 0 && seat->mouse.row >= 0) + { + assert(seat->mouse.col < term->cols); + assert(seat->mouse.row < term->rows); + for (int i = 0; i < amount; i++) { term_mouse_down( term, button, seat->mouse.row, seat->mouse.col, seat->kbd.shift, seat->kbd.alt, seat->kbd.ctrl); } + term_mouse_up( term, button, seat->mouse.row, seat->mouse.col, seat->kbd.shift, seat->kbd.alt, seat->kbd.ctrl); } + scrollback(term, amount); } } |
