mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-04 01:40:21 -05:00
term: mouse reporting functions no longer take modifier state
The mouse reporting functions are called from input when we receive Wayland mouse events. We used to pass the current keyboard modifier (shift, alt, ctrl, etc) to the terminal functions. This however is wrong, since we may receive Wayland mouse events without having keyboard focus. When we don't have keyboard focus, the modifier state doesn't apply to us. Remove the modifier arguments from the terminal mouse reporting functions. These functions now read this state directly instead, but only when the terminal instance in question has keyboard focus.
This commit is contained in:
parent
2208f4304b
commit
fbeb1e9610
3 changed files with 26 additions and 20 deletions
12
input.c
12
input.c
|
|
@ -521,8 +521,7 @@ wl_pointer_motion(void *data, struct wl_pointer *wl_pointer,
|
|||
selection_update(term, col, row);
|
||||
|
||||
term_mouse_motion(
|
||||
term, wayl->mouse.button, wayl->mouse.row, wayl->mouse.col,
|
||||
wayl->kbd.shift, wayl->kbd.alt, wayl->kbd.ctrl);
|
||||
term, wayl->mouse.button, wayl->mouse.row, wayl->mouse.col);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -594,8 +593,7 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
|
|||
wayl->mouse.button = button; /* For motion events */
|
||||
wayl->mouse.last_button = button;
|
||||
wayl->mouse.last_time = now;
|
||||
term_mouse_down(term, button, wayl->mouse.row, wayl->mouse.col,
|
||||
wayl->kbd.shift, wayl->kbd.alt, wayl->kbd.ctrl);
|
||||
term_mouse_down(term, button, wayl->mouse.row, wayl->mouse.col);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -606,8 +604,7 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
|
|||
selection_finalize(term, serial);
|
||||
|
||||
wayl->mouse.button = 0; /* For motion events */
|
||||
term_mouse_up(term, button, wayl->mouse.row, wayl->mouse.col,
|
||||
wayl->kbd.shift, wayl->kbd.alt, wayl->kbd.ctrl);
|
||||
term_mouse_up(term, button, wayl->mouse.row, wayl->mouse.col);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -648,8 +645,7 @@ mouse_scroll(struct wayland *wayl, int amount)
|
|||
keyboard_key(wayl, NULL, wayl->input_serial, 0, key - 8, XKB_KEY_UP);
|
||||
} else {
|
||||
for (int i = 0; i < amount; i++)
|
||||
term_mouse_down(term, button, wayl->mouse.row, wayl->mouse.col,
|
||||
wayl->kbd.shift, wayl->kbd.alt, wayl->kbd.ctrl);
|
||||
term_mouse_down(term, button, wayl->mouse.row, wayl->mouse.col);
|
||||
|
||||
scrollback(term, amount);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue