Apply numlock fallback to bindcode where necessary (#2781)

This was broken with commit d77d40173a

fixes #2559
This commit is contained in:
Michael Stapelberg
2017-05-22 21:32:05 +02:00
committed by GitHub
parent 5fc00e2d18
commit 36f80f2de8
2 changed files with 132 additions and 29 deletions

View File

@ -44,6 +44,9 @@ bindsym Shift+Escape nop Shift+Escape
# Binding which should work with numlock and without, see issue #2418.
bindsym Mod1+Shift+q nop Mod1+Shift+q
# Binding which should work with numlock and without, see issue #2559.
bindcode 39 nop s
EOT
my $pid = launch_with_config($config);
@ -159,7 +162,6 @@ is(listen_for_binding(
'Mod1+Shift+q',
'triggered the "Mod1+Shift+q" keybinding');
is(listen_for_binding(
sub {
xtest_key_press(77); # enable Num_Lock
@ -177,8 +179,30 @@ is(listen_for_binding(
'Mod1+Shift+q',
'triggered the "Mod1+Shift+q" keybinding');
is(listen_for_binding(
sub {
xtest_key_press(39); # s
xtest_key_release(39); # s
},
),
's',
'triggered the "s" keybinding without Num_Lock');
is(listen_for_binding(
sub {
xtest_key_press(77); # enable Num_Lock
xtest_key_release(77); # enable Num_Lock
xtest_key_press(39); # s
xtest_key_release(39); # s
xtest_key_press(77); # disable Num_Lock
xtest_key_release(77); # disable Num_Lock
},
),
's',
'triggered the "s" keybinding with Num_Lock');
sync_with_i3;
is(scalar @i3test::XTEST::binding_events, 10, 'Received exactly 10 binding events');
is(scalar @i3test::XTEST::binding_events, 12, 'Received exactly 12 binding events');
exit_gracefully($pid);
@ -191,6 +215,7 @@ $config = <<EOT;
font -misc-fixed-medium-r-normal--13-120-75-75-C-70-iso10646-1
bindsym KP_End nop KP_End
bindcode 88 nop KP_Down
EOT
$pid = launch_with_config($config);
@ -206,6 +231,15 @@ is(listen_for_binding(
'KP_End',
'triggered the "KP_End" keybinding');
is(listen_for_binding(
sub {
xtest_key_press(88); # KP_Down
xtest_key_release(88); # KP_Down
},
),
'KP_Down',
'triggered the "KP_Down" keybinding');
is(listen_for_binding(
sub {
xtest_key_press(77); # enable Num_Lock
@ -219,10 +253,23 @@ is(listen_for_binding(
'timeout',
'Did not trigger the KP_End keybinding with KP_1');
is(listen_for_binding(
sub {
xtest_key_press(77); # enable Num_Lock
xtest_key_release(77); # enable Num_Lock
xtest_key_press(88); # KP_2
xtest_key_release(88); # KP_2
xtest_key_press(77); # disable Num_Lock
xtest_key_release(77); # disable Num_Lock
},
),
'timeout',
'Did not trigger the KP_Down keybinding with KP_2');
# TODO: This test does not verify that i3 does _NOT_ grab keycode 87 with Mod2.
sync_with_i3;
is(scalar @i3test::XTEST::binding_events, 11, 'Received exactly 11 binding events');
is(scalar @i3test::XTEST::binding_events, 14, 'Received exactly 14 binding events');
exit_gracefully($pid);