From 5f62bc74c9fe273cf4d1419be7546e57beadfe32 Mon Sep 17 00:00:00 2001 From: Simon Robertshaw Date: Wed, 6 Jul 2011 14:01:47 +0100 Subject: [PATCH] Windows clipboard_pull_text() implementation (untested) --- src/misc.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/misc.c b/src/misc.c index ef4b281b8..4fc616ba7 100644 --- a/src/misc.c +++ b/src/misc.c @@ -440,8 +440,28 @@ void clipboard_push_text(char * text) char * clipboard_pull_text() { +#ifdef MACOSX +#elif defined WIN32 + if (OpenClipboard(NULL)) + { + HANDLE cbuffer; + char * glbuffer; + + cbuffer = GetClipboardData(CF_TEXT); + glbuffer = (char*)GlobalLock(cbuffer); + GlobalUnlock(cbuffer); + CloseClipboard(); + if(glbuffer!=NULL){ + return mystrdup(glbuffer); + } else { + return ""; + } + } +#elif (defined(LIN32) || defined(LIN64)) && defined(SDL_VIDEO_DRIVER_X11) +#else printf("Not implemented: get text from clipboard\n"); return ""; +#endif } int register_extension()