]> de.git.xonotic.org Git - xonotic/darkplaces.git/commitdiff
SDL2: add clipboard support for all platforms.
authordivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 17 Oct 2015 22:36:06 +0000 (22:36 +0000)
committerdivverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Sat, 17 Oct 2015 22:36:06 +0000 (22:36 +0000)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12228 d7cf8633-e32d-0410-b094-e92efae38249

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;