From 3039ee97db5a14a71415848fc20e158d04fb8383 Mon Sep 17 00:00:00 2001 From: Stacy Harper Date: Fri, 7 Oct 2022 11:27:38 +0200 Subject: [PATCH] fix dangling pointer state on wayland With this new version, the pointer click doesnt select the highlighted element. To fix the issue we initialize correctly the bm_pointer struct. We also stop trying to use our pointer enums as bitflags with |= --- lib/renderers/wayland/wayland.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/renderers/wayland/wayland.c b/lib/renderers/wayland/wayland.c index f5bb33de..b8a5e215 100644 --- a/lib/renderers/wayland/wayland.c +++ b/lib/renderers/wayland/wayland.c @@ -248,7 +248,7 @@ poll_pointer(const struct bm_menu *menu) struct pointer_event *event = &input->pointer_event; assert(wayland && event); - struct bm_pointer bm_pointer; + struct bm_pointer bm_pointer = {0}; bm_pointer.event_mask = event->event_mask; bm_pointer.pos_x = wl_fixed_to_int(event->surface_x); @@ -270,10 +270,10 @@ poll_pointer(const struct bm_menu *menu) } if (event->state & WL_POINTER_BUTTON_STATE_PRESSED) { - bm_pointer.state |= POINTER_STATE_PRESSED; + bm_pointer.state = POINTER_STATE_PRESSED; } if (event->state & WL_POINTER_BUTTON_STATE_RELEASED) { - bm_pointer.state |= POINTER_STATE_RELEASED; + bm_pointer.state = POINTER_STATE_RELEASED; } memset(event, 0, sizeof(*event));