mirror of
https://github.com/swaywm/sway.git
synced 2025-11-16 06:59:49 -05:00
Change mouse buttons to x11 map and libevdev names
This modifies the way mouse bindings are parsed. Instead of adding to BTN_LEFT, which results in button numbers that may not be expected, buttons will be parsed in one of the following ways: 1. `button[1-9]` will now map to their x11 equivalents. This is already the case for bar bindings. This adds support for binding to axis events, which was not possible in the previous approach. 2. Anything that starts with `BTN_` will be parsed as an event code name using `libevdev_event_code_from_name`. This allows for any button to be mapped to instead of limiting usage to the ones near BTN_LEFT. This also adds a dependency on libevdev, but since libevdev is already a dependency of libinput, this should be fine. If needed, this option can have dependency guards added. Binding changes: - button1: BTN_LEFT -> BTN_LEFT - button2: BTN_RIGHT -> BTN_MIDDLE - button3: BTN_MIDDLE -> BTN_RIGHT - button4: BTN_SIDE -> SWAY_SCROLL_UP - button5: BTN_EXTRA -> SWAY_SCROLL_DOWN - button6: BTN_FORWARD -> SWAY_SCROLL_LEFT - button7: BTN_BACK -> SWAY_SCROLL_RIGHT - button8: BTN_TASK -> BTN_SIDE - button9: BTN_JOYSTICK -> BTN_EXTRA Since the axis events need to be mapped to an event code, this uses the following mappings to avoid any conflicts: - SWAY_SCROLL_UP: KEY_MAX + 1 - SWAY_SCROLL_DOWN: KEY_MAX + 2 - SWAY_SCROLL_LEFT: KEY_MAX + 3 - SWAY_SCROLL_RIGHT: KEY_MAX + 4
This commit is contained in:
parent
00d97cb195
commit
a223030b70
6 changed files with 89 additions and 9 deletions
|
|
@ -5,6 +5,11 @@
|
|||
|
||||
#define SWAY_CURSOR_PRESSED_BUTTONS_CAP 32
|
||||
|
||||
#define SWAY_SCROLL_UP KEY_MAX + 1
|
||||
#define SWAY_SCROLL_DOWN KEY_MAX + 2
|
||||
#define SWAY_SCROLL_LEFT KEY_MAX + 3
|
||||
#define SWAY_SCROLL_RIGHT KEY_MAX + 4
|
||||
|
||||
struct sway_cursor {
|
||||
struct sway_seat *seat;
|
||||
struct wlr_cursor *cursor;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue