We were consuming key events and committing the text of the key
directly, which breaks clients that expect or require actual key events.
Instead, we still consume the key event (to prevent key repeat during
long-press timer), but we send a synthetic key press and release to the
client that matches the key that was pressed.
BUG: 519339
BUG: 521128
BUG: 521718
BUG: 521772
BUG: 521789
BUG: 521872
BUG: 522024
BUG: 522152
BUG: 522167
CCBUG: 521825
CCBUG: 521902
FIXED-IN: 6.7.2
Resolves: https://invent.kde.org/plasma/plasma-keyboard/-/work_items/71
When the diacritics long-press overlay is enabled, we were previously
disabling key repeat for the base character to prevent the base
character from being repeated while waiting for the overlay to trigger/a
choice to be selected.
A recent change to fix injected keys (e.g. from a password manager)
not arriving in the correct order extended this repeat-blocking behavior
to all keys that produce commit text:
https://invent.kde.org/plasma/plasma-keyboard/-/merge_requests/131 —
this additionally broke key repeat for spacebar.
This change ensures that all keys that produce commit text (including
space) are still committed via commit_string for ordering consistency
(e.g. password manager injection), while also simulating key repeat for
_both_ diacritic and non-diacritic keys via the controller's internal
timer so that auto-repeat behavior is retained even while the raw key
events are consumed and don't reach the client.
We were trying to track the compose state ourselves while still passing
the keys through to the compositor, but this is problematic because some
applications/toolkits (for example Signal, Telegram, and Chromium have
been identified) will send a surrounding_text changed event for the
compose/dead key (to e.g. visually show a change), but this
surrounding_text change event caused our tracking to think the compose
sequence was finished or cancelled, aborting the sequence and breaking
the compose/dead key handling.
Instead we use the actual xkbcommon state machine to keep track of the
compose state (which makes better sense than trying to implement our
own), and do not pass such compose keys through to the compositor at
all; thus we don't have to worry about misbehaving applications/toolkits
sending unexpected events that break the key handling.
Tests for both dead keys and compose sequences have been added.
BUG: 518141
BUG: 519339
BUG: 520410
BUG: 520344
QStandardPaths::setTestModeEnabled & setting the HOME var were fighting
each other, and the child process only inherits the HOME var. Now they
both see the same temp directory as HOME.
This also fixes the test incorrectly expecting "á" instead of "à" for
the long press of "a" with the it_IT locale; now the test is correct.
Creates a QtWayland Compositor-based test that runs plasma-keyboard and
interacts with it and sees that it behaves as expected.
Current test is very bare but can be improved as needed.