From 6528ddb85f3b7c4fd9dbac5d4a035451365ffd62 Mon Sep 17 00:00:00 2001 From: divverent Date: Sat, 17 Oct 2015 22:36:06 +0000 Subject: [PATCH] SDL2: add clipboard support for all platforms. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@12228 d7cf8633-e32d-0410-b094-e92efae38249 ::stable-branch::merge=186b41757bdf686e333dc86ab0bb685c740a17f1 --- sys_sdl.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) 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; -- 2.39.2