diff options
author | frsfnrrg <frsfnrrg@users.noreply.github.com> | 2018-07-23 21:38:29 -0400 |
---|---|---|
committer | frsfnrrg <frsfnrrg@users.noreply.github.com> | 2018-07-23 21:38:29 -0400 |
commit | 94dd8823a0081f7983dce368d5d093d1d3eeaefe (patch) | |
tree | f2147f1ef4871edb4d989d26cd9b1104797d27bc /include | |
parent | Parse mouse binding options (diff) | |
download | sway-94dd8823a0081f7983dce368d5d093d1d3eeaefe.tar.gz sway-94dd8823a0081f7983dce368d5d093d1d3eeaefe.tar.zst sway-94dd8823a0081f7983dce368d5d093d1d3eeaefe.zip |
Invoke mouse bindings
The mouse binding logic is inspired/copied from the
keyboard binding logic; we store a sorted list of the
currently pressed buttons, and trigger a binding when
the currently pressed (or just recently pressed, in
the case of a release binding) buttons, as well as
modifiers/container region, match those of a given
binding.
As the code to execute a binding is not very keyboard
specific, keyboard_execute_command is renamed to
seat_execute_command and moved to where the other
binding handling functions are. The call to
transaction_commit_dirty has been lifted out.
Diffstat (limited to 'include')
-rw-r--r-- | include/sway/config.h | 2 | ||||
-rw-r--r-- | include/sway/input/cursor.h | 6 |
2 files changed, 8 insertions, 0 deletions
diff --git a/include/sway/config.h b/include/sway/config.h index 92536d10..bcd503a4 100644 --- a/include/sway/config.h +++ b/include/sway/config.h | |||
@@ -497,6 +497,8 @@ void free_sway_binding(struct sway_binding *sb); | |||
497 | 497 | ||
498 | struct sway_binding *sway_binding_dup(struct sway_binding *sb); | 498 | struct sway_binding *sway_binding_dup(struct sway_binding *sb); |
499 | 499 | ||
500 | void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding); | ||
501 | |||
500 | void load_swaybars(); | 502 | void load_swaybars(); |
501 | 503 | ||
502 | void invoke_swaybar(struct bar_config *bar); | 504 | void invoke_swaybar(struct bar_config *bar); |
diff --git a/include/sway/input/cursor.h b/include/sway/input/cursor.h index b0a3a7c5..7ec45120 100644 --- a/include/sway/input/cursor.h +++ b/include/sway/input/cursor.h | |||
@@ -3,6 +3,8 @@ | |||
3 | #include <stdint.h> | 3 | #include <stdint.h> |
4 | #include "sway/input/seat.h" | 4 | #include "sway/input/seat.h" |
5 | 5 | ||
6 | #define SWAY_CURSOR_PRESSED_BUTTONS_CAP 32 | ||
7 | |||
6 | struct sway_cursor { | 8 | struct sway_cursor { |
7 | struct sway_seat *seat; | 9 | struct sway_seat *seat; |
8 | struct wlr_cursor *cursor; | 10 | struct wlr_cursor *cursor; |
@@ -29,6 +31,10 @@ struct sway_cursor { | |||
29 | uint32_t tool_buttons; | 31 | uint32_t tool_buttons; |
30 | 32 | ||
31 | struct wl_listener request_set_cursor; | 33 | struct wl_listener request_set_cursor; |
34 | |||
35 | // Mouse binding state | ||
36 | uint32_t pressed_buttons[SWAY_CURSOR_PRESSED_BUTTONS_CAP]; | ||
37 | size_t pressed_button_count; | ||
32 | }; | 38 | }; |
33 | 39 | ||
34 | void sway_cursor_destroy(struct sway_cursor *cursor); | 40 | void sway_cursor_destroy(struct sway_cursor *cursor); |