diff src/video/win32/SDL_win32clipboard.c @ 4504:9faebccfefb3

Amazingly the Windows code is almost identical to the Mac OS X code. :)
author Sam Lantinga <slouken@libsdl.org>
date Thu, 08 Jul 2010 23:07:34 -0700
parents eff4e88cc1e8
children e1664f94f026
line wrap: on
line diff
--- a/src/video/win32/SDL_win32clipboard.c	Thu Jul 08 22:54:03 2010 -0700
+++ b/src/video/win32/SDL_win32clipboard.c	Thu Jul 08 23:07:34 2010 -0700
@@ -23,6 +23,7 @@
 
 #include "SDL_win32video.h"
 #include "SDL_win32window.h"
+#include "../../events/SDL_clipboardevents_c.h"
 
 
 #ifdef UNICODE
@@ -52,6 +53,7 @@
 int
 WIN_SetClipboardText(_THIS, const char *text)
 {
+    SDL_VideoData *data = (SDL_VideoData *) _this->driverdata;
     int result = 0;
 
     if (OpenClipboard(GetWindowHandle(_this))) {
@@ -93,6 +95,7 @@
                 WIN_SetError("Couldn't set clipboard data");
                 result = -1;
             }
+            data->clipboard_count = GetClipboardSequenceNumber();
         }
         SDL_free(tstr);
 
@@ -141,4 +144,18 @@
     }
 }
 
+void
+WIN_CheckClipboardUpdate(struct SDL_VideoData * data)
+{
+    DWORD count;
+
+    count = GetClipboardSequenceNumber();
+    if (count != data->clipboard_count) {
+        if (data->clipboard_count) {
+            SDL_SendClipboardUpdate();
+        }
+        data->clipboard_count = count;
+    }
+}
+
 /* vi: set ts=4 sw=4 expandtab: */