23 #if SDL_VIDEO_DRIVER_X11
33 #ifdef X_HAVE_UTF8_STRING
34 #define TEXT_FORMAT XInternAtom(display, "UTF8_STRING", False)
36 #define TEXT_FORMAT XA_STRING
58 Atom XA_CLIPBOARD =
XInternAtom(display,
"CLIPBOARD", 0);
61 window = GetWindow(
_this);
63 return SDL_SetError(
"Couldn't find a window to own the selection");
68 XChangeProperty(display, DefaultRootWindow(display),
69 XA_CUT_BUFFER0, format, 8, PropModeReplace,
70 (
const unsigned char *)text,
SDL_strlen(text));
72 if (XA_CLIPBOARD != None &&
74 XSetSelectionOwner(display, XA_CLIPBOARD, window, CurrentTime);
78 XSetSelectionOwner(display, XA_PRIMARY, window, CurrentTime);
87 Display *display = videodata->
display;
95 unsigned long overflow;
100 Atom XA_CLIPBOARD =
XInternAtom(display,
"CLIPBOARD", 0);
101 if (XA_CLIPBOARD == None) {
109 window = GetWindow(
_this);
110 format = TEXT_FORMAT;
112 if ((owner == None) || (owner == window)) {
113 owner = DefaultRootWindow(display);
114 selection = XA_CUT_BUFFER0;
118 selection =
XInternAtom(display,
"SDL_SELECTION", False);
119 XConvertSelection(display, XA_CLIPBOARD, format, selection, owner,
131 if (waitElapsed > 1000) {
142 if (XGetWindowProperty(display, owner, selection, 0, INT_MAX/4, False,
143 format, &seln_type, &seln_format, &nbytes, &overflow, &
src)
145 if (seln_type == format) {
char * X11_GetClipboardText(_THIS)
DECLSPEC void SDLCALL SDL_free(void *mem)
DECLSPEC void SDLCALL SDL_PumpEvents(void)
SDL_bool selection_waiting
static SDL_VideoDevice * _this
uint32_t Uint32
An unsigned 32-bit integer type.
DECLSPEC Uint32 SDLCALL SDL_GetTicks(void)
Get the number of milliseconds since the SDL library initialization.
SDL_bool X11_HasClipboardText(_THIS)
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int int int return Display Window Cursor return Display Window return Display Drawable GC int int unsigned int unsigned int return Display Drawable GC int int _Xconst char int return Display Drawable GC int int unsigned int unsigned int return Display return Display Cursor return Display GC return XModifierKeymap return char Display Window int return Display return Display Atom return Display Window XWindowAttributes return Display Window return Display XEvent Bool(*) XPointer return Display Window Bool unsigned int int int Window Cursor Time return Display Window int return KeySym retur XInternAtom)
DECLSPEC char *SDLCALL SDL_strdup(const char *str)
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum format
DECLSPEC int SDLCALL SDL_SetError(const char *fmt,...)
DECLSPEC void *SDLCALL SDL_malloc(size_t size)
int X11_SetClipboardText(_THIS, const char *text)
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int int int return Display Window Cursor return Display Window return Display Drawable GC int int unsigned int unsigned int return Display Drawable GC int int _Xconst char int return Display Drawable GC int int unsigned int unsigned int return Display return Display Cursor return Display GC return XModifierKeymap return char Display Window int return Display retur XGetSelectionOwner)
DECLSPEC size_t SDLCALL SDL_strlen(const char *str)
DECLSPEC void *SDLCALL SDL_memcpy(void *dst, const void *src, size_t len)