From: black Date: Mon, 6 Sep 2004 08:06:40 +0000 (+0000) Subject: Adding Sys_GetClipboardData to the SDL driver. X-Git-Tag: xonotic-v0.1.0preview~5642 X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fdarkplaces.git;a=commitdiff_plain;h=642d100a7741843488a5166d089b9be03e6a8e40 Adding Sys_GetClipboardData to the SDL driver. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4439 d7cf8633-e32d-0410-b094-e92efae38249 --- diff --git a/sys_sdl.c b/sys_sdl.c index 715d094b..3bdbc7e5 100644 --- a/sys_sdl.c +++ b/sys_sdl.c @@ -182,6 +182,33 @@ void Sys_Sleep(int milliseconds) SDL_Delay(milliseconds); } +char *Sys_GetClipboardData (void) +{ +#ifdef WIN32 + char *data = NULL; + char *cliptext; + + if (OpenClipboard (NULL) != 0) + { + HANDLE hClipboardData; + + if ((hClipboardData = GetClipboardData (CF_TEXT)) != 0) + { + if ((cliptext = GlobalLock (hClipboardData)) != 0) + { + data = malloc (GlobalSize(hClipboardData)+1); + strcpy (data, cliptext); + GlobalUnlock (hClipboardData); + } + } + CloseClipboard (); + } + return data; +#else + return NULL; +#endif +} + int SDL_main (int argc, char *argv[]) { double frameoldtime, framenewtime;