Slide sideways on space to move the cursor

As on phone keyboards: a sideways move on space moves the cursor right
away, along the line only, without blanking the keys. Long-press space
still opens the full trackpad.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-10-25 17:51:09 +01:00
co-authored by Claude Opus 5.5
parent b745e9da1b
commit 441c1d615b
5 changed files with 51 additions and 4 deletions
+11
View File
@@ -208,6 +208,17 @@ private Q_SLOTS:
QCOMPARE(engine.output, QString());
QCOMPARE(engine.keysyms, (QList<quint32>{XKB_KEY_Right, XKB_KEY_Right, XKB_KEY_Right}));
}
void spaceSlideMovesCursorAtOnce()
{
const QPoint space = keyCenter({}, u"space"_s);
QTest::touchEvent(&window, touchscreen).press(0, space);
QTest::touchEvent(&window, touchscreen).move(0, space - QPoint(30, 0));
QVERIFY(!qobject_cast<KeyboardSurface *>(keyboard)->isTrackpadActive()); // keys keep their labels
QTest::touchEvent(&window, touchscreen).release(0, space - QPoint(30, 0));
QCOMPARE(engine.output, QString());
QCOMPARE(engine.keysyms, (QList<quint32>{XKB_KEY_Left, XKB_KEY_Left}));
}
};
QTEST_MAIN(TestKeyboardSurface)
+27
View File
@@ -111,6 +111,33 @@ private Q_SLOTS:
QCOMPARE(t.takeTrackpadSteps(), QPoint(-3, -1));
}
void spaceSlideSidewaysMovesAlongTheLine()
{
PointerTracker t(ofType(KeyType::Space), {100, 0}, config());
t.moveTo({112, 5});
QCOMPARE(t.gesture(), Gesture::Trackpad);
QCOMPARE(t.takeTrackpadSteps(), QPoint(1, 0)); // the slop counts
t.moveTo({75, -50});
QCOMPARE(t.takeTrackpadSteps(), QPoint(-3, 0)); // no line changes
QVERIFY(!t.longPressElapsed());
}
void spaceSlideVerticallyStaysTap()
{
PointerTracker t(ofType(KeyType::Space), {100, 0}, config());
t.moveTo({105, -20});
QCOMPARE(t.gesture(), Gesture::Tap);
}
void spaceSlideNeedsGestures()
{
PointerTracker::Config c = config();
c.gestures = false;
PointerTracker t(ofType(KeyType::Space), {100, 0}, c);
t.moveTo({140, 0});
QCOMPARE(t.gesture(), Gesture::Tap);
}
void layerKeySlides()
{
PointerTracker t(ofType(KeyType::LayerSwitch), {0, 0}, config());