input: scrolling: don't send events to client if cursor is outside grid

This commit is contained in:
Daniel Eklöf 2020-08-07 22:07:16 +02:00
parent 76c3629cbf
commit d49d1fd59d
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

View file

@ -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);
}
}