aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2022-04-23 13:54:37 +0000
committerDaniel Eklöf <daniel@ekloef.se>2022-04-24 18:18:51 +0000
commita26eb1ea09b9a3c49cb664937c736915e2ab07ee (patch)
tree61909fa58b4544b38bcc096a7ec9e3280eb58a80
parentselection: assert serial is non-zero before copying data to the clipboard (diff)
input: assert serial received from compositor is non-zero
-rw-r--r--input.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/input.c b/input.c
index be495066..961b73ba 100644
--- a/input.c
+++ b/input.c
@@ -500,6 +500,7 @@ keyboard_enter(void *data, struct wl_keyboard *wl_keyboard, uint32_t serial,
struct wl_surface *surface, struct wl_array *keys)
{
xassert(surface != NULL);
+ xassert(serial != 0);
struct seat *seat = data;
struct wl_window *win = wl_surface_get_user_data(surface);
@@ -1269,6 +1270,8 @@ static void
key_press_release(struct seat *seat, struct terminal *term, uint32_t serial,
uint32_t key, uint32_t state)
{
+ xassert(serial != 0);
+
seat->kbd.serial = serial;
if (seat->kbd.xkb == NULL ||
seat->kbd.xkb_keymap == NULL ||
@@ -1621,6 +1624,7 @@ wl_pointer_enter(void *data, struct wl_pointer *wl_pointer,
wl_fixed_t surface_x, wl_fixed_t surface_y)
{
xassert(surface != NULL);
+ xassert(serial != 0);
if (surface == NULL) {
/* Seen on mutter-3.38 */
@@ -1984,6 +1988,8 @@ wl_pointer_button(void *data, struct wl_pointer *wl_pointer,
LOG_DBG("BUTTON: pointer=%p, serial=%u, button=%x, state=%u",
(void *)wl_pointer, serial, button, state);
+ xassert(serial != 0);
+
struct seat *seat = data;
struct wayland *wayl = seat->wayl;
struct terminal *term = seat->mouse_focus;