Mercurial > sdl-ios-xcode
annotate src/video/windows/SDL_windowsclipboard.c @ 5250:329d435f97f4
Fixed line endings - in Mercurial they're \n
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 10 Feb 2011 14:36:09 -0800 |
parents | e8916fe9cfc8 |
children | f908e06b3c96 |
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_VideoDisplay *display; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
41 SDL_Window *window; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
42 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
43 display = _this->displays; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
44 if (display) { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
45 window = display->windows; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
46 if (window) { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
47 return ((SDL_WindowData *) window->driverdata)->hwnd; |
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 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
50 return NULL; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
51 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
52 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
53 int |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
54 WIN_SetClipboardText(_THIS, const char *text) |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
55 { |
4504
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4500
diff
changeset
|
56 SDL_VideoData *data = (SDL_VideoData *) _this->driverdata; |
4500
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
57 int result = 0; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
58 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
59 if (OpenClipboard(GetWindowHandle(_this))) { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
60 HANDLE hMem; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
61 LPTSTR tstr; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
62 SIZE_T i, size; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
63 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
64 /* Convert the text from UTF-8 to Windows Unicode */ |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
65 tstr = WIN_UTF8ToString(text); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
66 if (!tstr) { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
67 return -1; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
68 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
69 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
70 /* Find out the size of the data */ |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
71 for (size = 0, i = 0; tstr[i]; ++i, ++size) { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
72 if (tstr[i] == '\n' && (i == 0 || tstr[i-1] != '\r')) { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
73 /* We're going to insert a carriage return */ |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
74 ++size; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
75 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
76 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
77 size = (size+1)*sizeof(*tstr); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
78 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
79 /* Save the data to the clipboard */ |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
80 hMem = GlobalAlloc(GMEM_MOVEABLE, size); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
81 if (hMem) { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
82 LPTSTR dst = (LPTSTR)GlobalLock(hMem); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
83 /* Copy the text over, adding carriage returns as necessary */ |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
84 for (i = 0; tstr[i]; ++i) { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
85 if (tstr[i] == '\n' && (i == 0 || tstr[i-1] != '\r')) { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
86 *dst++ = '\r'; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
87 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
88 *dst++ = tstr[i]; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
89 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
90 *dst = 0; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
91 GlobalUnlock(hMem); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
92 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
93 EmptyClipboard(); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
94 if (!SetClipboardData(TEXT_FORMAT, hMem)) { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
95 WIN_SetError("Couldn't set clipboard data"); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
96 result = -1; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
97 } |
4569 | 98 #ifdef _WIN32_WCE |
99 data->clipboard_count = 0; | |
100 #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
|
101 data->clipboard_count = GetClipboardSequenceNumber(); |
4569 | 102 #endif |
4500
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
103 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
104 SDL_free(tstr); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
105 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
106 CloseClipboard(); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
107 } else { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
108 WIN_SetError("Couldn't open clipboard"); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
109 result = -1; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
110 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
111 return result; |
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 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
114 char * |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
115 WIN_GetClipboardText(_THIS) |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
116 { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
117 char *text; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
118 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
119 text = NULL; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
120 if (IsClipboardFormatAvailable(TEXT_FORMAT) && |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
121 OpenClipboard(GetWindowHandle(_this))) { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
122 HANDLE hMem; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
123 LPTSTR tstr; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
124 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
125 hMem = GetClipboardData(TEXT_FORMAT); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
126 if (hMem) { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
127 tstr = (LPTSTR)GlobalLock(hMem); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
128 text = WIN_StringToUTF8(tstr); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
129 GlobalUnlock(hMem); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
130 } else { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
131 WIN_SetError("Couldn't get clipboard data"); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
132 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
133 CloseClipboard(); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
134 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
135 if (!text) { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
136 text = SDL_strdup(""); |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
137 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
138 return text; |
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 |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
141 SDL_bool |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
142 WIN_HasClipboardText(_THIS) |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
143 { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
144 if (IsClipboardFormatAvailable(TEXT_FORMAT)) { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
145 return SDL_TRUE; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
146 } else { |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
147 return SDL_FALSE; |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
148 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
149 } |
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
150 |
4504
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4500
diff
changeset
|
151 void |
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4500
diff
changeset
|
152 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
|
153 { |
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4500
diff
changeset
|
154 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
|
155 |
4569 | 156 #ifdef _WIN32_WCE |
157 count = 0; | |
158 #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
|
159 count = GetClipboardSequenceNumber(); |
4569 | 160 #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
|
161 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
|
162 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
|
163 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
|
164 } |
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4500
diff
changeset
|
165 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
|
166 } |
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4500
diff
changeset
|
167 } |
9faebccfefb3
Amazingly the Windows code is almost identical to the Mac OS X code. :)
Sam Lantinga <slouken@libsdl.org>
parents:
4500
diff
changeset
|
168 |
4500
eff4e88cc1e8
Added Windows clipboard support
Sam Lantinga <slouken@libsdl.org>
parents:
diff
changeset
|
169 /* vi: set ts=4 sw=4 expandtab: */ |