Use enum wl_pointer_button_state instead of integer
Instead of using a uint32_t for state everywhere (except on the wire,
where that's still the call signature), use the new
wl_pointer_button_state enum, and explicit comparisons.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
diff --git a/clients/desktop-shell.c b/clients/desktop-shell.c
index 23a7f90..cceeadf 100644
--- a/clients/desktop-shell.c
+++ b/clients/desktop-shell.c
@@ -269,24 +269,26 @@
static void
panel_launcher_button_handler(struct widget *widget,
struct input *input, uint32_t time,
- uint32_t button, uint32_t state, void *data)
+ uint32_t button,
+ enum wl_pointer_button_state state, void *data)
{
struct panel_launcher *launcher;
launcher = widget_get_user_data(widget);
widget_schedule_redraw(widget);
- if (state == 0)
+ if (state == WL_POINTER_BUTTON_STATE_RELEASED)
panel_launcher_activate(launcher);
}
static void
panel_button_handler(struct widget *widget,
struct input *input, uint32_t time,
- uint32_t button, uint32_t state, void *data)
+ uint32_t button,
+ enum wl_pointer_button_state state, void *data)
{
struct panel *panel = data;
- if (button == BTN_RIGHT && state)
+ if (button == BTN_RIGHT && state == WL_POINTER_BUTTON_STATE_PRESSED)
show_menu(panel, input, time);
}
@@ -496,13 +498,15 @@
static void
unlock_dialog_button_handler(struct widget *widget,
struct input *input, uint32_t time,
- uint32_t button, uint32_t state, void *data)
+ uint32_t button,
+ enum wl_pointer_button_state state, void *data)
{
struct unlock_dialog *dialog = data;
struct desktop *desktop = dialog->desktop;
if (button == BTN_LEFT) {
- if (state == 0 && !dialog->closing) {
+ if (state == WL_POINTER_BUTTON_STATE_RELEASED &&
+ !dialog->closing) {
display_defer(desktop->display, &desktop->unlock_task);
dialog->closing = 1;
}