Skip to content

qt: a held finger is a right-click; every right-click menu answers it - #2129

Merged
trissim merged 2 commits into
mainfrom
qt-long-press-right-click
Nov 18, 2026
Merged

trissim merged 2 commits into
mainfrom
qt-long-press-right-click

Conversation

@trissim

@trissim trissim commented Nov 18, 2026

Copy link
Copy Markdown

Tristan, on Android: "long press on items that can be right clicked should do right click."

Built by the long-press fork before the weekly limit stopped it. I rebased it onto main, resolved two import-only conflicts in tools/qt_drive.py, and ran the gates on the rebased head.

Change

  • toad/qt/finger_press.py: one application-level classifier decides what a press is (a tap, a held finger, or the start of a drag), using the shared toad.pointer_gesture states with the platform's drag distance and press-and-hold interval.
    • A finger held still is a right-click: the widget under it gets the QContextMenuEvent a right button would send, so every context menu answers a held finger with no code of its own.
    • A press that moves first is a drag.
    • A press released before either is a tap, delivered before the widget's own click so a consumer may claim it.
  • Removed: the two per-widget guesses (the sidebar tree's and the history's TapAndHold gestures).
  • Rows: the sidebar and the thread pane's Comms rows get their menus through it.

Gates (on aa5c676, rebased onto 72e409c)

  • Ratchet and shadow_check at baseline.
  • Live-bus drives, each on its own config and state: hold (a hold opens the menu, and its release does not click the row: sidebar row, thread line, Comms panel), arrival, history, participants, composer, tabs, frame, sticky, menu, tall_arrival, menu_text. All exit 0.
  • check.sh with PYTHONFAULTHANDLER=1: exit 0, no fatal or traceback lines. The real toad.json was untouched.

🤖 Generated with Claude Code

https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3

FingerPress (toad/qt/finger_press.py) classifies each press once, at its
QWindow, through the shared toad.pointer_gesture states, which now include a
hold (GestureControl.held, Gesture.held, HELD / UNANSWERED_HOLD,
Gesture.takes_pointer). The thresholds are the platform's startDragDistance and
mousePressAndHoldInterval:
- tapped(Press): released before a drag or a hold, emitted before the release
  reaches the widget; Press.claim() ends the press without the widget's click.
- long_pressed(Press): a finger held still. The widget under it gets the
  QContextMenuEvent a right button sends, and it accepted the event. The rest of
  the press is swallowed and the release cancelled.
- drag_started(Press): moved past the drag distance; the moves stay the widget's.

This replaces the history's and the welcome tree's TapAndHoldGesture copies,
SwallowsRelease, and the history's press/release tap check (its link taps now
consume tapped). It also adds the qt_drive `hold` scenario (work in progress).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
…ms rows get theirs

- FingerPress no longer replaces the window's release. A held or claimed
  press's release passes through the window, so Qt's own pointer record stays
  true; only the widget it reaches gets it far off itself (no click, its press
  ends). Replacing the window's release had left Qt routing the next
  right-click to the top-level window, so no menu opened. A held press's moves
  are kept from the widget the same way.
- HeldRowMenu serves any tree of conversation rows. The app's sidebar gets its
  row menu (Open / Copy name) on a right-click or a hold, as every Textual
  sidebar row has one; on main only the welcome's rows had it.
- The thread pane's Comms rows open on a tap and offer Open / Copy on a
  right-click or a hold, as Textual's RelationshipRow does. entry_target moves
  to the shared toad.client.relationship_row_menu, so both frontends open a
  relationship the same way.
- qt_drive `hold`: real touch through the window (each commit made from a Qt
  timer slot, outside the scenario's task), the phone's touch-as-mouse
  gesture, and a mouse right-click through the window to compare against.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RnH6dT7wdh7i4tjJZQdFu3
@trissim
trissim merged commit 11422fa into main Nov 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants