| Summary: | [PATCH] Wayland: Drag and Drop / Clipboard | ||
|---|---|---|---|
| Product: | SDL | Reporter: | x414e54 |
| Component: | events | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | philipp.wiesemann |
| Version: | HG 2.0 | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Attachments: |
Wayland Data Manager
Wayland Data Manager - Update Wayland Data Manager - Updated Wayland Data Manager - Updated Compile warning fix. |
||
Created attachment 2125 [details]
Wayland Data Manager - Update
I have updated the patch to include SDL_waylandclipboard which I forgot last time and improved a few issues such as handling SIGPIPE, selecting the pipes to prevent blocking and null terminating the buffer.
Using the testdropfile seems to work fine. Though I would advise someone else to test it and run though the code to check for any issues!
Thanks, can you update your patch for the latest SDL in Mercurial? I was busy last month so it took me a while to get round to this. I will try to upload a new patch soon. Created attachment 2599 [details]
Wayland Data Manager - Updated
This is an update against the current repo.
The interface has changed recently and the older DND protocol seems to no longer work correctly on Gnome 3.22. I updated to the newer protocol (version 3). This now seems to be working fine on Gnome 3.22. I am conscious that this might cause some issues if compiling against older wayland header files due to missing definitions or enums. I will try and improve the backwards compatibility later.
Wayland_SetClipboardText() does not need to check if the text is not NULL because SDL_SetClipboardText() checks it. Wayland_GetClipboardText() could return an empty string on errors for consistency with the other platforms. The comment including "SDL_VIDEO_DRIVER_X11" at the end of "SDL_waylandclipboard.c" is wrong. :) Okay thank you. I also noticed that because the main Wayland protocol does not use a global clipboard I need to loop back the text from SDL_SetClipboardText into SDL_GetClipboard text if no other application is offering any data. This should mean all the clipboard automation tests now pass. I will add an updated patch a bit later today. Created attachment 2603 [details]
Wayland Data Manager - Updated
Okay I have updated with the improvements suggested and that I mentioned.
Also I have fixed an issue with reading into the pointer to the buffer and overflowing instead of the allocated storage.
Finally I have also increased the mime types that the clipboard is set to because some applications seem to not want text/plain;charset=utf-8 (even though they advertise that themselves) but do want text/plain.
This is in, thanks! https://hg.libsdl.org/SDL/rev/974f8ebcb819 Created attachment 2606 [details]
Compile warning fix.
Great thank you.
I noticed there was a small compile warning due to the headers not including pipe2. I have uploaded a small patch to fix this and also to make sure the data device manager is explicitly released at the end. (Not sure if you read resolved issues or not).
|
Created attachment 2121 [details] Wayland Data Manager I have implemented Drag and Drop and Clipboard support for Wayland. Drag and dropping files from nautilus to the testdropfile application seems to work and also copy and paste. This was just something quick I did over the weekend and still needs a bit of tidying up. But I thought I would post what I have done so far in-case anyone is already working on implementing it, or has any ideas. I will try to tidy up any issues and re-submit a final patch when I have time.