mirror of
https://github.com/swaywm/sway.git
synced 2025-11-17 06:59:48 -05:00
Parse mouse binding options
First, the existing sway_binding structure is given an enumerated type code. As all flags to bindsym/bindcode are boolean, a single uint32 is used to hold all flags. The _BORDER, _CONTENTS, _TITLEBAR flags, when active, indicate in which part of a container the binding can trigger; to localize complexity, they do not overlap with the command line arguments, which center around _TITLEBAR being set by default. The keyboard handling code is adjusted for this change, as is binding_key_compare; note that BINDING_LOCKED is *not* part of the key portion of the binding. Next, list of mouse bindings is introduced and cleaned up. Finally, the binding command parsing code is extended to handle the case where bindsym is used to describe a mouse binding rather than a keysym binding; the difference between the two may be detected as late as when the first key/button is parsed, or as early as the first flag. As bindings can have multiple keycodes/keysyms/buttons, mixed keysym/button sequences are prohibited.
This commit is contained in:
parent
224ade1382
commit
754372c3de
4 changed files with 134 additions and 52 deletions
|
|
@ -88,11 +88,13 @@ static void get_active_binding(const struct sway_shortcut_state *state,
|
|||
uint32_t modifiers, bool release, bool locked) {
|
||||
for (int i = 0; i < bindings->length; ++i) {
|
||||
struct sway_binding *binding = bindings->items[i];
|
||||
bool binding_locked = binding->flags | BINDING_LOCKED;
|
||||
bool binding_release = binding->flags | BINDING_RELEASE;
|
||||
|
||||
if (modifiers ^ binding->modifiers ||
|
||||
state->npressed != (size_t)binding->keys->length ||
|
||||
locked > binding->locked ||
|
||||
release != binding->release) {
|
||||
release != binding_release ||
|
||||
locked > binding_locked) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue