]> git.rm.cloudns.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)
committerRudolf Polzer <divverent@xonotic.org>
Tue, 24 Nov 2015 13:37:32 +0000 (14:37 +0100)
git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12228 d7cf8633-e32d-0410-b094-e92efae38249
::stable-branch::merge=186b41757bdf686e333dc86ab0bb685c740a17f1

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;