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>
This commit is contained in:
committed by
Kristian Høgsberg
parent
11d7139989
commit
4dbadb1556
+3
-2
@@ -92,13 +92,14 @@ pointer_handle_motion(void *data, struct wl_pointer *pointer,
|
||||
static void
|
||||
pointer_handle_button(void *data, struct wl_pointer *pointer,
|
||||
uint32_t serial, uint32_t time, uint32_t button,
|
||||
uint32_t state)
|
||||
uint32_t state_w)
|
||||
{
|
||||
struct input *input = data;
|
||||
uint32_t bit;
|
||||
enum wl_pointer_button_state state = state_w;
|
||||
|
||||
bit = 1 << (button - BTN_LEFT);
|
||||
if (state)
|
||||
if (state == WL_POINTER_BUTTON_STATE_PRESSED)
|
||||
input->button_mask |= bit;
|
||||
else
|
||||
input->button_mask &= ~bit;
|
||||
|
||||
Reference in New Issue
Block a user