Skip to content

Stop the bar sticking in move mode after a press-and-hold on a widget - #6943

Merged
dhh merged 1 commit into
quattrofrom
fix-bar-move-stuck
Aug 15, 2026
Merged

dhh merged 1 commit into
quattrofrom
fix-bar-move-stuck

Conversation

@dhh

@dhh dhh commented Aug 15, 2026

Copy link
Copy Markdown
Contributor

modulePointer sets propagateComposedEvents: true and has no onPressAndHold, so Qt propagates the composed event down to CenterGestureArea without ever handing over the grab. The gesture area starts a bar move, then receives neither onReleased nor onCanceled — the only two callers of finishBarMove()/clearBarMove() — so barMoveActive is never cleared and the move ghost stays on screen for the rest of the session.

The two paths are cleanly distinguishable, confirmed with a two-MouseArea reproduction under Qt 6.11:

propagated from a widget above: ["inner.pressed", "outer.pressAndHold pressed=false", "inner.released"]
genuine hold on the gesture area: ["outer.pressed", "outer.pressAndHold pressed=true", "outer.released"]

The leaked event arrives with pressed=false and is followed by no release or cancel on that area, so guarding on gestureArea.pressed rejects exactly the bad case and leaves a genuine press-and-hold untouched. Guarding here is better than clearing the state from modulePointer.onReleased, which would start the spurious move and then paper over it.

One correction to the report: the trigger is ~800ms, not 200ms. pressAndHoldInterval: 200 belongs to CenterGestureArea, but the timer runs on the grabbing area, which uses Qt's default. Measured 300ms and 600ms holds do not leak; 900ms and 1200ms do.

Closes #6881

— 🤖 Claude, posting on behalf of @dhh

Copilot AI balanced review requested due to automatic review settings August 15, 2026 09:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Prevents propagated widget holds from leaving the bar permanently in move mode.

Changes:

  • Ignores press-and-hold events when the gesture area does not own the press.

Tip

If you aren't ready for review, convert to a draft PR.
Click "Convert to draft" or run gh pr ready --undo.
Click "Ready for review" or run gh pr ready to reengage.


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread shell/plugins/bar/Bar.qml
onPressAndHold: function(mouse) {
// A widget above us propagates its composed press-and-hold down here without
// ever handing over the grab, so we'd get no release or cancel to end the move.
if (!gestureArea.pressed) return

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added, in the source-assertion style the rest of this file uses (bar-test.sh has no QML runtime — the Node tests there run against BarModel.js, and the Bar.qml checks are all perl/rg over the source):

if ! perl -0ne 'exit(/onPressAndHold:\s*function[^{]*\{[^}]*?\bpressed\b[^}]*?\bstartDrag\b/s ? 0 : 1)' \
  "$ROOT/shell/plugins/bar/Bar.qml"; then
  fail "bar move ignores a press-and-hold the gesture area does not hold the press for"
fi

It asserts the guard is still ahead of the drag, and I checked it fails when the guard line is deleted rather than passing silently.

Worth being clear about what this does and does not cover: it pins the guard against removal, but it cannot re-derive the Qt invariant behind it. That part I verified separately with qmltestrunner under Qt 6.11 using a two-MouseArea reproduction — a propagated hold arrives pressed=false with no release, a genuine hold arrives pressed=true. Making that a permanent test would mean pulling a Qt runtime into ./test/shell, which is deliberately Qt-free today, so I left it out rather than change that on my own.

— 🤖 Claude, posting on behalf of @dhh

Bar widgets propagate their composed press-and-hold down to the center gesture
area without handing over the grab, so the gesture area started a bar move and
then received neither a release nor a cancel to end it. The move ghost stayed on
screen for the rest of the session. Ignore the gesture unless we hold the press.

Closes #6881

Co-Authored-By: Claude Opus 5 <[email protected]>
Copilot AI review requested due to automatic review settings August 15, 2026 14:17
@dhh
dhh force-pushed the fix-bar-move-stuck branch from 1cbd5ff to bca2ba4 Compare August 15, 2026 14:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (1)

test/shell.d/bar-test.sh:23

  • This regression check only requires any pressed reference before startDrag, so it still passes if the guard is inverted (for example, if (gestureArea.pressed) return) or merely reads/logs the property. Since either change restores or breaks genuine press-and-hold behavior, assert the actual negated early-return condition.
if ! perl -0ne 'exit(/onPressAndHold:\s*function[^{]*\{[^}]*?\bpressed\b[^}]*?\bstartDrag\b/s ? 0 : 1)' \

@dhh
dhh merged commit c0a20e2 into quattro Aug 15, 2026
4 checks passed
dhh added a commit that referenced this pull request Aug 23, 2026
…#6943)

Bar widgets propagate their composed press-and-hold down to the center gesture
area without handing over the grab, so the gesture area started a bar move and
then received neither a release nor a cancel to end it. The move ghost stayed on
screen for the rest of the session. Ignore the gesture unless we hold the press.

Closes #6881

Co-authored-by: Claude Opus 5 <[email protected]>
(cherry picked from commit c0a20e2)
@dhh dhh mentioned this pull request Aug 23, 2026
nick1udwig pushed a commit to nick1udwig/omarchy that referenced this pull request Sep 9, 2026
…omacom#6943)

Bar widgets propagate their composed press-and-hold down to the center gesture
area without handing over the grab, so the gesture area started a bar move and
then received neither a release nor a cancel to end it. The move ghost stayed on
screen for the rest of the session. Ignore the gesture unless we hold the press.

Closes omacom#6881

Co-authored-by: Claude Opus 5 <[email protected]>
@emirb emirb added this to the 4.5 milestone Oct 17, 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.

Bar stuck in "move bar" mode: press-and-hold on a center widget leaks omarchy-bar-move-ghost for the rest of the session

3 participants