]> git.sur5r.net Git - i3/i3/commitdiff
Check for B_UPON_KEYRELEASE_IGNORE_MODS with bindsyms
authorOrestis Floros <orestisf1993@gmail.com>
Sat, 17 Mar 2018 21:28:23 +0000 (23:28 +0200)
committerOrestis Floros <orestisf1993@gmail.com>
Tue, 20 Mar 2018 02:00:47 +0000 (04:00 +0200)
From 548d74015c50d7fae14bfb8bb1989acde5fc22ae:
> 1. press $mod, press x, release x, release $mod
> 2. press $mod, press x, release $mod, release x

case (2.) didn't work, now it should be fixed.

src/bindings.c
testcases/t/258-keypress-release.t

index 9edc04dcfba94bf0723814f025c8a10437b7ccdf..823730ff6535055db757d575e282542ec1e2b493 100644 (file)
@@ -236,7 +236,8 @@ static Binding *get_binding(i3_event_state_mask_t state_filtered, bool is_releas
                 const bool mods_match = (modifiers_mask == modifiers_state);
                 DLOG("binding_keycode->modifiers = %d, modifiers_mask = %d, modifiers_state = %d, mods_match = %s\n",
                      binding_keycode->modifiers, modifiers_mask, modifiers_state, (mods_match ? "yes" : "no"));
-                if (binding_keycode->keycode == input_keycode && mods_match) {
+                if (binding_keycode->keycode == input_keycode &&
+                    (mods_match || (bind->release == B_UPON_KEYRELEASE_IGNORE_MODS && is_release))) {
                     found_keycode = true;
                     break;
                 }
index 8bca0d869996216c7aa4293e82703259841408bc..b92f723fda2926f64e54ef789192cefc1f6c990a 100644 (file)
@@ -29,6 +29,8 @@ bindsym --release Control+Print nop Control+Print
 # see issue #2442
 bindsym Mod1+b nop Mod1+b
 bindsym --release Mod1+Shift+b nop Mod1+Shift+b release
+
+bindsym --release Shift+x nop Shift+x
 EOT
 use i3test::XTEST;
 use ExtUtils::PkgConfig;
@@ -85,6 +87,29 @@ is(listen_for_binding(
     'Mod1+Shift+b release',
     'triggered the "Mod1+Shift+b" release keybinding');
 
+is(listen_for_binding(
+        sub {
+            xtest_key_press(50); # Shift
+            xtest_key_press(53); # x
+            xtest_key_release(53); # x
+            xtest_key_release(50); # Shift
+            xtest_sync_with_i3;
+        },
+        ),
+       'Shift+x',
+       'triggered the "Shift+x" keybinding by releasing x first');
+
+is(listen_for_binding(
+        sub {
+            xtest_key_press(50); # Shift
+            xtest_key_press(53); # x
+            xtest_key_release(50); # Shift
+            xtest_key_release(53);  # x
+            xtest_sync_with_i3;
+        },
+        ),
+       'Shift+x',
+       'triggered the "Shift+x" keybinding by releasing Shift first');
 }
 
 done_testing;