]> de.git.xonotic.org Git - xonotic/darkplaces.git/blobdiff - sys_sdl.c
SDL2: add clipboard support for all platforms.
[xonotic/darkplaces.git] / sys_sdl.c
index 7bfb041f6c7345cf919d649cfbe3eb0a4b374bc3..df3e3171bf70f95e0863d0014106d5eebf482eb8 100644 (file)
--- a/sys_sdl.c
+++ b/sys_sdl.c
@@ -169,7 +169,21 @@ char *Sys_ConsoleInput(void)
 
 char *Sys_GetClipboardData (void)
 {
-#ifdef WIN32
+#if SDL_MAJOR_VERSION != 1
+       char *data = NULL;
+       char *cliptext;
+
+       cliptext = SDL_GetClipboardText();
+       if (cliptext != NULL) {
+               size_t allocsize;
+               allocsize = strlen(cliptext) + 1;
+               data = (char *)Z_Malloc (allocsize);
+               strlcpy (data, cliptext, allocsize);
+               SDL_free(cliptext);
+       }
+
+       return data;
+#elif defined(WIN32)
        char *data = NULL;
        char *cliptext;