diff options
author | Daniel Stone <daniel@fooishbar.org> | 2012-05-30 16:31:48 +0100 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-05-31 14:02:20 -0400 |
commit | 872d074a431a28ff5dcb09384d07970812432c82 (patch) | |
tree | 81a7c68cf9a480a682e002d829c31bf80dc811dc /src | |
parent | 9a1705c5f5e877d4e68bd0e7eb858f517375ba3f (diff) |
Add key_state and button_state enums
Rather than hardcoding 0 and 1 everywhere.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Diffstat (limited to 'src')
-rw-r--r-- | src/data-device.c | 9 | ||||
-rw-r--r-- | src/wayland-server.c | 8 |
2 files changed, 11 insertions, 6 deletions
diff --git a/src/data-device.c b/src/data-device.c index a6d465f..60e7578 100644 --- a/src/data-device.c +++ b/src/data-device.c @@ -260,15 +260,18 @@ data_device_end_drag_grab(struct wl_seat *seat) static void drag_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_seat *seat = container_of(grab, struct wl_seat, drag_grab); + enum wl_pointer_button_state state = state_w; if (seat->drag_focus_resource && - seat->pointer->grab_button == button && state == 0) + seat->pointer->grab_button == button && + state == WL_POINTER_BUTTON_STATE_RELEASED) wl_data_device_send_drop(seat->drag_focus_resource); - if (seat->pointer->button_count == 0 && state == 0) { + if (seat->pointer->button_count == 0 && + state == WL_POINTER_BUTTON_STATE_RELEASED) { data_device_end_drag_grab(seat); if (seat->drag_data_source) wl_list_remove(&seat->drag_data_source_listener.link); diff --git a/src/wayland-server.c b/src/wayland-server.c index 323d32d..ec0d0e8 100644 --- a/src/wayland-server.c +++ b/src/wayland-server.c @@ -493,19 +493,21 @@ default_grab_motion(struct wl_pointer_grab *grab, static void default_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_pointer *pointer = grab->pointer; struct wl_resource *resource; uint32_t serial; + enum wl_pointer_button_state state = state_w; resource = pointer->focus_resource; if (resource) { serial = wl_display_next_serial(resource->client->display); - wl_pointer_send_button(resource, serial, time, button, state); + wl_pointer_send_button(resource, serial, time, button, state_w); } - if (pointer->button_count == 0 && state == 0) + if (pointer->button_count == 0 && + state == WL_POINTER_BUTTON_STATE_RELEASED) wl_pointer_set_focus(pointer, pointer->current, pointer->current_x, pointer->current_y); } |