| Summary: | On X11, SDL2 should use CLIPBOARD as well as PRIMARY for copy/paste | ||
|---|---|---|---|
| Product: | SDL | Reporter: | David White <davewx7> |
| Component: | main | Assignee: | Sam Lantinga <slouken> |
| Status: | RESOLVED FIXED | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | ppisar |
| Version: | HG 2.0 | ||
| Hardware: | x86 | ||
| OS: | Linux | ||
| Attachments: | Patch to fix SDL_(Set|Get)ClipboardText on Linux | ||
Just a formal remarks:
(1)
--- a/src/video/x11/SDL_x11clipboard.c Mon Sep 10 20:25:55 2012 -0700
+++ b/src/video/x11/SDL_x11clipboard.c Wed Sep 12 13:10:44 2012 -0700
@@ -49,29 +49,37 @@ GetWindow(_THIS)
}
int
X11_SetClipboardText(_THIS, const char *text)
{
Display *display = ((SDL_VideoData *) _this->driverdata)->display;
Atom format;
Window window;
+ Atom XA_CLIPBOARD = XInternAtom(display, "CLIPBOARD", 0);
+
+ fprintf(stderr, "SET CLIPBOARD TEXT(%s)\n", text);
I guess the fprintf() should go away.
(2)
The indentation of your patch does not follow current code.
Fixed, thanks! http://hg.libsdl.org/SDL/rev/6f52dc57f05e |
Created attachment 948 [details] Patch to fix SDL_(Set|Get)ClipboardText on Linux Background: X has two main 'buffers' for copy/paste: PRIMARY -- normally used for implicit selection of text, with middle-click to paste CLIPBOARD -- works with an explicit copy/paste like on other platforms. Currently SDL2 only provides access to PRIMARY. Since CLIPBOARD is much closer to functionality of other platforms, SDL should provide access to that instead. The attached patch makes it so that SDL_SetClipboardText() sets both PRIMARY and CLIPBOARD and SDL_GetClipboardText() reads from CLIPBOARD instead of primary. This will make it so that a program implemented on Windows using the clipboard functions will behave naturally on Linux. The existing implementation makes it so a program implemented on Windows behaves strangely on Linux.