Repository navigation
Stop the bar sticking in move mode after a press-and-hold on a widget - #6943
Conversation
There was a problem hiding this comment.
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.
| 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 |
There was a problem hiding this comment.
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"
fiIt 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]>
1cbd5ff to
bca2ba4
Compare
There was a problem hiding this comment.
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
pressedreference beforestartDrag, 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)' \
…#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)
…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]>
modulePointersetspropagateComposedEvents: trueand has noonPressAndHold, so Qt propagates the composed event down toCenterGestureAreawithout ever handing over the grab. The gesture area starts a bar move, then receives neitheronReleasednoronCanceled— the only two callers offinishBarMove()/clearBarMove()— sobarMoveActiveis 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:
The leaked event arrives with
pressed=falseand is followed by no release or cancel on that area, so guarding ongestureArea.pressedrejects exactly the bad case and leaves a genuine press-and-hold untouched. Guarding here is better than clearing the state frommodulePointer.onReleased, which would start the spurious move and then paper over it.One correction to the report: the trigger is ~800ms, not 200ms.
pressAndHoldInterval: 200belongs toCenterGestureArea, 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