Hold Keys mode: keys stay down while touched, like a hardware keyboard

- HardwareKeys presses a key's unshifted keysym on touch and releases it
  on lift, through fake input; held keys repeat and combine as on a
  physical keyboard (games, Shift+click)
- Shift/Ctrl/Alt/Super are plain held keys, caps lock is the system's,
  dead keys compose in the app
- No long-press, flick, trackpad or rollover in this mode; nothing is
  left held when the mode is turned off or touches are cancelled
- Settings switch; default stays the touch (virtual keyboard) mode

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-14 22:17:11 +02:00
co-authored by Claude Opus 5.5
parent f816135162
commit e02b1a8237
24 changed files with 319 additions and 6 deletions
+16
View File
@@ -135,6 +135,22 @@ private Q_SLOTS:
QCOMPARE(engine.output, u"as");
}
void holdKeysKeepsEveryFingerDown()
{
controller->setOptions({.holdKeys = true});
const QPoint w = keyCenter(u"w"_s), e = keyCenter(u"e"_s);
QTest::touchEvent(&window, touchscreen).press(0, w);
QTest::touchEvent(&window, touchscreen).stationary(0).press(1, e);
QTest::qWait(600); // past the long-press delay: e has accents, but no popup
QCOMPARE(engine.held, (QSet<quint32>{XKB_KEY_w, XKB_KEY_e}));
QTest::touchEvent(&window, touchscreen).release(0, w).stationary(1);
QCOMPARE(engine.held, QSet<quint32>{XKB_KEY_e});
QTest::touchEvent(&window, touchscreen).release(1, e);
QVERIFY(engine.held.isEmpty());
QVERIFY(engine.output.isEmpty()); // key events only, no text
controller->setOptions({});
}
void slideFromNumbersKeyTypesAndReturns()
{
const QPoint layerKey = keyCenter(u".?123"_s, u"layer"_s);