mirror of
https://github.com/swaywm/sway.git
synced 2025-11-12 13:29:56 -05:00
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.
This commit is contained in:
parent
754372c3de
commit
94dd8823a0
5 changed files with 140 additions and 28 deletions
|
|
@ -497,6 +497,8 @@ void free_sway_binding(struct sway_binding *sb);
|
|||
|
||||
struct sway_binding *sway_binding_dup(struct sway_binding *sb);
|
||||
|
||||
void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding);
|
||||
|
||||
void load_swaybars();
|
||||
|
||||
void invoke_swaybar(struct bar_config *bar);
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@
|
|||
#include <stdint.h>
|
||||
#include "sway/input/seat.h"
|
||||
|
||||
#define SWAY_CURSOR_PRESSED_BUTTONS_CAP 32
|
||||
|
||||
struct sway_cursor {
|
||||
struct sway_seat *seat;
|
||||
struct wlr_cursor *cursor;
|
||||
|
|
@ -29,6 +31,10 @@ struct sway_cursor {
|
|||
uint32_t tool_buttons;
|
||||
|
||||
struct wl_listener request_set_cursor;
|
||||
|
||||
// Mouse binding state
|
||||
uint32_t pressed_buttons[SWAY_CURSOR_PRESSED_BUTTONS_CAP];
|
||||
size_t pressed_button_count;
|
||||
};
|
||||
|
||||
void sway_cursor_destroy(struct sway_cursor *cursor);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue