From 642d100a7741843488a5166d089b9be03e6a8e40 Mon Sep 17 00:00:00 2001 From: black Date: Mon, 6 Sep 2004 08:06:40 +0000 Subject: [PATCH] Adding Sys_GetClipboardData to the SDL driver. git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@4439 d7cf8633-e32d-0410-b094-e92efae38249 --- sys_sdl.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) 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; -- 2.39.2