input: kitty: update to latest version of the spec

Starting with kitty 0.32.0, the modifier bits during modifier key
events behave differently, compared to before. Or, rather, they have
now been spec:ed; before, behavior was different on e.g. MacOS, and
Linux.

The new behavior is this:

On key press, the modifier bits in the kitty key event *includes* the
pressed modifier key.

On key release, the modifier bits in the kitty key event does *not*
include the released modifier key.

In other words, The modifier bits reflects the state *after* the key
event.

This is the exact opposite of what foot did before this patch.

The patch is really pretty small: in order to include the key in the
modifier set, we simulate a key press to update the XKB state, using
xkb_state_uppate_key(). For key pressed, we simulate an XKB_KEY_DOWN
event, and for key releases we simulate an XKB_KEY_UP event.

Then we re-retrieve the modifers, both the full set, and the consumed
set.

Closes #1561
This commit is contained in:
Daniel Eklöf 2024-01-22 16:39:26 +01:00
parent 6ed1c28d2c
commit 4ee4f47065
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
2 changed files with 71 additions and 14 deletions

View file

@ -65,9 +65,14 @@
process. This ensures the terminal itself does not "lock" a
directory; for example, preventing a mount point from being
unmounted ([#1528][1528]).
* Kitty keyboard protocol: updated behavior of modifiers bits during
modifier key events, to match the (new [#6913][kitty-6913]) behavior
in kitty >= 0.32.0 ([#1561][1561]).
[1526]: https://codeberg.org/dnkl/foot/issues/1526
[1528]: https://codeberg.org/dnkl/foot/issues/1528
[1561]: https://codeberg.org/dnkl/foot/issues/1561
[kitty-6913]: https://github.com/kovidgoyal/kitty/issues/6913
### Deprecated