Correctly handle bindings for the same mod key with and without --release
Before this commit, get_binding() exited on the first match without marking the rest --release bindings with B_UPON_KEYRELEASE_IGNORE_MODS. Similarly, once it found a --release binding during a KeyPress event it would stop searching for a matching key press binding. Example config, placing the --release line first will trigger the second problem: # i3 config file (v4) bindsym Super_L exec notify-send "press" # or # bindcode 133 exec notify-send "press" bindsym --release Super_L exec notify-send "release" # or # bindcode --release 133 exec notify-send "release" Fixes #2733
This commit is contained in:
@ -31,6 +31,11 @@ bindsym Mod1+b nop Mod1+b
|
||||
bindsym --release Mod1+Shift+b nop Mod1+Shift+b release
|
||||
|
||||
bindsym --release Shift+x nop Shift+x
|
||||
|
||||
# see issue #2733
|
||||
# 133 == Mod4
|
||||
bindcode 133 nop 133
|
||||
bindcode --release 133 nop 133 release
|
||||
EOT
|
||||
use i3test::XTEST;
|
||||
use ExtUtils::PkgConfig;
|
||||
@ -110,6 +115,25 @@ is(listen_for_binding(
|
||||
),
|
||||
'Shift+x',
|
||||
'triggered the "Shift+x" keybinding by releasing Shift first');
|
||||
|
||||
is(listen_for_binding(
|
||||
sub {
|
||||
xtest_key_press(133);
|
||||
xtest_sync_with_i3;
|
||||
},
|
||||
),
|
||||
'133',
|
||||
'triggered the 133 keycode press binding');
|
||||
|
||||
is(listen_for_binding(
|
||||
sub {
|
||||
xtest_key_release(133);
|
||||
xtest_sync_with_i3;
|
||||
},
|
||||
),
|
||||
'133 release',
|
||||
'triggered the 133 keycode release binding');
|
||||
|
||||
}
|
||||
|
||||
done_testing;
|
||||
|
Reference in New Issue
Block a user