Skip to content

Commit

Permalink
fix dangling pointer state on wayland
Browse files Browse the repository at this point in the history
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 |=
  • Loading branch information
Stacy Harper authored and Cloudef committed Oct 9, 2022
1 parent e5adf18 commit 3039ee9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/renderers/wayland/wayland.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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));
Expand Down

0 comments on commit 3039ee9

Please sign in to comment.