Wayland backend: add host-to-client clipboard sync (revived)#2062
Wayland backend: add host-to-client clipboard sync (revived)#2062ninetailedtori wants to merge 19 commits intoValveSoftware:masterfrom
Conversation
…re#1797 Signed-off-by: ninetailedtori <ninetailedtori@uwu.gal>
Signed-off-by: ninetailedtori <ninetailedtori@uwu.gal>
Signed-off-by: ninetailedtori <ninetailedtori@uwu.gal>
Signed-off-by: Toria <ninetailedtori@uwu.gal>
Signed-off-by: Toria <ninetailedtori@uwu.gal>
|
+1, works as excpected, can copy&paste fine into cs2. i guess .gitignore change should be removed.
|
I'll push the revert to gitignore, good catch. :] |
|
Any crashes to note? Has anyone tested if image clipboard content outside the app destroys the offer correctly and doesn't post a garbled mess? My own testing seems reasonably stable :) |
|
Hi, thanks for the update! The clipboard sync worked for me. I found a crash related to drag and drop: When I drag a file (or text) from my host and hover it over the game window, gamescope crashes immediately. The window disappears, but the process seems to remain active in the background. The logs show a lot of these errors when the crash happens: My Setup:
Is this happening only on my end/setup? |
This isn't enough log, unfortunately. Are you running with debug option on gamescope? I'd need a log on the bug reproduction to try to diagnose what was happening :] |
i get this spammed 100 times per second, seems to be related to |
Wacky, lemme find out where I've botched that up! |
|
Could you send a full trace log if that's possible? Just for debugging purposes. |
|
gdb_gamescope.txt is the backtrace from Dragging of a png-file over Dolphin inside gamescope lead to the crash. |
… event-scope calls. Signed-off-by: Toria <ninetailedtori@uwu.gal>
|
Alright, @PatrickFD can you test this build and see if that works? I think it was the illegal roundtrip re-entrant calls. Do note, to build this one, you'll need #2110 now, since the merge pulled in the libinput bump from wlroots, which is currently broken. cd subprojects/wlroots
curl -O https://gist.githubusercontent.com/Billli11/d9e45819b87dbe82469fe2492492aff7/raw/1b3cd4aa948f0a184b063d6e6839d833b871bd81/wlroots-5261.patch
git apply wlroots-5261.patch |
|
Hello. I just wanna chime in. Commit 7657c70 works fine for me. I have one suggestion, though: since static constexpr std::array supportedMimeTypesStorage = {
"text/plain;charset=utf-8", "UTF8_STRING", "text/plain", "STRING", "TEXT",
};
static const std::span<const char* const> supportedMimeTypes = supportedMimeTypesStorage;There could be a more idiomatic way to do this. Have a nice [TIMEZONE]! EDIT: Actually, the span isn't even needed. static constexpr std::array supportedMimeTypes = {
"text/plain;charset=utf-8", "UTF8_STRING", "text/plain", "STRING", "TEXT",
};(but this exposes the length as part of the type, unlike the span) |
|
Shit, didn't even catch that lol! Lemme slam an optimisation commit rq |
|
I've never been so hyped for a pr merge before |
Dw about the extra span definition, it's lightweight! After all, it's just difference between the ctime constexpr array and the span which just wraps the arr in a ref view space, no extra work 👀 |
|
Using OS: Arch Linux debug_changes.diff.txt Maybe you should add a flag to ignore the next incoming data offer? Or go back to using |
Shoot, is this dragging or all clipboard activity? |
Just copy-pasting. Apparently, dragging and dropping (which I haven't tested until now) causes an abort. That seems to be a different issue, though. So now there are two issues. The 1st one still exists. I've redone the testing with xnedit and it happens with that too, so it's not exclusive to Kate. The 2nd one is caused by |
So, the second issue, I might be able to fix with this commit, having analysed the file? The first bug that occurs is the annoying one, I'm gonna see what I can do with that. Lemme read the log in more detail just to see the best method here. |
|
See if this commit fixed things please! I've attempted to separate the processing from the blocking and attach it to its own queue. |
|
7c92683 does actually fix drag-and-drop aborts. I fixed it in the same way. That works. But currently, Gamescope segfaults because 0001-fix-backend-wayland-fix-data-dev-segfault.patch Another problem is that we're not dispatching events from Also, maybe the input and clipboard queues should be given names to avoid confusion. (with With the segfault fixed and queue names added for clarity on fnr1r@125bbc3, Side note - from looking at the source, I dislike that the Wayland backend is a single file. And that Gamescope doesn't have a consistent style. ( Happy Holidays to everyone tracking this issue! |
…gfault through accessing pre-initialization.
…r queue as well. See if this works.
I've actually forgone the need for queue entirely, see if that fixes things! Regarding the clipboard events, this should fix things? Theoretically I could've tied the queue setting within dataoffer_offer, which is very much possible through: But honestly, the mutex SHOULD be cheaper, and equally safe? |
I should have said that the indentation thing wasn't a criticism of you specifically, just the current state of Gamescope. I'm sorry. I misdiagnosed this issue in #2062 (comment). It's also only now that I understand this, so maybe I should relay it (but now better):
Your current solution is functionally equivalent to 7657c70. The mutex is unnecessary since there's only one thread interacting with the clipboard. I don't understand why it was added there since it's not going to do anything. I tried using a flag (instead of a mutex) to ignore the next Sorry. It's my fault. I should have read up on this more before commenting. |
I can fix this, one sec. I'll keep the mutex but expand it for the read thread as well, just to synchronise the offers anyway. |
…ed reader thread.
|
Alright, I'm gonna push an experimental fix to offload to a readerthread and see if that works? it SHOULD handle the blocking reads, the deadlock with the host, maintaining mutex and should handle mult offers. |
|
Also, don't forget to add a destructor to |
whoopsie! |
|
Check this one! |
|
It works. I'll try to look at it later and offer some feedback. |
Signed-off-by: Toria <ninetailedtori@uwu.gal>
I'd welcome testing on this, it should implement the clipboard protocol correctly, without crashing randomly on tab out tab ins/copy-pasting invalid mime types into gamescope.