From b79a49a394ede1c07773dadab97b00a4c7b4d835 Mon Sep 17 00:00:00 2001 From: taiyu Date: Wed, 19 Aug 2015 15:44:13 -0700 Subject: use enums for pointer click names --- sway/handlers.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/sway/handlers.c b/sway/handlers.c index 24189003..a6dbf94c 100644 --- a/sway/handlers.c +++ b/sway/handlers.c @@ -503,6 +503,14 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct return false; } +enum pointer_values { + M_LEFT_CLICK = 272, + M_RIGHT_CLICK = 273, + M_SCROLL_CLICK = 274, + M_SCROLL_UP = 275, + M_SCROLL_DOWN = 276, +}; + static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct wlc_modifiers *modifiers, uint32_t button, enum wlc_button_state state, const struct wlc_origin *origin) { swayc_t *focused = get_focused_container(&root_container); @@ -512,10 +520,10 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w } if (state == WLC_BUTTON_STATE_PRESSED) { sway_log(L_DEBUG, "Mouse button %u pressed", button); - if (button == 272) { + if (button == M_LEFT_CLICK) { m1_held = true; } - if (button == 273) { + if (button == M_RIGHT_CLICK) { m2_held = true; } swayc_t *pointer = container_under_pointer(); @@ -547,11 +555,11 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w return (pointer && pointer != focused); } else { sway_log(L_DEBUG, "Mouse button %u released", button); - if (button == 272) { + if (button == M_LEFT_CLICK) { m1_held = false; dragging = false; } - if (button == 273) { + if (button == M_RIGHT_CLICK) { m2_held = false; resizing = false; lock_top = lock_bottom = lock_left = lock_right = false; -- cgit v1.2.3