input: ignore release events after a keyboard shortcut was triggered

This fixes an issue with the kitty keyboard protocol, where 'release'
events associated with a shortcut was sent to the client application.

Example: user triggers "scroll up". We scroll up. No key event(s) are
sent to the client application. Then the user releases the keys. we
don't do any shortcut handling on release events, and so we continue
with the normal input processing. If the kitty keyboard protocol has
been enabled (and specifically, release event reporting has been
enabled), then we'll emit a 'release' escape sequence. This in itself
is wrong, since the client application never saw the corresponding
press event. But we _also_ reset the viewport. The effect (in this
example), is that it's impossible to scroll up in the scrollback
history.

Note that we don't ignore _any_ release event, only the release event
for the (final) symbol that triggered the shortcut.

This should allow e.g. modifier keys release events to be processed
normally, if released before the shortcut key.

This is somewhat important, since the client application will have
received press events for the modifier keys leading up to the
shortcut (if modifier press/release events have been enabled in the
kitty keyboard protocol - _Report all keys as escape codes_).

Closes #2257
This commit is contained in:
Daniel Eklöf 2026-01-10 07:36:17 +01:00
parent e2a989785a
commit 3a2eb80d83
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F
3 changed files with 29 additions and 0 deletions

View file

@ -151,6 +151,8 @@ struct seat {
bool alt;
bool ctrl;
bool super;
xkb_keysym_t last_shortcut_sym;
} kbd;
/* Pointer state */