From 2b5d8a0978766763ee6b7596c97ea8fd13d30af8 Mon Sep 17 00:00:00 2001 From: k3d3 Date: Sun, 17 Oct 2021 18:11:30 -0400 Subject: [PATCH] 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. --- sway/input/keyboard.c | 2 +- sway/input/seatop_default.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sway/input/keyboard.c b/sway/input/keyboard.c index f258ac7d..a772cec1 100644 --- a/sway/input/keyboard.c +++ b/sway/input/keyboard.c @@ -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_release = binding->flags & BINDING_RELEASE; - if (modifiers ^ binding->modifiers || + if ((modifiers ^ binding->modifiers && !release) || release != binding_release || locked > binding_locked || inhibited > binding_inhibited || diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c index 4320a3b4..0c1524b8 100644 --- a/sway/input/seatop_default.c +++ b/sway/input/seatop_default.c @@ -124,7 +124,7 @@ static struct sway_binding* get_active_mouse_binding( struct sway_binding *current = NULL; for (int i = 0; i < bindings->length; ++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 || release != (binding->flags & BINDING_RELEASE) || !(click_region & binding->flags) ||