aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-08-07 20:07:16 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-08-07 20:07:16 +0000
commitd49d1fd59dc7d67ee60e8ec7e95aa8d7200e2264 (patch)
tree836fee726392fcd58b5038935c044d844da5f5a1
parentinput: mouse: motion/enter: cleanup inside/outside grid handling (diff)
input: scrolling: don't send events to client if cursor is outside grid
-rw-r--r--input.c9
1 files changed, 8 insertions, 1 deletions
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);
}
}