Mercurial > sdl-ios-xcode
changeset 4503:524dfefd554c
Added an event when the clipboard is updated, triggered after the window gains the keyboard focus.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 08 Jul 2010 22:54:03 -0700 |
parents | b3540fa08474 |
children | 9faebccfefb3 |
files | Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj Xcode/SDL/SDL.xcodeproj/project.pbxproj include/SDL_events.h src/events/SDL_clipboardevents.c src/events/SDL_clipboardevents_c.h src/video/cocoa/SDL_cocoaclipboard.h src/video/cocoa/SDL_cocoaclipboard.m src/video/cocoa/SDL_cocoavideo.h src/video/cocoa/SDL_cocoawindow.m test/common.c |
diffstat | 10 files changed, 172 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj Thu Jul 08 06:21:48 2010 -0700 +++ b/Xcode-iPhoneOS/SDL/SDLiPhoneOS.xcodeproj/project.pbxproj Thu Jul 08 22:54:03 2010 -0700 @@ -62,6 +62,8 @@ 0098A5631195B4D900343137 /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0098A5621195B4D900343137 /* OpenGLES.framework */; }; 0098A5651195B4D900343137 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0098A5641195B4D900343137 /* UIKit.framework */; }; 0098A5851195B5E200343137 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0098A5841195B5E200343137 /* QuartzCore.framework */; }; + 0420497011E6F03D007E7EC9 /* SDL_clipboardevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420496E11E6F03D007E7EC9 /* SDL_clipboardevents_c.h */; }; + 0420497111E6F03D007E7EC9 /* SDL_clipboardevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 0420496F11E6F03D007E7EC9 /* SDL_clipboardevents.c */; }; 043DD76F10FD8A0000DED673 /* SDL_alphamult.c in Sources */ = {isa = PBXBuildFile; fileRef = 043DD76B10FD8A0000DED673 /* SDL_alphamult.c */; }; 043DD77010FD8A0000DED673 /* SDL_alphamult.h in Headers */ = {isa = PBXBuildFile; fileRef = 043DD76C10FD8A0000DED673 /* SDL_alphamult.h */; }; 043DD77110FD8A0000DED673 /* SDL_blendfillrect.c in Sources */ = {isa = PBXBuildFile; fileRef = 043DD76D10FD8A0000DED673 /* SDL_blendfillrect.c */; }; @@ -311,6 +313,8 @@ 0098A5621195B4D900343137 /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; 0098A5641195B4D900343137 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; 0098A5841195B5E200343137 /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + 0420496E11E6F03D007E7EC9 /* SDL_clipboardevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_clipboardevents_c.h; sourceTree = "<group>"; }; + 0420496F11E6F03D007E7EC9 /* SDL_clipboardevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_clipboardevents.c; sourceTree = "<group>"; }; 043DD76B10FD8A0000DED673 /* SDL_alphamult.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_alphamult.c; sourceTree = "<group>"; }; 043DD76C10FD8A0000DED673 /* SDL_alphamult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_alphamult.h; sourceTree = "<group>"; }; 043DD76D10FD8A0000DED673 /* SDL_blendfillrect.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_blendfillrect.c; sourceTree = "<group>"; }; @@ -958,6 +962,8 @@ FD99B9900DD52EDC00FB1D6B /* scancodes_linux.h */, FD99B9910DD52EDC00FB1D6B /* scancodes_win32.h */, FD99B9920DD52EDC00FB1D6B /* scancodes_xfree86.h */, + 0420496E11E6F03D007E7EC9 /* SDL_clipboardevents_c.h */, + 0420496F11E6F03D007E7EC9 /* SDL_clipboardevents.c */, FD99B9930DD52EDC00FB1D6B /* SDL_events.c */, FD99B9940DD52EDC00FB1D6B /* SDL_events_c.h */, FD99B9950DD52EDC00FB1D6B /* SDL_keyboard.c */, @@ -1184,6 +1190,7 @@ 006E9888119552DD001DE610 /* SDL_rwopsbundlesupport.h in Headers */, 044E5FB511E6069F0076F181 /* SDL_clipboard.h in Headers */, 044E5FB611E6069F0076F181 /* SDL_input.h in Headers */, + 0420497011E6F03D007E7EC9 /* SDL_clipboardevents_c.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1423,6 +1430,7 @@ 56ED04E3118A8EFD00A56AA6 /* SDL_syspower.m in Sources */, 006E9889119552DD001DE610 /* SDL_rwopsbundlesupport.m in Sources */, 044E5FB811E606EB0076F181 /* SDL_clipboard.c in Sources */, + 0420497111E6F03D007E7EC9 /* SDL_clipboardevents.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; };
--- a/Xcode/SDL/SDL.xcodeproj/project.pbxproj Thu Jul 08 06:21:48 2010 -0700 +++ b/Xcode/SDL/SDL.xcodeproj/project.pbxproj Thu Jul 08 22:54:03 2010 -0700 @@ -438,6 +438,22 @@ 00D8DA281195093100638393 /* SDL_at.c in Sources */ = {isa = PBXBuildFile; fileRef = 00D8DA151195093100638393 /* SDL_at.c */; }; 00D8DA291195093100638393 /* surface.c in Sources */ = {isa = PBXBuildFile; fileRef = 00D8DA181195093100638393 /* surface.c */; }; 00D8DA2A1195093100638393 /* testsdl.c in Sources */ = {isa = PBXBuildFile; fileRef = 00D8DA1A1195093100638393 /* testsdl.c */; }; + 0420496111E6EFD3007E7EC9 /* SDL_clipboardevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420495F11E6EFD3007E7EC9 /* SDL_clipboardevents_c.h */; }; + 0420496211E6EFD3007E7EC9 /* SDL_clipboardevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 0420496011E6EFD3007E7EC9 /* SDL_clipboardevents.c */; }; + 0420496311E6EFD3007E7EC9 /* SDL_clipboardevents_c.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420495F11E6EFD3007E7EC9 /* SDL_clipboardevents_c.h */; }; + 0420496411E6EFD3007E7EC9 /* SDL_clipboardevents.c in Sources */ = {isa = PBXBuildFile; fileRef = 0420496011E6EFD3007E7EC9 /* SDL_clipboardevents.c */; }; + 0420497A11E6F052007E7EC9 /* blank_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497411E6F052007E7EC9 /* blank_cursor.h */; }; + 0420497B11E6F052007E7EC9 /* default_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497511E6F052007E7EC9 /* default_cursor.h */; }; + 0420497C11E6F052007E7EC9 /* scancodes_darwin.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497611E6F052007E7EC9 /* scancodes_darwin.h */; }; + 0420497D11E6F052007E7EC9 /* scancodes_linux.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497711E6F052007E7EC9 /* scancodes_linux.h */; }; + 0420497E11E6F052007E7EC9 /* scancodes_win32.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497811E6F052007E7EC9 /* scancodes_win32.h */; }; + 0420497F11E6F052007E7EC9 /* scancodes_xfree86.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497911E6F052007E7EC9 /* scancodes_xfree86.h */; }; + 0420498011E6F052007E7EC9 /* blank_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497411E6F052007E7EC9 /* blank_cursor.h */; }; + 0420498111E6F052007E7EC9 /* default_cursor.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497511E6F052007E7EC9 /* default_cursor.h */; }; + 0420498211E6F052007E7EC9 /* scancodes_darwin.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497611E6F052007E7EC9 /* scancodes_darwin.h */; }; + 0420498311E6F052007E7EC9 /* scancodes_linux.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497711E6F052007E7EC9 /* scancodes_linux.h */; }; + 0420498411E6F052007E7EC9 /* scancodes_win32.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497811E6F052007E7EC9 /* scancodes_win32.h */; }; + 0420498511E6F052007E7EC9 /* scancodes_xfree86.h in Headers */ = {isa = PBXBuildFile; fileRef = 0420497911E6F052007E7EC9 /* scancodes_xfree86.h */; }; 044E5F8511E6051C0076F181 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 044E5F8411E6051C0076F181 /* SDL_clipboard.h */; settings = {ATTRIBUTES = (Public, ); }; }; 044E5F8611E6051C0076F181 /* SDL_clipboard.h in Headers */ = {isa = PBXBuildFile; fileRef = 044E5F8411E6051C0076F181 /* SDL_clipboard.h */; }; 046B91EC0A11B53500FB151C /* SDL_sysloadso.c in Sources */ = {isa = PBXBuildFile; fileRef = 046B91E90A11B53500FB151C /* SDL_sysloadso.c */; }; @@ -805,6 +821,14 @@ 01538439006D7D947F000001 /* SDL_fatal.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SDL_fatal.c; path = ../../src/SDL_fatal.c; sourceTree = SOURCE_ROOT; }; 0153843C006D7D947F000001 /* SDL.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SDL.c; path = ../../src/SDL.c; sourceTree = SOURCE_ROOT; }; 01538445006D7EC67F000001 /* SDL_thread.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; name = SDL_thread.c; path = ../../src/thread/SDL_thread.c; sourceTree = SOURCE_ROOT; }; + 0420495F11E6EFD3007E7EC9 /* SDL_clipboardevents_c.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SDL_clipboardevents_c.h; sourceTree = "<group>"; }; + 0420496011E6EFD3007E7EC9 /* SDL_clipboardevents.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = SDL_clipboardevents.c; sourceTree = "<group>"; }; + 0420497411E6F052007E7EC9 /* blank_cursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = blank_cursor.h; sourceTree = "<group>"; }; + 0420497511E6F052007E7EC9 /* default_cursor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = default_cursor.h; sourceTree = "<group>"; }; + 0420497611E6F052007E7EC9 /* scancodes_darwin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scancodes_darwin.h; sourceTree = "<group>"; }; + 0420497711E6F052007E7EC9 /* scancodes_linux.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scancodes_linux.h; sourceTree = "<group>"; }; + 0420497811E6F052007E7EC9 /* scancodes_win32.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scancodes_win32.h; sourceTree = "<group>"; }; + 0420497911E6F052007E7EC9 /* scancodes_xfree86.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scancodes_xfree86.h; sourceTree = "<group>"; }; 044E5F8411E6051C0076F181 /* SDL_clipboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SDL_clipboard.h; path = ../../include/SDL_clipboard.h; sourceTree = SOURCE_ROOT; }; 046B91E90A11B53500FB151C /* SDL_sysloadso.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SDL_sysloadso.c; sourceTree = "<group>"; }; 046B92100A11B8AD00FB151C /* SDL_dlcompat.c */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.c; path = SDL_dlcompat.c; sourceTree = "<group>"; }; @@ -1329,6 +1353,14 @@ 01538367006D79147F000001 /* events */ = { isa = PBXGroup; children = ( + 0420497411E6F052007E7EC9 /* blank_cursor.h */, + 0420497511E6F052007E7EC9 /* default_cursor.h */, + 0420497611E6F052007E7EC9 /* scancodes_darwin.h */, + 0420497711E6F052007E7EC9 /* scancodes_linux.h */, + 0420497811E6F052007E7EC9 /* scancodes_win32.h */, + 0420497911E6F052007E7EC9 /* scancodes_xfree86.h */, + 0420495F11E6EFD3007E7EC9 /* SDL_clipboardevents_c.h */, + 0420496011E6EFD3007E7EC9 /* SDL_clipboardevents.c */, 00CFA6C2106B480800758660 /* SDL_events_c.h */, 01538369006D79147F000001 /* SDL_events.c */, 00CFA6C3106B480800758660 /* SDL_keyboard_c.h */, @@ -1766,6 +1798,13 @@ 04DEA57111E6006A00386CAC /* SDL_input.h in Headers */, 04DEA57911E600A600386CAC /* SDL_cocoaclipboard.h in Headers */, 044E5F8511E6051C0076F181 /* SDL_clipboard.h in Headers */, + 0420496111E6EFD3007E7EC9 /* SDL_clipboardevents_c.h in Headers */, + 0420497A11E6F052007E7EC9 /* blank_cursor.h in Headers */, + 0420497B11E6F052007E7EC9 /* default_cursor.h in Headers */, + 0420497C11E6F052007E7EC9 /* scancodes_darwin.h in Headers */, + 0420497D11E6F052007E7EC9 /* scancodes_linux.h in Headers */, + 0420497E11E6F052007E7EC9 /* scancodes_win32.h in Headers */, + 0420497F11E6F052007E7EC9 /* scancodes_xfree86.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1869,6 +1908,13 @@ 04DEA57311E6006A00386CAC /* SDL_input.h in Headers */, 04DEA57B11E600A600386CAC /* SDL_cocoaclipboard.h in Headers */, 044E5F8611E6051C0076F181 /* SDL_clipboard.h in Headers */, + 0420496311E6EFD3007E7EC9 /* SDL_clipboardevents_c.h in Headers */, + 0420498011E6F052007E7EC9 /* blank_cursor.h in Headers */, + 0420498111E6F052007E7EC9 /* default_cursor.h in Headers */, + 0420498211E6F052007E7EC9 /* scancodes_darwin.h in Headers */, + 0420498311E6F052007E7EC9 /* scancodes_linux.h in Headers */, + 0420498411E6F052007E7EC9 /* scancodes_win32.h in Headers */, + 0420498511E6F052007E7EC9 /* scancodes_xfree86.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2230,6 +2276,7 @@ 006E95B111952992001DE610 /* SDL_rwopsbundlesupport.m in Sources */, 04DEA57511E6009000386CAC /* SDL_clipboard.c in Sources */, 04DEA57A11E600A600386CAC /* SDL_cocoaclipboard.m in Sources */, + 0420496211E6EFD3007E7EC9 /* SDL_clipboardevents.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -2348,6 +2395,7 @@ 006E95B311952992001DE610 /* SDL_rwopsbundlesupport.m in Sources */, 04DEA57611E6009000386CAC /* SDL_clipboard.c in Sources */, 04DEA57C11E600A600386CAC /* SDL_cocoaclipboard.m in Sources */, + 0420496411E6EFD3007E7EC9 /* SDL_clipboardevents.c in Sources */, ); runOnlyForDeploymentPostprocessing = 0; };
--- a/include/SDL_events.h Thu Jul 08 06:21:48 2010 -0700 +++ b/include/SDL_events.h Thu Jul 08 22:54:03 2010 -0700 @@ -90,6 +90,9 @@ SDL_JOYBUTTONDOWN, /**< Joystick button pressed */ SDL_JOYBUTTONUP, /**< Joystick button released */ + /* Clipboard events */ + SDL_CLIPBOARDUPDATE = 0x700, /**< The clipboard changed */ + /* Obsolete events */ SDL_EVENT_COMPAT1 = 0x7000, /**< SDL 1.2 events for compatibility */ SDL_EVENT_COMPAT2,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/events/SDL_clipboardevents.c Thu Jul 08 22:54:03 2010 -0700 @@ -0,0 +1,47 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2010 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +/* Clipboard event handling code for SDL */ + +#include "SDL_events.h" +#include "SDL_events_c.h" +#include "SDL_clipboardevents_c.h" + + +int +SDL_SendClipboardUpdate() +{ + int posted; + + /* Post the event, if desired */ + posted = 0; + if (SDL_GetEventState(SDL_CLIPBOARDUPDATE) == SDL_ENABLE) { + SDL_Event event; + event.type = SDL_CLIPBOARDUPDATE; + + posted = (SDL_PushEvent(&event) > 0); + } + return (posted); +} + +/* vi: set ts=4 sw=4 expandtab: */
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/events/SDL_clipboardevents_c.h Thu Jul 08 22:54:03 2010 -0700 @@ -0,0 +1,31 @@ +/* + SDL - Simple DirectMedia Layer + Copyright (C) 1997-2010 Sam Lantinga + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + + Sam Lantinga + slouken@libsdl.org +*/ +#include "SDL_config.h" + +#ifndef _SDL_clipboardevents_c_h +#define _SDL_clipboardevents_c_h + +extern int SDL_SendClipboardUpdate(); + +#endif /* _SDL_clipboardevents_c_h */ + +/* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/cocoa/SDL_cocoaclipboard.h Thu Jul 08 06:21:48 2010 -0700 +++ b/src/video/cocoa/SDL_cocoaclipboard.h Thu Jul 08 22:54:03 2010 -0700 @@ -24,9 +24,13 @@ #ifndef _SDL_cocoaclipboard_h #define _SDL_cocoaclipboard_h +/* Forward declaration */ +struct SDL_VideoData; + extern int Cocoa_SetClipboardText(_THIS, const char *text); extern char *Cocoa_GetClipboardText(_THIS); extern SDL_bool Cocoa_HasClipboardText(_THIS); +extern void Cocoa_CheckClipboardUpdate(struct SDL_VideoData * data); #endif /* _SDL_cocoaclipboard_h */
--- a/src/video/cocoa/SDL_cocoaclipboard.m Thu Jul 08 06:21:48 2010 -0700 +++ b/src/video/cocoa/SDL_cocoaclipboard.m Thu Jul 08 22:54:03 2010 -0700 @@ -22,6 +22,7 @@ #include "SDL_config.h" #include "SDL_cocoavideo.h" +#include "../../events/SDL_clipboardevents_c.h" static NSString * GetTextFormat(_THIS) @@ -42,6 +43,7 @@ int Cocoa_SetClipboardText(_THIS, const char *text) { + SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; NSAutoreleasePool *pool; NSPasteboard *pasteboard; NSString *format = GetTextFormat(_this); @@ -49,7 +51,7 @@ pool = [[NSAutoreleasePool alloc] init]; pasteboard = [NSPasteboard generalPasteboard]; - [pasteboard declareTypes:[NSArray arrayWithObject:format] owner:nil]; + data->clipboard_count = [pasteboard declareTypes:[NSArray arrayWithObject:format] owner:nil]; [pasteboard setString:[NSString stringWithUTF8String:text] forType:format]; [pool release]; @@ -114,4 +116,25 @@ return result; } +void +Cocoa_CheckClipboardUpdate(struct SDL_VideoData * data) +{ + NSAutoreleasePool *pool; + NSPasteboard *pasteboard; + NSInteger count; + + pool = [[NSAutoreleasePool alloc] init]; + + pasteboard = [NSPasteboard generalPasteboard]; + count = [pasteboard changeCount]; + if (count != data->clipboard_count) { + if (data->clipboard_count) { + SDL_SendClipboardUpdate(); + } + data->clipboard_count = count; + } + + [pool release]; +} + /* vi: set ts=4 sw=4 expandtab: */
--- a/src/video/cocoa/SDL_cocoavideo.h Thu Jul 08 06:21:48 2010 -0700 +++ b/src/video/cocoa/SDL_cocoavideo.h Thu Jul 08 22:54:03 2010 -0700 @@ -60,6 +60,7 @@ unsigned int modifierFlags; void *key_layout; SDLTranslatorResponder *fieldEdit; + NSInteger clipboard_count; Uint32 screensaver_activity; } SDL_VideoData;
--- a/src/video/cocoa/SDL_cocoawindow.m Thu Jul 08 06:21:48 2010 -0700 +++ b/src/video/cocoa/SDL_cocoawindow.m Thu Jul 08 22:54:03 2010 -0700 @@ -128,6 +128,9 @@ { /* We're going to get keyboard events, since we're key. */ SDL_SetKeyboardFocus(_data->window); + + /* Check to see if someone updated the clipboard */ + Cocoa_CheckClipboardUpdate(_data->videodata); } - (void)windowDidResignKey:(NSNotification *)aNotification
--- a/test/common.c Thu Jul 08 06:21:48 2010 -0700 +++ b/test/common.c Thu Jul 08 22:54:03 2010 -0700 @@ -1017,6 +1017,9 @@ fprintf(stderr, "Joystick %d: button %d released", event->jbutton.which, event->jbutton.button); break; + case SDL_CLIPBOARDUPDATE: + fprintf(stderr, "Clipboard updated"); + break; case SDL_QUIT: fprintf(stderr, "Quit requested"); break;