mirror of
https://github.com/swaywm/sway.git
synced 2024-11-10 20:44:01 +01:00
use enums for pointer click names
This commit is contained in:
parent
a31f23f90c
commit
b79a49a394
@ -503,6 +503,14 @@ static bool handle_pointer_motion(wlc_handle handle, uint32_t time, const struct
|
|||||||
return false;
|
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,
|
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) {
|
uint32_t button, enum wlc_button_state state, const struct wlc_origin *origin) {
|
||||||
swayc_t *focused = get_focused_container(&root_container);
|
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) {
|
if (state == WLC_BUTTON_STATE_PRESSED) {
|
||||||
sway_log(L_DEBUG, "Mouse button %u pressed", button);
|
sway_log(L_DEBUG, "Mouse button %u pressed", button);
|
||||||
if (button == 272) {
|
if (button == M_LEFT_CLICK) {
|
||||||
m1_held = true;
|
m1_held = true;
|
||||||
}
|
}
|
||||||
if (button == 273) {
|
if (button == M_RIGHT_CLICK) {
|
||||||
m2_held = true;
|
m2_held = true;
|
||||||
}
|
}
|
||||||
swayc_t *pointer = container_under_pointer();
|
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);
|
return (pointer && pointer != focused);
|
||||||
} else {
|
} else {
|
||||||
sway_log(L_DEBUG, "Mouse button %u released", button);
|
sway_log(L_DEBUG, "Mouse button %u released", button);
|
||||||
if (button == 272) {
|
if (button == M_LEFT_CLICK) {
|
||||||
m1_held = false;
|
m1_held = false;
|
||||||
dragging = false;
|
dragging = false;
|
||||||
}
|
}
|
||||||
if (button == 273) {
|
if (button == M_RIGHT_CLICK) {
|
||||||
m2_held = false;
|
m2_held = false;
|
||||||
resizing = false;
|
resizing = false;
|
||||||
lock_top = lock_bottom = lock_left = lock_right = false;
|
lock_top = lock_bottom = lock_left = lock_right = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user