Stop the bar sticking in move mode after a press-and-hold on a widget (#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 <noreply@anthropic.com>
This commit is contained in:
David Heinemeier Hansson
2026-08-15 17:01:03 +02:00
committed by GitHub
co-authored by Claude Opus 5
parent 1c3da94906
commit c0a20e2e43
2 changed files with 14 additions and 0 deletions
+3
View File
@@ -1417,6 +1417,9 @@ Item {
}
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
startDrag(mouse.x, mouse.y)
}
+11
View File
@@ -14,6 +14,17 @@ if rg -q 'barMoveSettling|barMoveSettleTimer' "$ROOT/shell/plugins/bar/Bar.qml";
fi
pass "bar move outline has no post-release settling state"
# A widget above the gesture area propagates its composed press-and-hold down
# without handing over the grab, so the resulting move gets neither a release
# nor a cancel and the ghost stays up for the session. Only the grabbing area
# reports pressed, which is what separates the two, so the guard has to stay
# ahead of the drag.
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
pass "bar move ignores a press-and-hold propagated from a widget above"
run_node_test <<'JS'
const fs = require('fs')
const bar = requireFromRoot('shell/plugins/bar/BarModel.js')