lagrange
lagrange copied to clipboard
Selected text and copied text should go to separate clipboards — standard X11 clipboard behavior
When selecting text, you should be able to paste it into terminal (or other applications) with middle mouse click. PRIMARY clipboard
should be used for this.
Also when selecting text and choosing copy, when pasted into vim (terminal), vim hangs for a while, and pastes something old instead. CLIPBOARD clipboard
should be used for this
Tested with vim -u DEFAULTS -U NONE -i NONE
https://specifications.freedesktop.org/clipboards-spec/clipboards-latest.txt
Thanks for the link, this is all news to me as a casual X11 user.
I'll have to dig into the SDL source code to see what exactly SDL_SetClipboardText() does in practice, and if there is any way to influence the behavior. Of course, there is always the option of using X11 APIs directly for this, but I would prefer a more cross-platform solution...
There is an existing command line tool: https://github.com/astrand/xclip/
That is a good resource to see how the APIs work (appears quite complex!), but one option is to simply run xclip
behind the scenes when the user marks a selection, or clicks the middle button.
To call xclip behind the scenes is fine with me, but I think xlib is the way to go if not SDL have a way to do it. I compiled this, which shows lagrange window name as "null" when copying from it. Maybe it have something to do with this? https://wahjava.wordpress.com/2006/08/05/x-cut-and-paste-aka-x-clipboard/
I'll have to take a much closer look at the Xlib APIs. If it turns out to be not too complicated, it is indeed better to not call external tools just for accessing the clipboard.
Interesting new feature in SDL 2.26:
Added SDL_SetPrimarySelectionText(), SDL_GetPrimarySelectionText(), and SDL_HasPrimarySelectionText() to interact with the X11 primary selection clipboard