Commit Graph

9 Commits (fe3d0b6752e743dde298ad97d5be5e57a00c0126)

Author SHA1 Message Date
Orestis Floros dc0337d2e5 Reset B_UPON_KEYRELEASE_IGNORE_MODS bindings when switching modes
With example config:
    mode "a_mode" {
        bindcode 27 --release mode "default"
    }
    bindsym $mod+r mode "a_mode"

The first time $mod+r is pressed "a_mode" is activated like normal. When
r (bindcode 27) is pressed to exit the mode:
- On the KeyPress event the corresponding bind->release is correctly
marked as B_UPON_KEYRELEASE_IGNORE_MODS.
- On the KeyRelease event the command 'mode "default"' is executed but
bind->release is still B_UPON_KEYRELEASE_IGNORE_MODS since they are only
reset on KeyPress events.
The second time $mod+r is pressed and "a_mode" is activated and when the
r key is released the 'mode "default"' is executed even though the mods
are not matching since bind->release == B_UPON_KEYRELEASE_IGNORE_MODS.

This still doesn't catch 2 cases:
1. When the order is: press $mod -> press r -> release $mod -> release
    r. Since 'r' is released without any modifiers the binding matches.
2. With:
        mode "resize" {
            bindsym --release r mode "default"
        }
        bindsym r mode "resize"
    This is arguably correct: on the KeyPress event we switch to the mode and
    on the KeyRelease we switch back.
2018-03-20 04:09:34 +02:00
Orestis Floros ff579ef22f 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
2018-03-20 04:09:25 +02:00
Orestis Floros 130b3ce3a9 Check for B_UPON_KEYRELEASE_IGNORE_MODS with bindsyms
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.
2018-03-20 04:00:47 +02:00
Michael Stapelberg ce21de8dde Implement the tick event
This makes our tests less flaky, shorter, and more readable.

fixes #2988
2017-09-30 11:41:57 +02:00
Michael Stapelberg 14c8cf8622 tests: implement xtest_sync_with_i3
The regular sync_with_i3 is not sufficient because i3test::XTEST uses a separate
X11 connection.
2017-09-30 11:28:20 +02:00
Michael Stapelberg 7ad32fd2d1 tests: replace http:// with https:// where appropriate
This was done automatically using:

% sed -i 's,http://build.i3wm.org,https://build.i3wm.org,g' testcases/t/*.t
2017-09-24 10:19:50 +02:00
Michael Stapelberg 02786155dc tests: use i3_config arg instead of precisely one launch_with_config
This way, tests are shorter, and i3test’s invocation of launch_with_config
parallelizes work better, using dont_block => 1.
2017-09-14 21:46:20 +02:00
Michael Stapelberg 2244c843a8 Bugfix: don’t trigger unrelated key bindings for --release bindings
fixes #2442
2016-09-12 12:57:13 +02:00
Michael Stapelberg 6a7f9370db Add i3test::XTEST, add 2 test cases for key bindings 2015-11-16 09:37:54 +01:00