From d49d1fd59dc7d67ee60e8ec7e95aa8d7200e2264 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Fri, 7 Aug 2020 22:07:16 +0200 Subject: [PATCH] input: scrolling: don't send events to client if cursor is outside grid --- input.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/input.c b/input.c index 8db6a1f6..8eca83bd 100644 --- a/input.c +++ b/input.c @@ -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); } }