diff options
author | Daniel Stone <daniel@fooishbar.org> | 2012-05-30 16:31:51 +0100 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-05-31 15:42:47 -0400 |
commit | 4dbadb1556f296cf148ed91a1044004ec6c80707 (patch) | |
tree | 1bc7caaadce31fca754d003c379b5b026c31d6e0 /clients/eventdemo.c | |
parent | 11d7139989860a1405124b889db2fbad087a5a09 (diff) |
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>
Diffstat (limited to 'clients/eventdemo.c')
-rw-r--r-- | clients/eventdemo.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/clients/eventdemo.c b/clients/eventdemo.c index 47815466..cb8cbbf6 100644 --- a/clients/eventdemo.c +++ b/clients/eventdemo.c @@ -210,7 +210,7 @@ key_handler(struct window *window, struct input *input, uint32_t time, */ static void 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) { int32_t x, y; @@ -218,8 +218,11 @@ button_handler(struct widget *widget, struct input *input, uint32_t time, return; input_get_position(input, &x, &y); - printf("button time: %d, button: %d, state: %d, x: %d, y: %d\n", - time, button, state, x, y); + printf("button time: %d, button: %d, state: %s, x: %d, y: %d\n", + time, button, + (state == WL_POINTER_BUTTON_STATE_PRESSED) ? "pressed" : + "released", + x, y); } /** |