summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar taiyu <taiyu.len@gmail.com>2015-08-19 15:44:13 -0700
committerLibravatar taiyu <taiyu.len@gmail.com>2015-08-19 15:44:13 -0700
commitb79a49a394ede1c07773dadab97b00a4c7b4d835 (patch)
tree90c19e5def9f37ec5c2f4a572d8be323a311835b
parentfixed active_workspace update on focus change (diff)
downloadsway-b79a49a394ede1c07773dadab97b00a4c7b4d835.tar.gz
sway-b79a49a394ede1c07773dadab97b00a4c7b4d835.tar.zst
sway-b79a49a394ede1c07773dadab97b00a4c7b4d835.zip
use enums for pointer click names
-rw-r--r--sway/handlers.c16
1 files 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
503 return false; 503 return false;
504} 504}
505 505
506enum pointer_values {
507 M_LEFT_CLICK = 272,
508 M_RIGHT_CLICK = 273,
509 M_SCROLL_CLICK = 274,
510 M_SCROLL_UP = 275,
511 M_SCROLL_DOWN = 276,
512};
513
506static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct wlc_modifiers *modifiers, 514static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct wlc_modifiers *modifiers,
507 uint32_t button, enum wlc_button_state state, const struct wlc_origin *origin) { 515 uint32_t button, enum wlc_button_state state, const struct wlc_origin *origin) {
508 swayc_t *focused = get_focused_container(&root_container); 516 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
512 } 520 }
513 if (state == WLC_BUTTON_STATE_PRESSED) { 521 if (state == WLC_BUTTON_STATE_PRESSED) {
514 sway_log(L_DEBUG, "Mouse button %u pressed", button); 522 sway_log(L_DEBUG, "Mouse button %u pressed", button);
515 if (button == 272) { 523 if (button == M_LEFT_CLICK) {
516 m1_held = true; 524 m1_held = true;
517 } 525 }
518 if (button == 273) { 526 if (button == M_RIGHT_CLICK) {
519 m2_held = true; 527 m2_held = true;
520 } 528 }
521 swayc_t *pointer = container_under_pointer(); 529 swayc_t *pointer = container_under_pointer();
@@ -547,11 +555,11 @@ static bool handle_pointer_button(wlc_handle view, uint32_t time, const struct w
547 return (pointer && pointer != focused); 555 return (pointer && pointer != focused);
548 } else { 556 } else {
549 sway_log(L_DEBUG, "Mouse button %u released", button); 557 sway_log(L_DEBUG, "Mouse button %u released", button);
550 if (button == 272) { 558 if (button == M_LEFT_CLICK) {
551 m1_held = false; 559 m1_held = false;
552 dragging = false; 560 dragging = false;
553 } 561 }
554 if (button == 273) { 562 if (button == M_RIGHT_CLICK) {
555 m2_held = false; 563 m2_held = false;
556 resizing = false; 564 resizing = false;
557 lock_top = lock_bottom = lock_left = lock_right = false; 565 lock_top = lock_bottom = lock_left = lock_right = false;