summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSimon <simon@hardwired.org.uk>2011-04-04 16:07:38 (GMT)
committer Simon <simon@hardwired.org.uk>2011-04-04 16:07:38 (GMT)
commit5c079443f9d60f1efacdd7003b07462b72d830a3 (patch)
treeb17fdc82da5456d6dcd2bf1b49164b7be980cb76 /src
parent922befd8446ae3bdc8b3105bcf2f74e956ea386d (diff)
downloadpowder-5c079443f9d60f1efacdd7003b07462b72d830a3.zip
powder-5c079443f9d60f1efacdd7003b07462b72d830a3.tar.gz
clipboard_push_text implementation for WIN32, UNTESTED
Diffstat (limited to 'src')
-rw-r--r--src/misc.c28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/misc.c b/src/misc.c
index 607b070..13055ef 100644
--- a/src/misc.c
+++ b/src/misc.c
@@ -3,14 +3,6 @@
#include <string.h>
#include <regex.h>
#include <sys/types.h>
-#ifdef WIN32
-#include <windows.h>
-#include "update.h"
-#endif
-#ifdef MACOSX
-///#include <Pasteboard.h>
-#include <ApplicationServices/ApplicationServices.h>
-#endif
#include "misc.h"
#include "defines.h"
#include "interface.h"
@@ -19,6 +11,9 @@
#if defined WIN32
#include <windows.h>
#endif
+#ifdef MACOSX
+#include <ApplicationServices/ApplicationServices.h>
+#endif
//Signum function
#if defined(WIN32) && !defined(__GNUC__)
@@ -391,6 +386,23 @@ void clipboard_push_text(char * text)
CFDataRef data = CFDataCreate(kCFAllocatorDefault, text, strlen(text));
PasteboardPutItemFlavor(newclipboard, (PasteboardItemID)1, CFSTR("com.apple.traditional-mac-plain-text"), data, 0);
+#elif defined WIN32
+ if(OpenClipboard())
+ {
+ HGLOBAL cbuffer;
+ char * glbuffer;
+
+ EmptyClipboard();
+
+ cbuffer = GlobalAlloc(GMEM_DDESHARE, strlen(text)+1);
+ glbuffer = (char*)GlobalLock(cbuffer);
+
+ strcpy(glbuffer, text);
+
+ GlobalUnlock(cbuffer);
+ SetClipboardData(CF_TEXT, cbuffer);
+ CloseClipboard();
+ }
#else
printf("Not implemented: put text on clipboard \"%s\"\n", text);
#endif