Support X11 incremental clipboard transfers
In our game, copy/pasting very large strings is relatively common, as users can share "blueprint strings" that can grow to be several megabytes large. I attempted to change our codebase to rely on SDL's clipboard functions in lieu of our custom implementations, but that made users unable to paste large blueprint strings on X11.
Some investigation has revealed the existence of the INCR mechanism in X11 to transfer large selections in the clipboard. Our custom X11 clipboard code implements this, but it appears that the SDL X11 clipboard does not, meaning that if this mechanism is used, pasting into the SDL application will not work. I would love it if this could be supported so I can fully rely on the SDL clipboard functions in the future!
Attached below is the problematic string.
Apologies, immediately after posting I noticed that there is a FIXME in SDL3 to implement this. I would greatly appreciate if it could be done and backported to SDL2, but it's not an enormous deal since our custom code works well enough.
We're working on showstoppers for 2.30 and focused on moving towards SDL 3.0 release. Feel free to submit a PR that implements this though!
@raiguard When you get a chance to test that PR, let me know; you have the best possible test case for it, so if it covers your needs, I'll merge it.
I made a small app to test this and it appears to work great! Unfortunately I cannot test it with the actual game since we are still on SDL2, but it should theoretically work just the same.
Would this be difficult to cherry pick to SDL2? I assume the surrounding code is pretty different.
Would this be difficult to cherry pick to SDL2? I assume the surrounding code is pretty different.
Yep, it is.