diff src/video/win32/SDL_win32video.c @ 4500:eff4e88cc1e8

Added Windows clipboard support
author Sam Lantinga <slouken@libsdl.org>
date Thu, 08 Jul 2010 05:43:34 -0700
parents 3e69e077cb95
children 9faebccfefb3
line wrap: on
line diff
--- a/src/video/win32/SDL_win32video.c	Thu Jul 08 00:35:58 2010 -0700
+++ b/src/video/win32/SDL_win32video.c	Thu Jul 08 05:43:34 2010 -0700
@@ -28,6 +28,7 @@
 #include "../SDL_pixels_c.h"
 
 #include "SDL_win32video.h"
+#include "SDL_win32clipboard.h"
 #include "SDL_d3drender.h"
 #include "SDL_gdirender.h"
 
@@ -35,6 +36,19 @@
 static int WIN_VideoInit(_THIS);
 static void WIN_VideoQuit(_THIS);
 
+/* Sets an error message based on GetLastError() */
+void
+WIN_SetError(const char *prefix)
+{
+    TCHAR buffer[1024];
+    char *message;
+    FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), 0,
+                  buffer, SDL_arraysize(buffer), NULL);
+    message = WIN_StringToUTF8(buffer);
+    SDL_SetError("%s%s%s", prefix ? prefix : "", prefix ? ": " : "", message);
+    SDL_free(message);
+}
+
 /* WIN32 driver bootstrap functions */
 
 static int
@@ -163,6 +177,10 @@
     device->GL_DeleteContext = WIN_GL_DeleteContext;
 #endif
 
+    device->SetClipboardText = WIN_SetClipboardText;
+    device->GetClipboardText = WIN_GetClipboardText;
+    device->HasClipboardText = WIN_HasClipboardText;
+
     device->free = WIN_DeleteDevice;
 
     return device;