-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Fix/drag and drop on linux #19232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Fix/drag and drop on linux #19232
Conversation
You can test this PR using the following package version. |
|
@cla-avalonia agree |
Thank you for your contribution! :) I haven't reviewed the code yet, but we're currently in the process of refactoring the clipboard and drag and drop architecture. Consequently, your PR will be on hold until that work is completed and will very likely need modifications to accommodate the new types. |
@MrJul Ok, but there a no much usage of Avalonia's inner DragNDrop system, mostly implementations of lots and lots of X11 requests |
IDataObject can be queried for data at any stage ( DragEnter, DragOver, DragDrop, DragLeave) for any of the supported types, apps are allowed to inspect dragged contents to decide if they support the dragged data. This behavior is actually described by XDND spec too:
The PR only loads data for only one random data type after getting the final drop event. So the implementation is incorrect. |
@kekekeks Changed it. |
You can test this PR using the following package version. |
This is technically incorrect too. The dragged data could be a 8K image that is presented in multiple compressed and uncompressed formats. Transferring all of that via INCR's window of 16KB will take hours. |
e. g. dragging image from firefox produces the following formats:
|
What does the pull request do?
Added realisation of XDnD protocol for X11 on Linux.
What is the current behavior?
There are no Drag and Drop between Avalonia window and other apps on Linux systems with X11 and Wayland-X11 mode.
What is the updated/expected behavior with this PR?
Avalonia app can receive dropped uri and text data and initiate drag for those datas on Linux (if under X11 server).
Avalonia app can receive/transmit other X11's mime types, if app's devs support them.
How was the solution implemented (if it's not obvious)?
To X11Window added helper instance of X11DropTarget, which process XDnD messages and request data according specifications. X11DropTarget works as mid-level between X11 and InputRoot system.
To X11Platform added X11DragSource (similar as OLE implementation). On drag X11DragSource creates instance of DragSourceWindow, an invisible window, which process pointer movements and sends XDnD messages to windows under the cursor.
Checklist
Breaking changes
Obsoletions / Deprecations
Fixed issues
Fixes #6085