Ignore modifiers on release, to match i3 behaviour

Closes #6456.

The i3 window manager ignores modifiers when a button is being released.
Mimic this behaviour in Sway.
This commit is contained in:
k3d3 2021-10-17 18:11:30 -04:00
parent 119f31edb4
commit 2b5d8a0978
2 changed files with 2 additions and 2 deletions

View file

@ -159,7 +159,7 @@ static void get_active_binding(const struct sway_shortcut_state *state,
bool binding_inhibited = (binding->flags & BINDING_INHIBITED) != 0; bool binding_inhibited = (binding->flags & BINDING_INHIBITED) != 0;
bool binding_release = binding->flags & BINDING_RELEASE; bool binding_release = binding->flags & BINDING_RELEASE;
if (modifiers ^ binding->modifiers || if ((modifiers ^ binding->modifiers && !release) ||
release != binding_release || release != binding_release ||
locked > binding_locked || locked > binding_locked ||
inhibited > binding_inhibited || inhibited > binding_inhibited ||

View file

@ -124,7 +124,7 @@ static struct sway_binding* get_active_mouse_binding(
struct sway_binding *current = NULL; struct sway_binding *current = NULL;
for (int i = 0; i < bindings->length; ++i) { for (int i = 0; i < bindings->length; ++i) {
struct sway_binding *binding = bindings->items[i]; struct sway_binding *binding = bindings->items[i];
if (modifiers ^ binding->modifiers || if ((modifiers ^ binding->modifiers && !release) ||
e->pressed_button_count != (size_t)binding->keys->length || e->pressed_button_count != (size_t)binding->keys->length ||
release != (binding->flags & BINDING_RELEASE) || release != (binding->flags & BINDING_RELEASE) ||
!(click_region & binding->flags) || !(click_region & binding->flags) ||