Wayland: implement drag and drop via wl_data_device#166
Open
DTW-Thalion wants to merge 1 commit into
Open
Conversation
The Wayland backend had no drag and drop support. Add WaylandDragView, a GSDragView subclass wired in as the server -dragInfo. The source side advertises the pasteboard through a wl_data_source and hands the drag to the compositor with wl_data_device_start_drag; the destination side turns the compositor wl_data_device enter/motion/drop events into the GSAppKitDragging events that NSWindow dispatches to the target view.
Contributor
Author
|
@fredkiefer, let this PR soak for a while. It's efffectively a new feature as it fills in functionality that was missing in Wayland to mirror what the x11 backend has to do drag and drop. I am not running on Wayland as a matter of course, so I tested it with a minimal Wayland setup and compositor. So this needs to be stress tested by those better setup than I. This was just an opportunity for me to try building it - so further testing required. |
This was referenced Jul 15, 2026
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.
Closes #72.
The Wayland backend had no drag and drop support.
-dragInfofell through to the baseGSDragView, whose client-driven tracking loop moves a drag window to follow the pointer and hit-tests other windows. That cannot work under Wayland, where the compositor owns the pointer during a drag and a client can neither see nor position other surfaces.This adds a
WaylandDragView(aGSDragViewsubclass) wired in as the server's-dragInfo, backed bywl_data_device. The source advertises the drag pasteboard through awl_data_sourceand callswl_data_device_start_drag, then runs a modal loop until the compositor concludes the drag. The destination turns the compositor'swl_data_deviceenter/motion/drop events into theGSAppKitDraggingevents thatNSWindowdispatches to the target view, using the drag view as theNSDraggingInfo.Depends on #165; without that fix the drag aborts as soon as the compositor takes the pointer.
Two limitations are left for follow-ups: no drag icon surface is attached yet, so the compositor shows no drag image, and a drop originating in another client is not yet read into an
NSPasteboard. Same-process drags work.