Mercurial > sdl-ios-xcode
annotate src/video/windows/SDL_windowsclipboard.c @ 5255:f908e06b3c96
Fixed compiling on Windows
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Fri, 11 Feb 2011 10:13:30 -0800 |
parents | e8916fe9cfc8 |
children | b530ef003506 |
rev | line source |
---|---|
4500
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
1 /* |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
2 SDL - Simple DirectMedia Layer |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
3 Copyright (C) 1997-2010 Sam Lantinga |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
4 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
5 This library is free software; you can redistribute it and/or |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
7 License as published by the Free Software Foundation; either |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
9 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
10 This library is distributed in the hope that it will be useful, |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
11 but WITHOUT ANY WARRANTY; without even the implied warranty of |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
13 Lesser General Public License for more details. |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
14 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
18 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
19 Sam Lantinga |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
20 slouken@libsdl.org |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
21 */ |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
22 #include "SDL_config.h" |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
23 |
5062 | 24 #include "SDL_windowsvideo.h" |
25 #include "SDL_windowswindow.h" | |
4504
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4500
diff
changeset
|
26 #include "../../events/SDL_clipboardevents_c.h" |
4500
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
27 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
28 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
29 #ifdef UNICODE |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
30 #define TEXT_FORMAT CF_UNICODETEXT |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
31 #else |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
32 #define TEXT_FORMAT CF_TEXT |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
33 #endif |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
34 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
35 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
36 /* Get any application owned window handle for clipboard association */ |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
37 static HWND |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
38 GetWindowHandle(_THIS) |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
39 { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
40 SDL_Window *window; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
41 |
5255
f908e06b3c96
Fixed compiling on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
42 window = _this->windows; |
f908e06b3c96
Fixed compiling on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
43 if (window) { |
f908e06b3c96
Fixed compiling on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
5062
diff
changeset
|
44 return ((SDL_WindowData *) window->driverdata)->hwnd; |
4500
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
45 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
46 return NULL; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
48 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
49 int |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
50 WIN_SetClipboardText(_THIS, const char *text) |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
51 { |
4504
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4500
diff
changeset
|
52 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; |
4500
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 int result = 0; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
54 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
55 if (OpenClipboard(GetWindowHandle(_this))) { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
56 HANDLE hMem; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
57 LPTSTR tstr; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
58 SIZE_T i, size; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
59 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
60 /* Convert the text from UTF-8 to Windows Unicode */ |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
61 tstr = WIN_UTF8ToString(text); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
62 if (!tstr) { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
63 return -1; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
64 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
65 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
66 /* Find out the size of the data */ |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
67 for (size = 0, i = 0; tstr[i]; ++i, ++size) { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
68 if (tstr[i] == '\n' && (i == 0 || tstr[i-1] != '\r')) { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
69 /* We're going to insert a carriage return */ |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
70 ++size; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
71 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
72 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
73 size = (size+1)*sizeof(*tstr); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
74 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
75 /* Save the data to the clipboard */ |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
76 hMem = GlobalAlloc(GMEM_MOVEABLE, size); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
77 if (hMem) { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
78 LPTSTR dst = (LPTSTR)GlobalLock(hMem); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
79 /* Copy the text over, adding carriage returns as necessary */ |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
80 for (i = 0; tstr[i]; ++i) { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
81 if (tstr[i] == '\n' && (i == 0 || tstr[i-1] != '\r')) { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
82 *dst++ = '\r'; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
83 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
84 *dst++ = tstr[i]; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
85 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
86 *dst = 0; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
87 GlobalUnlock(hMem); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
88 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
89 EmptyClipboard(); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
90 if (!SetClipboardData(TEXT_FORMAT, hMem)) { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
91 WIN_SetError("Couldn't set clipboard data"); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
92 result = -1; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
93 } |
4569 | 94 #ifdef _WIN32_WCE |
95 data->clipboard_count = 0; | |
96 #else | |
4504
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4500
diff
changeset
|
97 data->clipboard_count = GetClipboardSequenceNumber(); |
4569 | 98 #endif |
4500
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
99 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
100 SDL_free(tstr); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
101 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
102 CloseClipboard(); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
103 } else { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
104 WIN_SetError("Couldn't open clipboard"); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
105 result = -1; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
106 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
107 return result; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
108 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
109 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
110 char * |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
111 WIN_GetClipboardText(_THIS) |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
112 { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
113 char *text; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
114 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
115 text = NULL; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
116 if (IsClipboardFormatAvailable(TEXT_FORMAT) && |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
117 OpenClipboard(GetWindowHandle(_this))) { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
118 HANDLE hMem; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
119 LPTSTR tstr; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
120 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
121 hMem = GetClipboardData(TEXT_FORMAT); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
122 if (hMem) { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
123 tstr = (LPTSTR)GlobalLock(hMem); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
124 text = WIN_StringToUTF8(tstr); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
125 GlobalUnlock(hMem); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 } else { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
127 WIN_SetError("Couldn't get clipboard data"); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
128 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
129 CloseClipboard(); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
130 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
131 if (!text) { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
132 text = SDL_strdup(""); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
133 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
134 return text; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
135 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
136 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
137 SDL_bool |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
138 WIN_HasClipboardText(_THIS) |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
139 { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
140 if (IsClipboardFormatAvailable(TEXT_FORMAT)) { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
141 return SDL_TRUE; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
142 } else { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
143 return SDL_FALSE; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
144 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
145 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
146 |
4504
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4500
diff
changeset
|
147 void |
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4500
diff
changeset
|
148 WIN_CheckClipboardUpdate(struct SDL_VideoData * data) |
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4500
diff
changeset
|
149 { |
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4500
diff
changeset
|
150 DWORD count; |
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4500
diff
changeset
|
151 |
4569 | 152 #ifdef _WIN32_WCE |
153 count = 0; | |
154 #else | |
4504
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4500
diff
changeset
|
155 count = GetClipboardSequenceNumber(); |
4569 | 156 #endif |
4504
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4500
diff
changeset
|
157 if (count != data->clipboard_count) { |
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4500
diff
changeset
|
158 if (data->clipboard_count) { |
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4500
diff
changeset
|
159 SDL_SendClipboardUpdate(); |
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4500
diff
changeset
|
160 } |
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4500
diff
changeset
|
161 data->clipboard_count = count; |
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4500
diff
changeset
|
162 } |
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4500
diff
changeset
|
163 } |
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4500
diff
changeset
|
164 |
4500
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
165 /* vi: set ts=4 sw=4 expandtab: */ |