Repository navigation
fix(compositor): Escape cancels a client drag, as Mutter's drag grab does (#655) - #675
Merged
Merged
Conversation
hanthor
force-pushed
the
fix/escape-cancels-client-drag
branch
from
October 15, 2026 12:43
41f06a4 to
80661d6
Compare
…does G-GRID-DRAG-CANCEL flaked with "cancelled folder drag changed the saved layout" (#655). The compositor consumed Escape to close the overview but left the shell's Wayland drag running. The proof's release right after Escape raced the shell hiding the grid: when the drop reached GTK first, the grid tile under the pointer took it and saved a reorder the user had cancelled (run 38518164407: the hover reflow fired, Escape closed the overview, a drop landed, layout saved). Mutter's drag grab cancels a client drag on Escape and consumes the key. Smithay 0.7.0 cannot cancel one: unsetting its DnDGrab runs the drop path, which still delivers wl_data_device.drop to an accepted offer. Port the cancel API from #654 to the vendored Smithay (client_dnd_active and cancel_client_dnd: mark the offer inactive under the grab lock, then unset, so the target gets leave, the source cancelled, and in-flight Accept/SetActions/Receive cannot revive it), documented in ROOST-PATCH.md with its isolated diff. The runtime cancels on an Escape press while a client drag holds the pointer or touch and consumes that press, its repeats and its release; plain Escape still closes the overview. The state file reports client_dnd_active. The proof now waits for the drag to hold the pointer, presses Escape, and requires the drag cancelled with the grid still open and the shell's hints gone before it releases the button. Fixes #655 Signed-off-by: James Reilly <jreilly1821@gmail.com>
hanthor
force-pushed
the
fix/escape-cancels-client-drag
branch
from
October 15, 2026 15:42
80661d6 to
7d71288
Compare
hanthor
added a commit
that referenced
this pull request
Oct 15, 2026
- runtime: main's Escape-cancels-drag matches this branch's own; keep ours plus main's lock reset of the held Escape and its docs. - notify: production new() applies GNOME's notification policy to the persisted center, then builds through the testable build(). - gtk-shell-proof: keep this branch's stricter grid-cancel gate (neutral point, frame and held-key baselines, ordinary Escape afterwards); main's G-NOTIFY-POLICY gate merges cleanly.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #655 (G-GRID-DRAG-CANCEL: "cancelled folder drag changed the saved layout").
Stacked on #674. This branch's base is
fix/grid-drag-page-flakes, whose proof helpers (a11y_until) and grid fixes it uses. Merge #674 first; GitHub then retargets this PR tomain.Failure history
The "changed the saved layout" mode on main-equivalent grid code, last 150 ci runs:
#655 counted about 5 in 20 runs earlier on 10-14, mixed with other failures. The remaining G-GRID-DRAG-CANCEL failures in the window ("GTK drag cleanup did not restore arrow before release", "native cancellation evidence…", 6 runs) came from Codex branches that carry #654's rewritten cancel proof, not main's.
Root cause
Runtime::on_manager_input(crates/compositor/src/runtime.rs:1230-1241on main) consumes Escape to close the overview but leaves the shell's Wayland drag running. The proof sendskey Escapeand thenmouseup. The overview close travels the control socket to the shell, which hides the grid. The release travels the DnD grab to the still-focused grid surface aswl_data_device.drop. When the drop reaches GTK first, the tile under the pointer takes it:on_drop→reorder→GridReflow::commit(crates/shell-gtk/src/overview.rs:642-653), which saves the reorder that the hover reflow had only previewed. In run 38518164407'snested.logthe hover timer fires, Escape closes the overview, and the layout ends up saved.GNOME behaves differently. Mutter's drag grab cancels a client drag on Escape and consumes the key, so the overview stays open and nothing can drop.
Fix
DnDGrabruns its drop path. This PR ports v1: integrate latest proof candidate and refresh app folders #654'sclient_dnd_active/cancel_client_dnd. They mark the offer inactive under the grab lock, then unset the grab: the target getsleave, the source getscancelled, and Accept/SetActions/Receive requests already in flight cannot revive the offer. A dead origin or source also cancels, and the terminal path runs once. The patch is documented inthird-party/smithay/ROOST-PATCH.mdwith its isolated diff inDND-CANCEL-API-PATCH.diff.client_dnd_active.crates/compositor/tests/data_device.rscover pointer and touch drags, with and without an icon or a source, and a normal drop that still Receives and Finishes..client_dnd_activeand presses Escape. It then requiresclient_dnd_activefalse withoverview_open and overview_app_gridstill true, and polls the shell until its arrows are back and its hints are gone, all before releasing the button. The old "Escape may close the overview, reopen it" branch is removed.#654 carries the same Smithay/runtime hunks verbatim, so it should rebase cleanly over this. One difference: #654's own flake, "GTK drag cleanup did not restore arrow before release", is a proof race. It dumps AT-SPI once, right after
client_dnd_activeturns false, before GTK has processed the cancel. This proof polls instead.Validation
Exact-head reruns of
gtk-shellandjourneyare listed below as they finish.