Skip to content

fix(shell): prevent background stealing pointer grab during bar move (#16341) - #16409

Open
hari45wavin wants to merge 1 commit into
omacom:quattrofrom
hari45wavin:fix/16341-bar-drag-over-background
Open

hari45wavin wants to merge 1 commit into
omacom:quattrofrom
hari45wavin:fix/16341-bar-drag-over-background

Conversation

@hari45wavin

Copy link
Copy Markdown

Summary

Fixes #16341.

When moving the bar between screen edges, CenterGestureArea begins a bar move and tracks the pointer across the screen to compute the nearest target edge (nearestScreenEdge).

When dragging across a desktop still wallpaper (such as custom wallpapers set by Aether or themes without video backgrounds), moving outside the 33px boundary of BarPanel entered the background layershell window. Background.qml maintained an active fullscreen MouseArea accepting Qt.LeftButton without input region masking, causing the background surface to intercept/steal the pointer grab and trigger onCanceled on CenterGestureArea, aborting the bar relocation.

Changes

  1. Bar Gesture Grab Retention: Set preventStealing: true on CenterGestureArea (and modulePointer in ModuleSlot) in shell/plugins/bar/Bar.qml so active drags are preserved across layers.
  2. Background Mask & MouseArea Release: In shell/plugins/background/Background.qml, dynamically mask the background PanelWindow input region to empty (mask: Region { item: (root.barMoveActive || root.barDragActive) ? null : bgMouseArea }) and disable bgMouseArea while a bar move or widget drag is in progress.
  3. Regression Tests: Added test assertions in test/shell.d/bar-test.sh and test/shell.d/background-test.sh verifying input region mask release and preventStealing grab retention.

Testing

  • ./test/shell.d/bar-drag-test.sh: Passed (headless quickshell integration)
  • ./test/shell.d/bar-test.sh: Passed (82 assertions)
  • ./test/shell.d/background-test.sh: Passed (16 assertions)
  • Full bar & background test suite: Passed
  • ./test/cli: Passed (132/132 tests)

…macom#16341)

When dragging the menu bar across the screen to change its edge,
the pointer enters the background layershell surface. Background.qml
kept a fullscreen MouseArea enabled without masking its input region,
which intercepted the active grab and triggered onCanceled on
CenterGestureArea.

Set preventStealing on CenterGestureArea and release the background
window's input mask and MouseArea while bar move or widget drag is
active.

Fixes omacom#16341
@greptile-apps

greptile-apps Bot commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 4/5

[Medium impact] The change affects pointer input during bar moves and widget drags.

The runtime changes have no established defect, but the new tests must meet the repository's explicit requirements before merging.

Findings

  1. P2 Tests repeat the implementation ▶

Summary

This PR keeps the bar's pointer grab and releases background input while the user moves the bar or drags a widget.

  • Bar moves and widget drags keep the pointer across wallpaper backgrounds.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[User starts a bar move or widget drag] --> B[Bar keeps the pointer grab]
  A --> C[Background reads active drag state]
  C --> D[Background disables its MouseArea]
  C --> E[Background clears its input region]
  F[User releases or cancels] --> G[Bar clears drag state]
  G --> H[Background accepts clicks again]
Loading

Reviews (1) · Last reviewed commit: "fix(shell): prevent background stealing ..." · Reviewed by Greptile

Comment on lines +83 to +90
assert(
/mask:\s*Region\s*\{\s*item:\s*\(root\.barMoveActive \|\| root\.barDragActive\) \? null : bgMouseArea\s*\}/.test(backgroundQml),
'background panel window releases input mask when bar drag or move is active'
)
assert(
/enabled:\s*!root\.barMoveActive && !root\.barDragActive/.test(backgroundQml),
'background mouse area disables while bar drag or move is active'
)

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.

P2 Tests repeat the implementation

These assertions only search for the new QML bindings. They never start a drag or check whether the background stops receiving input, so broken state bindings can still pass. The new check in test/shell.d/bar-test.sh does the same for preventStealing.

This violates the contributor directive, “Don't restate the implementation.” Before merging, remove these checks or replace them with a test that starts a drag and checks the resulting input state.

File Used: AGENTS.md (source)

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@omarchybot omarchybot added the bug Something isn't working label Oct 23, 2026
@omarchybot

Copy link
Copy Markdown
Collaborator

Thanks for working on this. I ran it on a disposable VM built from the Omarchy ISO, and it doesn't fix the drag yet.

What was run. The worker served this branch's tree (db59e06) on a 1280×800 Hyprland desktop with a stock still wallpaper. A virtual mouse pressed the bar at (300, 13), held it for 600 ms, dragged to the left edge and released. To see how the gesture ended, I added temporary logging to CenterGestureArea and beginBarMove/finishBarMove/clearBarMove, on the worker only. I ran the same steps with Bar.qml and Background.qml at quattro (967bbdd).

empty desktop a window open
quattro 3 of 3 stay on top moves to the left
this branch 3 of 3 stay on top moves to the left

What it shows. On an empty desktop the bar gets onReleased the moment the pointer leaves the 26 px strip, even though the button is still held. So finishBarMove() runs with the candidate still top. onCanceled never fires. With the wallpaper's input region emptied the result is the same: once the pointer leaves the bar's surface over bare desktop, the bar loses the drag, whether or not the wallpaper accepts input. This is the bug in #11915 ("Dragging the bar only works when there is at least 1 window"). A stock still wallpaper does it too, so #16341 looks like the same bug rather than something specific to Aether wallpapers.

Smaller points, from reading the code:

  • preventStealing (shell/plugins/bar/Bar.qml:2092, :2654) only stops other items in the same Qt Quick window from taking the grab, such as a parent Flickable. The wallpaper is a separate layer-shell window, so these two lines can't affect it.
  • The new assertions in test/shell.d/background-test.sh and test/shell.d/bar-test.sh only check that the new lines are present. The repository's AGENTS.md asks for tests that fail without the fix and pass with it, as Greptile's review comment also says.

Second opinion. Codex Medium and muse-spark 1.3 (high thinking) compared this pull request with #12646. Neither had seen the worker result. Codex judged the input-mask approach plausible and preferred it. muse-spark judged that emptying the wallpaper's input region can't deliver the motion or the release back to the bar, which is what the worker showed. Both made the preventStealing and test points above. They can read this session's notes, so their agreement there is not independent.

What happens next. #12646 is an older open fix for the same bug. It keeps the gesture alive by growing the moving bar's surface to cover the screen for the drag. It conflicts with quattro right now and will be reviewed as its own item. I haven't changed anything on this branch. Which fix goes forward is up to the maintainer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Drag/drop menu bar does not work when dragging over custom wallpaper (set in aether)

2 participants