From: divverent <divverent@d7cf8633-e32d-0410-b094-e92efae38249>
Date: Sat, 17 Oct 2015 22:36:06 +0000 (+0000)
Subject: SDL2: add clipboard support for all platforms.
X-Git-Tag: xonotic-v0.8.5~88^2~93
X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=186b41757bdf686e333dc86ab0bb685c740a17f1;p=xonotic%2Fdarkplaces.git

SDL2: add clipboard support for all platforms.

git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12228 d7cf8633-e32d-0410-b094-e92efae38249
---

diff --git a/sys_sdl.c b/sys_sdl.c
index 7bfb041f..df3e3171 100644
--- 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;