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/src/shell.c b/src/shell.c
index fcac599..8f4822f 100644
--- a/src/shell.c
+++ b/src/shell.c
@@ -335,13 +335,15 @@
 
 static void
 move_grab_button(struct wl_pointer_grab *grab,
-		 uint32_t time, uint32_t button, uint32_t state)
+		 uint32_t time, uint32_t button, uint32_t state_w)
 {
 	struct shell_grab *shell_grab = container_of(grab, struct shell_grab,
 						    grab);
 	struct wl_pointer *pointer = grab->pointer;
+	enum wl_pointer_button_state state = state_w;
 
-	if (pointer->button_count == 0 && state == 0) {
+	if (pointer->button_count == 0 &&
+	    state == WL_POINTER_BUTTON_STATE_RELEASED) {
 		shell_grab_finish(shell_grab);
 		wl_pointer_end_grab(pointer);
 		free(grab);
@@ -608,12 +610,14 @@
 
 static void
 resize_grab_button(struct wl_pointer_grab *grab,
-		   uint32_t time, uint32_t button, uint32_t state)
+		   uint32_t time, uint32_t button, uint32_t state_w)
 {
 	struct weston_resize_grab *resize = (struct weston_resize_grab *) grab;
 	struct wl_pointer *pointer = grab->pointer;
+	enum wl_pointer_button_state state = state_w;
 
-	if (pointer->button_count == 0 && state == 0) {
+	if (pointer->button_count == 0 &&
+	    state == WL_POINTER_BUTTON_STATE_RELEASED) {
 		shell_grab_finish(&resize->base);
 		wl_pointer_end_grab(pointer);
 		free(grab);
@@ -1097,12 +1101,13 @@
 
 static void
 popup_grab_button(struct wl_pointer_grab *grab,
-		  uint32_t time, uint32_t button, uint32_t state)
+		  uint32_t time, uint32_t button, uint32_t state_w)
 {
 	struct wl_resource *resource;
 	struct shell_surface *shsurf =
 		container_of(grab, struct shell_surface, popup.grab);
 	struct wl_display *display;
+	enum wl_pointer_button_state state = state_w;
 	uint32_t serial;
 
 	resource = grab->pointer->focus_resource;
@@ -1110,7 +1115,7 @@
 		display = wl_client_get_display(resource->client);
 		serial = wl_display_get_serial(display);
 		wl_pointer_send_button(resource, serial, time, button, state);
-	} else if (state == 0 &&
+	} else if (state == WL_POINTER_BUTTON_STATE_RELEASED &&
 		   (shsurf->popup.initial_up ||
 		    time - shsurf->popup.seat->pointer->grab_time > 500)) {
 		wl_shell_surface_send_popup_done(&shsurf->resource);
@@ -1118,7 +1123,7 @@
 		shsurf->popup.grab.pointer = NULL;
 	}
 
-	if (state == 0)
+	if (state == WL_POINTER_BUTTON_STATE_RELEASED)
 		shsurf->popup.initial_up = 1;
 }
 
@@ -1776,14 +1781,16 @@
 
 static void
 rotate_grab_button(struct wl_pointer_grab *grab,
-		 uint32_t time, uint32_t button, uint32_t state)
+		 uint32_t time, uint32_t button, uint32_t state_w)
 {
 	struct rotate_grab *rotate =
 		container_of(grab, struct rotate_grab, base.grab);
 	struct wl_pointer *pointer = grab->pointer;
 	struct shell_surface *shsurf = rotate->base.shsurf;
+	enum wl_pointer_button_state state = state_w;
 
-	if (pointer->button_count == 0 && state == 0) {
+	if (pointer->button_count == 0 &&
+	    state == WL_POINTER_BUTTON_STATE_RELEASED) {
 		if (shsurf)
 			weston_matrix_multiply(&shsurf->rotation.rotation,
 					       &rotate->rotation);
@@ -1931,12 +1938,14 @@
 static void
 click_to_activate_binding(struct wl_seat *seat,
 			  uint32_t time, uint32_t key,
-			  uint32_t button, uint32_t axis, int32_t state, void *data)
+			  uint32_t button, uint32_t axis, int32_t state_w,
+			  void *data)
 {
 	struct weston_seat *ws = (struct weston_seat *) seat;
 	struct desktop_shell *shell = data;
 	struct weston_surface *focus;
 	struct weston_surface *upper;
+	enum wl_pointer_button_state state = state_w;
 
 	focus = (struct weston_surface *) seat->pointer->focus;
 	if (!focus)
@@ -1945,7 +1954,8 @@
 	if (is_black_surface(focus, &upper))
 		focus = upper;
 
-	if (state && seat->pointer->grab == &seat->pointer->default_grab)
+	if (state == WL_POINTER_BUTTON_STATE_PRESSED &&
+	    seat->pointer->grab == &seat->pointer->default_grab)
 		activate(shell, focus, ws);
 }