aboutsummaryrefslogtreecommitdiff
path: root/input.c
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2019-11-30 16:11:00 +0000
committerDaniel Eklöf <daniel@ekloef.se>2019-11-30 16:11:00 +0000
commitfbeb1e96103681b6a3fac49443e64ed13ae28737 (patch)
tree9678d7f14ddc3bd542e7e84e1441748307bbf366 /input.c
parentterm: add term_mouse_grabbed() (diff)
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.
Diffstat (limited to 'input.c')
-rw-r--r--input.c12
1 files changed, 4 insertions, 8 deletions
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);
}