From fbeb1e96103681b6a3fac49443e64ed13ae28737 Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sat, 30 Nov 2019 17:11:00 +0100 Subject: 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. --- input.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'input.c') diff --git a/input.c b/input.c index f51d2152..84a2f2e3 100644 --- a/input.c +++ b/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); } -- cgit v1.3