Mercurial > sdl-ios-xcode
annotate src/video/cocoa/SDL_cocoaclipboard.m @ 4525:3abf0b9cafad
pelya 2010-07-12 03:53:48 PDT
In function GLES_RenderCopy() in SDL_renderer_gles.c:819 there is one memcpy()
that can be avoided if we're updating whole texture.
Because of that the SDL 1.3 in compatibility mode is working even slower than
software rendering in SDL 1.2.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Wed, 14 Jul 2010 07:31:35 -0700 |
parents | 9faebccfefb3 |
children | 514f811a4887 |
rev | line source |
---|---|
4499
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3 Copyright (C) 1997-2010 Sam Lantinga |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 Sam Lantinga |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 slouken@libsdl.org |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 */ |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
22 #include "SDL_config.h" |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
24 #include "SDL_cocoavideo.h" |
4503
524dfefd554c
Added an event when the clipboard is updated, triggered after the window gains the keyboard focus.
Sam Lantinga <slouken@libsdl.org>
parents:
4501
diff
changeset
|
25 #include "../../events/SDL_clipboardevents_c.h" |
4499
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
26 |
4501
0cf025066b6f
Updated Xcode project files for clipboard API
Sam Lantinga <slouken@libsdl.org>
parents:
4499
diff
changeset
|
27 static NSString * |
0cf025066b6f
Updated Xcode project files for clipboard API
Sam Lantinga <slouken@libsdl.org>
parents:
4499
diff
changeset
|
28 GetTextFormat(_THIS) |
0cf025066b6f
Updated Xcode project files for clipboard API
Sam Lantinga <slouken@libsdl.org>
parents:
4499
diff
changeset
|
29 { |
0cf025066b6f
Updated Xcode project files for clipboard API
Sam Lantinga <slouken@libsdl.org>
parents:
4499
diff
changeset
|
30 #if MAC_OS_X_VERSION_MAX_ALLOWED < 1060 |
0cf025066b6f
Updated Xcode project files for clipboard API
Sam Lantinga <slouken@libsdl.org>
parents:
4499
diff
changeset
|
31 return NSStringPboardType; |
0cf025066b6f
Updated Xcode project files for clipboard API
Sam Lantinga <slouken@libsdl.org>
parents:
4499
diff
changeset
|
32 #else |
0cf025066b6f
Updated Xcode project files for clipboard API
Sam Lantinga <slouken@libsdl.org>
parents:
4499
diff
changeset
|
33 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; |
0cf025066b6f
Updated Xcode project files for clipboard API
Sam Lantinga <slouken@libsdl.org>
parents:
4499
diff
changeset
|
34 |
0cf025066b6f
Updated Xcode project files for clipboard API
Sam Lantinga <slouken@libsdl.org>
parents:
4499
diff
changeset
|
35 if (data->osversion >= 0x1060) { |
0cf025066b6f
Updated Xcode project files for clipboard API
Sam Lantinga <slouken@libsdl.org>
parents:
4499
diff
changeset
|
36 return NSPasteboardTypeString; |
0cf025066b6f
Updated Xcode project files for clipboard API
Sam Lantinga <slouken@libsdl.org>
parents:
4499
diff
changeset
|
37 } else { |
0cf025066b6f
Updated Xcode project files for clipboard API
Sam Lantinga <slouken@libsdl.org>
parents:
4499
diff
changeset
|
38 return NSStringPboardType; |
0cf025066b6f
Updated Xcode project files for clipboard API
Sam Lantinga <slouken@libsdl.org>
parents:
4499
diff
changeset
|
39 } |
0cf025066b6f
Updated Xcode project files for clipboard API
Sam Lantinga <slouken@libsdl.org>
parents:
4499
diff
changeset
|
40 #endif |
0cf025066b6f
Updated Xcode project files for clipboard API
Sam Lantinga <slouken@libsdl.org>
parents:
4499
diff
changeset
|
41 } |
4499
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
42 |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
43 int |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 Cocoa_SetClipboardText(_THIS, const char *text) |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
45 { |
4503
524dfefd554c
Added an event when the clipboard is updated, triggered after the window gains the keyboard focus.
Sam Lantinga <slouken@libsdl.org>
parents:
4501
diff
changeset
|
46 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; |
4499
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 NSAutoreleasePool *pool; |
4504
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4503
diff
changeset
|
48 NSPasteboard *pasteboard; |
4501
0cf025066b6f
Updated Xcode project files for clipboard API
Sam Lantinga <slouken@libsdl.org>
parents:
4499
diff
changeset
|
49 NSString *format = GetTextFormat(_this); |
4499
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
50 |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
51 pool = [[NSAutoreleasePool alloc] init]; |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
52 |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 pasteboard = [NSPasteboard generalPasteboard]; |
4503
524dfefd554c
Added an event when the clipboard is updated, triggered after the window gains the keyboard focus.
Sam Lantinga <slouken@libsdl.org>
parents:
4501
diff
changeset
|
54 data->clipboard_count = [pasteboard declareTypes:[NSArray arrayWithObject:format] owner:nil]; |
4499
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
55 [pasteboard setString:[NSString stringWithUTF8String:text] forType:format]; |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
56 |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
57 [pool release]; |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
58 |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
59 return 0; |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
60 } |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
61 |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
62 char * |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
63 Cocoa_GetClipboardText(_THIS) |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
64 { |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
65 NSAutoreleasePool *pool; |
4504
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4503
diff
changeset
|
66 NSPasteboard *pasteboard; |
4501
0cf025066b6f
Updated Xcode project files for clipboard API
Sam Lantinga <slouken@libsdl.org>
parents:
4499
diff
changeset
|
67 NSString *format = GetTextFormat(_this); |
4499
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
68 NSString *available; |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
69 char *text; |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
70 |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
71 pool = [[NSAutoreleasePool alloc] init]; |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
72 |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
73 pasteboard = [NSPasteboard generalPasteboard]; |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
74 available = [pasteboard availableTypeFromArray: [NSArray arrayWithObject:format]]; |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
75 if ([available isEqualToString:format]) { |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
76 NSString* string; |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
77 const char *utf8; |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
78 |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
79 string = [pasteboard stringForType:format]; |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
80 if (string == nil) { |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
81 utf8 = ""; |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
82 } else { |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
83 utf8 = [string UTF8String]; |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
84 } |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
85 text = SDL_strdup(utf8); |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
86 } else { |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
87 text = SDL_strdup(""); |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
88 } |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
89 |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
90 [pool release]; |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
91 |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
92 return text; |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
93 } |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
94 |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
95 SDL_bool |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
96 Cocoa_HasClipboardText(_THIS) |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
97 { |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
98 NSAutoreleasePool *pool; |
4504
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4503
diff
changeset
|
99 NSPasteboard *pasteboard; |
4501
0cf025066b6f
Updated Xcode project files for clipboard API
Sam Lantinga <slouken@libsdl.org>
parents:
4499
diff
changeset
|
100 NSString *format = GetTextFormat(_this); |
4499
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
101 NSString *available; |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
102 SDL_bool result; |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
103 |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
104 pool = [[NSAutoreleasePool alloc] init]; |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
105 |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
106 pasteboard = [NSPasteboard generalPasteboard]; |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
107 available = [pasteboard availableTypeFromArray: [NSArray arrayWithObject:format]]; |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
108 if ([available isEqualToString:format]) { |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
109 result = SDL_TRUE; |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
110 } else { |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
111 result = SDL_FALSE; |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
112 } |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
113 |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
114 [pool release]; |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
115 |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
116 return result; |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
117 } |
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
118 |
4503
524dfefd554c
Added an event when the clipboard is updated, triggered after the window gains the keyboard focus.
Sam Lantinga <slouken@libsdl.org>
parents:
4501
diff
changeset
|
119 void |
524dfefd554c
Added an event when the clipboard is updated, triggered after the window gains the keyboard focus.
Sam Lantinga <slouken@libsdl.org>
parents:
4501
diff
changeset
|
120 Cocoa_CheckClipboardUpdate(struct SDL_VideoData * data) |
524dfefd554c
Added an event when the clipboard is updated, triggered after the window gains the keyboard focus.
Sam Lantinga <slouken@libsdl.org>
parents:
4501
diff
changeset
|
121 { |
524dfefd554c
Added an event when the clipboard is updated, triggered after the window gains the keyboard focus.
Sam Lantinga <slouken@libsdl.org>
parents:
4501
diff
changeset
|
122 NSAutoreleasePool *pool; |
4504
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4503
diff
changeset
|
123 NSPasteboard *pasteboard; |
4503
524dfefd554c
Added an event when the clipboard is updated, triggered after the window gains the keyboard focus.
Sam Lantinga <slouken@libsdl.org>
parents:
4501
diff
changeset
|
124 NSInteger count; |
524dfefd554c
Added an event when the clipboard is updated, triggered after the window gains the keyboard focus.
Sam Lantinga <slouken@libsdl.org>
parents:
4501
diff
changeset
|
125 |
524dfefd554c
Added an event when the clipboard is updated, triggered after the window gains the keyboard focus.
Sam Lantinga <slouken@libsdl.org>
parents:
4501
diff
changeset
|
126 pool = [[NSAutoreleasePool alloc] init]; |
524dfefd554c
Added an event when the clipboard is updated, triggered after the window gains the keyboard focus.
Sam Lantinga <slouken@libsdl.org>
parents:
4501
diff
changeset
|
127 |
524dfefd554c
Added an event when the clipboard is updated, triggered after the window gains the keyboard focus.
Sam Lantinga <slouken@libsdl.org>
parents:
4501
diff
changeset
|
128 pasteboard = [NSPasteboard generalPasteboard]; |
524dfefd554c
Added an event when the clipboard is updated, triggered after the window gains the keyboard focus.
Sam Lantinga <slouken@libsdl.org>
parents:
4501
diff
changeset
|
129 count = [pasteboard changeCount]; |
524dfefd554c
Added an event when the clipboard is updated, triggered after the window gains the keyboard focus.
Sam Lantinga <slouken@libsdl.org>
parents:
4501
diff
changeset
|
130 if (count != data->clipboard_count) { |
524dfefd554c
Added an event when the clipboard is updated, triggered after the window gains the keyboard focus.
Sam Lantinga <slouken@libsdl.org>
parents:
4501
diff
changeset
|
131 if (data->clipboard_count) { |
524dfefd554c
Added an event when the clipboard is updated, triggered after the window gains the keyboard focus.
Sam Lantinga <slouken@libsdl.org>
parents:
4501
diff
changeset
|
132 SDL_SendClipboardUpdate(); |
524dfefd554c
Added an event when the clipboard is updated, triggered after the window gains the keyboard focus.
Sam Lantinga <slouken@libsdl.org>
parents:
4501
diff
changeset
|
133 } |
524dfefd554c
Added an event when the clipboard is updated, triggered after the window gains the keyboard focus.
Sam Lantinga <slouken@libsdl.org>
parents:
4501
diff
changeset
|
134 data->clipboard_count = count; |
524dfefd554c
Added an event when the clipboard is updated, triggered after the window gains the keyboard focus.
Sam Lantinga <slouken@libsdl.org>
parents:
4501
diff
changeset
|
135 } |
524dfefd554c
Added an event when the clipboard is updated, triggered after the window gains the keyboard focus.
Sam Lantinga <slouken@libsdl.org>
parents:
4501
diff
changeset
|
136 |
524dfefd554c
Added an event when the clipboard is updated, triggered after the window gains the keyboard focus.
Sam Lantinga <slouken@libsdl.org>
parents:
4501
diff
changeset
|
137 [pool release]; |
524dfefd554c
Added an event when the clipboard is updated, triggered after the window gains the keyboard focus.
Sam Lantinga <slouken@libsdl.org>
parents:
4501
diff
changeset
|
138 } |
524dfefd554c
Added an event when the clipboard is updated, triggered after the window gains the keyboard focus.
Sam Lantinga <slouken@libsdl.org>
parents:
4501
diff
changeset
|
139 |
4499
c2ebe3e020c6
Added Mac OS X implementation of clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
140 /* vi: set ts=4 sw=4 expandtab: */ |