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
+9 -2
View File
@@ -26,8 +26,14 @@ void PointerTracker::moveTo(QPointF pos)
return;
m_moved = true;
if (m_key.type == KeyType::LayerSwitch)
if (m_key.type == KeyType::LayerSwitch) {
m_gesture = Gesture::Slide;
} else if (m_config.gestures && m_key.type == KeyType::Space && qAbs(delta.x()) > qAbs(delta.y())) {
// From the press point: the slop counts towards the first step.
m_gesture = Gesture::Trackpad;
m_trackpadOrigin = m_start;
m_trackpadLines = false;
}
else if (m_config.gestures && !m_key.flick.isEmpty() && delta.y() > qAbs(delta.x()))
m_gesture = Gesture::Flick;
}
@@ -63,7 +69,8 @@ QPoint PointerTracker::takeTrackpadSteps()
const QPointF travel = m_position - m_trackpadOrigin;
// Truncate towards zero so jitter around the origin doesn't step.
const QPoint total(int(travel.x() / m_config.trackpadStep), int(travel.y() / m_config.trackpadRowStep));
const int rows = m_trackpadLines ? int(travel.y() / m_config.trackpadRowStep) : 0;
const QPoint total(int(travel.x() / m_config.trackpadStep), rows);
const QPoint steps = total - m_trackpadStepsTaken;
m_trackpadStepsTaken = total;
return steps;
+3 -1
View File
@@ -11,7 +11,8 @@
// Tap pressed, not (yet) anything else
// Flick moved down on a key with a flick symbol
// LongPress held still on a key with alternates
// Trackpad held still on space; movement moves the text cursor
// Trackpad held still on space; movement moves the text cursor. Sliding
// sideways on space moves it too, along the line only.
// Slide moved off a layer key (type a symbol, then switch back)
class PointerTracker
{
@@ -56,5 +57,6 @@ private:
Gesture m_gesture = Gesture::Tap;
bool m_moved = false;
QPointF m_trackpadOrigin;
bool m_trackpadLines = true; // vertical travel moves between lines
QPoint m_trackpadStepsTaken;
};