Mercurial > sdl-ios-xcode
annotate src/video/windib/SDL_dibevents.c @ 514:1080bfc4aa96
*** empty log message ***
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 06 Oct 2002 20:25:05 +0000 |
parents | a6fa62b1be09 |
children | 230b156829ed |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
297
f6ffac90895c
Updated copyright information for 2002
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
3 Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
6 modify it under the terms of the GNU Library General Public | |
7 License as published by the Free Software Foundation; either | |
8 version 2 of the License, or (at your option) any later version. | |
9 | |
10 This library is distributed in the hope that it will be useful, | |
11 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 Library General Public License for more details. | |
14 | |
15 You should have received a copy of the GNU Library General Public | |
16 License along with this library; if not, write to the Free | |
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | |
19 Sam Lantinga | |
252
e8157fcb3114
Updated the source with the correct e-mail address
Sam Lantinga <slouken@libsdl.org>
parents:
145
diff
changeset
|
20 slouken@libsdl.org |
0 | 21 */ |
22 | |
23 #ifdef SAVE_RCSID | |
24 static char rcsid = | |
25 "@(#) $Id$"; | |
26 #endif | |
27 | |
28 #include <stdlib.h> | |
29 #include <stdio.h> | |
30 #include <windows.h> | |
514
1080bfc4aa96
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
31 #ifdef HAVE_AYGSHELL |
1080bfc4aa96
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
32 #include <aygshell.h> |
1080bfc4aa96
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
33 #endif |
0 | 34 |
35 #include "SDL_events.h" | |
36 #include "SDL_error.h" | |
37 #include "SDL_syswm.h" | |
38 #include "SDL_sysevents.h" | |
39 #include "SDL_events_c.h" | |
40 #include "SDL_lowvideo.h" | |
41 #include "SDL_dibvideo.h" | |
42 #include "SDL_vkeys.h" | |
43 | |
44 #ifndef WM_APP | |
45 #define WM_APP 0x8000 | |
46 #endif | |
47 | |
48 #ifdef _WIN32_WCE | |
49 #define NO_GETKEYBOARDSTATE | |
50 #endif | |
51 | |
52 /* The translation table from a Microsoft VK keysym to a SDL keysym */ | |
53 static SDLKey VK_keymap[SDLK_LAST]; | |
54 static SDL_keysym *TranslateKey(UINT vkey, UINT scancode, SDL_keysym *keysym, int pressed); | |
55 | |
56 /* Masks for processing the windows KEYDOWN and KEYUP messages */ | |
57 #define REPEATED_KEYMASK (1<<30) | |
58 #define EXTENDED_KEYMASK (1<<24) | |
59 | |
145
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
140
diff
changeset
|
60 /* DJM: If the user setup the window for us, we want to save his window proc, |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
140
diff
changeset
|
61 and give him a chance to handle some messages. */ |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
140
diff
changeset
|
62 static WNDPROC userWindowProc = NULL; |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
140
diff
changeset
|
63 |
0 | 64 /* The main Win32 event handler */ |
65 LONG | |
66 DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) | |
67 { | |
68 extern int posted; | |
69 | |
70 switch (msg) { | |
71 case WM_SYSKEYDOWN: | |
72 case WM_KEYDOWN: { | |
73 SDL_keysym keysym; | |
74 | |
75 /* Ignore repeated keys */ | |
76 if ( lParam&REPEATED_KEYMASK ) { | |
77 return(0); | |
78 } | |
79 switch (wParam) { | |
80 case VK_CONTROL: | |
81 if ( lParam&EXTENDED_KEYMASK ) | |
82 wParam = VK_RCONTROL; | |
83 else | |
84 wParam = VK_LCONTROL; | |
85 break; | |
86 case VK_SHIFT: | |
87 /* EXTENDED trick doesn't work here */ | |
88 wParam = VK_LSHIFT; | |
89 break; | |
90 case VK_MENU: | |
91 if ( lParam&EXTENDED_KEYMASK ) | |
92 wParam = VK_RMENU; | |
93 else | |
94 wParam = VK_LMENU; | |
95 break; | |
96 } | |
112
9ef74357a5fb
Incorporated slightly modified version of Rainer's WinCE patch
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
97 #ifdef NO_GETKEYBOARDSTATE |
9ef74357a5fb
Incorporated slightly modified version of Rainer's WinCE patch
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
98 /* this is the workaround for the missing ToAscii() and ToUnicode() in CE (not necessary at KEYUP!) */ |
9ef74357a5fb
Incorporated slightly modified version of Rainer's WinCE patch
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
99 if ( SDL_TranslateUNICODE ) { |
140
3c35d8f160bd
Fixed compiling on Windows CE
Sam Lantinga <slouken@libsdl.org>
parents:
112
diff
changeset
|
100 MSG m; |
112
9ef74357a5fb
Incorporated slightly modified version of Rainer's WinCE patch
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
101 |
140
3c35d8f160bd
Fixed compiling on Windows CE
Sam Lantinga <slouken@libsdl.org>
parents:
112
diff
changeset
|
102 m.hwnd = hwnd; |
3c35d8f160bd
Fixed compiling on Windows CE
Sam Lantinga <slouken@libsdl.org>
parents:
112
diff
changeset
|
103 m.message = msg; |
3c35d8f160bd
Fixed compiling on Windows CE
Sam Lantinga <slouken@libsdl.org>
parents:
112
diff
changeset
|
104 m.wParam = wParam; |
3c35d8f160bd
Fixed compiling on Windows CE
Sam Lantinga <slouken@libsdl.org>
parents:
112
diff
changeset
|
105 m.lParam = lParam; |
3c35d8f160bd
Fixed compiling on Windows CE
Sam Lantinga <slouken@libsdl.org>
parents:
112
diff
changeset
|
106 m.time = 0; |
3c35d8f160bd
Fixed compiling on Windows CE
Sam Lantinga <slouken@libsdl.org>
parents:
112
diff
changeset
|
107 if ( TranslateMessage(&m) && PeekMessage(&m, hwnd, 0, WM_USER, PM_NOREMOVE) && (m.message == WM_CHAR) ) { |
112
9ef74357a5fb
Incorporated slightly modified version of Rainer's WinCE patch
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
108 GetMessage(&m, hwnd, 0, WM_USER); |
9ef74357a5fb
Incorporated slightly modified version of Rainer's WinCE patch
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
109 wParam = m.wParam; |
9ef74357a5fb
Incorporated slightly modified version of Rainer's WinCE patch
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
110 } else { |
9ef74357a5fb
Incorporated slightly modified version of Rainer's WinCE patch
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
111 wParam = 0; |
9ef74357a5fb
Incorporated slightly modified version of Rainer's WinCE patch
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
112 } |
9ef74357a5fb
Incorporated slightly modified version of Rainer's WinCE patch
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
113 } else { |
9ef74357a5fb
Incorporated slightly modified version of Rainer's WinCE patch
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
114 wParam = 0; |
9ef74357a5fb
Incorporated slightly modified version of Rainer's WinCE patch
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
115 } |
9ef74357a5fb
Incorporated slightly modified version of Rainer's WinCE patch
Sam Lantinga <slouken@lokigames.com>
parents:
36
diff
changeset
|
116 #endif /* NO_GETKEYBOARDSTATE */ |
0 | 117 posted = SDL_PrivateKeyboard(SDL_PRESSED, |
118 TranslateKey(wParam,HIWORD(lParam),&keysym,1)); | |
119 } | |
120 return(0); | |
121 | |
122 case WM_SYSKEYUP: | |
123 case WM_KEYUP: { | |
124 SDL_keysym keysym; | |
125 | |
126 switch (wParam) { | |
127 case VK_CONTROL: | |
128 if ( lParam&EXTENDED_KEYMASK ) | |
129 wParam = VK_RCONTROL; | |
130 else | |
131 wParam = VK_LCONTROL; | |
132 break; | |
133 case VK_SHIFT: | |
134 /* EXTENDED trick doesn't work here */ | |
135 wParam = VK_LSHIFT; | |
136 break; | |
137 case VK_MENU: | |
138 if ( lParam&EXTENDED_KEYMASK ) | |
139 wParam = VK_RMENU; | |
140 else | |
141 wParam = VK_LMENU; | |
142 break; | |
143 } | |
144 posted = SDL_PrivateKeyboard(SDL_RELEASED, | |
145 TranslateKey(wParam,HIWORD(lParam),&keysym,0)); | |
146 } | |
147 return(0); | |
148 | |
149 default: { | |
150 /* Only post the event if we're watching for it */ | |
151 if ( SDL_ProcessEvents[SDL_SYSWMEVENT] == SDL_ENABLE ) { | |
152 SDL_SysWMmsg wmmsg; | |
153 | |
154 SDL_VERSION(&wmmsg.version); | |
155 wmmsg.hwnd = hwnd; | |
156 wmmsg.msg = msg; | |
157 wmmsg.wParam = wParam; | |
158 wmmsg.lParam = lParam; | |
159 posted = SDL_PrivateSysWMEvent(&wmmsg); | |
145
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
140
diff
changeset
|
160 |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
140
diff
changeset
|
161 /* DJM: If the user isn't watching for private |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
140
diff
changeset
|
162 messages in her SDL event loop, then pass it |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
140
diff
changeset
|
163 along to any win32 specific window proc. |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
140
diff
changeset
|
164 */ |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
140
diff
changeset
|
165 } else if (userWindowProc) { |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
140
diff
changeset
|
166 return userWindowProc(hwnd, msg, wParam, lParam); |
0 | 167 } |
168 } | |
169 break; | |
170 } | |
171 return(DefWindowProc(hwnd, msg, wParam, lParam)); | |
172 } | |
173 | |
174 void DIB_PumpEvents(_THIS) | |
175 { | |
176 MSG msg; | |
177 | |
178 while ( PeekMessage(&msg, NULL, 0, (WM_APP-1), PM_NOREMOVE) ) { | |
179 if ( GetMessage(&msg, NULL, 0, (WM_APP-1)) > 0 ) { | |
180 DispatchMessage(&msg); | |
181 } | |
182 } | |
183 } | |
184 | |
185 void DIB_InitOSKeymap(_THIS) | |
186 { | |
187 int i; | |
188 | |
189 /* Map the VK keysyms */ | |
190 for ( i=0; i<SDL_TABLESIZE(VK_keymap); ++i ) | |
191 VK_keymap[i] = SDLK_UNKNOWN; | |
192 | |
193 VK_keymap[VK_BACK] = SDLK_BACKSPACE; | |
194 VK_keymap[VK_TAB] = SDLK_TAB; | |
195 VK_keymap[VK_CLEAR] = SDLK_CLEAR; | |
196 VK_keymap[VK_RETURN] = SDLK_RETURN; | |
197 VK_keymap[VK_PAUSE] = SDLK_PAUSE; | |
198 VK_keymap[VK_ESCAPE] = SDLK_ESCAPE; | |
199 VK_keymap[VK_SPACE] = SDLK_SPACE; | |
200 VK_keymap[VK_APOSTROPHE] = SDLK_QUOTE; | |
201 VK_keymap[VK_COMMA] = SDLK_COMMA; | |
202 VK_keymap[VK_MINUS] = SDLK_MINUS; | |
203 VK_keymap[VK_PERIOD] = SDLK_PERIOD; | |
204 VK_keymap[VK_SLASH] = SDLK_SLASH; | |
205 VK_keymap[VK_0] = SDLK_0; | |
206 VK_keymap[VK_1] = SDLK_1; | |
207 VK_keymap[VK_2] = SDLK_2; | |
208 VK_keymap[VK_3] = SDLK_3; | |
209 VK_keymap[VK_4] = SDLK_4; | |
210 VK_keymap[VK_5] = SDLK_5; | |
211 VK_keymap[VK_6] = SDLK_6; | |
212 VK_keymap[VK_7] = SDLK_7; | |
213 VK_keymap[VK_8] = SDLK_8; | |
214 VK_keymap[VK_9] = SDLK_9; | |
215 VK_keymap[VK_SEMICOLON] = SDLK_SEMICOLON; | |
216 VK_keymap[VK_EQUALS] = SDLK_EQUALS; | |
217 VK_keymap[VK_LBRACKET] = SDLK_LEFTBRACKET; | |
218 VK_keymap[VK_BACKSLASH] = SDLK_BACKSLASH; | |
219 VK_keymap[VK_RBRACKET] = SDLK_RIGHTBRACKET; | |
220 VK_keymap[VK_GRAVE] = SDLK_BACKQUOTE; | |
327
13fc64213765
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
221 VK_keymap[VK_BACKTICK] = SDLK_BACKQUOTE; |
0 | 222 VK_keymap[VK_A] = SDLK_a; |
223 VK_keymap[VK_B] = SDLK_b; | |
224 VK_keymap[VK_C] = SDLK_c; | |
225 VK_keymap[VK_D] = SDLK_d; | |
226 VK_keymap[VK_E] = SDLK_e; | |
227 VK_keymap[VK_F] = SDLK_f; | |
228 VK_keymap[VK_G] = SDLK_g; | |
229 VK_keymap[VK_H] = SDLK_h; | |
230 VK_keymap[VK_I] = SDLK_i; | |
231 VK_keymap[VK_J] = SDLK_j; | |
232 VK_keymap[VK_K] = SDLK_k; | |
233 VK_keymap[VK_L] = SDLK_l; | |
234 VK_keymap[VK_M] = SDLK_m; | |
235 VK_keymap[VK_N] = SDLK_n; | |
236 VK_keymap[VK_O] = SDLK_o; | |
237 VK_keymap[VK_P] = SDLK_p; | |
238 VK_keymap[VK_Q] = SDLK_q; | |
239 VK_keymap[VK_R] = SDLK_r; | |
240 VK_keymap[VK_S] = SDLK_s; | |
241 VK_keymap[VK_T] = SDLK_t; | |
242 VK_keymap[VK_U] = SDLK_u; | |
243 VK_keymap[VK_V] = SDLK_v; | |
244 VK_keymap[VK_W] = SDLK_w; | |
245 VK_keymap[VK_X] = SDLK_x; | |
246 VK_keymap[VK_Y] = SDLK_y; | |
247 VK_keymap[VK_Z] = SDLK_z; | |
248 VK_keymap[VK_DELETE] = SDLK_DELETE; | |
249 | |
250 VK_keymap[VK_NUMPAD0] = SDLK_KP0; | |
251 VK_keymap[VK_NUMPAD1] = SDLK_KP1; | |
252 VK_keymap[VK_NUMPAD2] = SDLK_KP2; | |
253 VK_keymap[VK_NUMPAD3] = SDLK_KP3; | |
254 VK_keymap[VK_NUMPAD4] = SDLK_KP4; | |
255 VK_keymap[VK_NUMPAD5] = SDLK_KP5; | |
256 VK_keymap[VK_NUMPAD6] = SDLK_KP6; | |
257 VK_keymap[VK_NUMPAD7] = SDLK_KP7; | |
258 VK_keymap[VK_NUMPAD8] = SDLK_KP8; | |
259 VK_keymap[VK_NUMPAD9] = SDLK_KP9; | |
260 VK_keymap[VK_DECIMAL] = SDLK_KP_PERIOD; | |
261 VK_keymap[VK_DIVIDE] = SDLK_KP_DIVIDE; | |
262 VK_keymap[VK_MULTIPLY] = SDLK_KP_MULTIPLY; | |
263 VK_keymap[VK_SUBTRACT] = SDLK_KP_MINUS; | |
264 VK_keymap[VK_ADD] = SDLK_KP_PLUS; | |
265 | |
266 VK_keymap[VK_UP] = SDLK_UP; | |
267 VK_keymap[VK_DOWN] = SDLK_DOWN; | |
268 VK_keymap[VK_RIGHT] = SDLK_RIGHT; | |
269 VK_keymap[VK_LEFT] = SDLK_LEFT; | |
270 VK_keymap[VK_INSERT] = SDLK_INSERT; | |
271 VK_keymap[VK_HOME] = SDLK_HOME; | |
272 VK_keymap[VK_END] = SDLK_END; | |
273 VK_keymap[VK_PRIOR] = SDLK_PAGEUP; | |
274 VK_keymap[VK_NEXT] = SDLK_PAGEDOWN; | |
275 | |
276 VK_keymap[VK_F1] = SDLK_F1; | |
277 VK_keymap[VK_F2] = SDLK_F2; | |
278 VK_keymap[VK_F3] = SDLK_F3; | |
279 VK_keymap[VK_F4] = SDLK_F4; | |
280 VK_keymap[VK_F5] = SDLK_F5; | |
281 VK_keymap[VK_F6] = SDLK_F6; | |
282 VK_keymap[VK_F7] = SDLK_F7; | |
283 VK_keymap[VK_F8] = SDLK_F8; | |
284 VK_keymap[VK_F9] = SDLK_F9; | |
285 VK_keymap[VK_F10] = SDLK_F10; | |
286 VK_keymap[VK_F11] = SDLK_F11; | |
287 VK_keymap[VK_F12] = SDLK_F12; | |
288 VK_keymap[VK_F13] = SDLK_F13; | |
289 VK_keymap[VK_F14] = SDLK_F14; | |
290 VK_keymap[VK_F15] = SDLK_F15; | |
291 | |
292 VK_keymap[VK_NUMLOCK] = SDLK_NUMLOCK; | |
293 VK_keymap[VK_CAPITAL] = SDLK_CAPSLOCK; | |
294 VK_keymap[VK_SCROLL] = SDLK_SCROLLOCK; | |
295 VK_keymap[VK_RSHIFT] = SDLK_RSHIFT; | |
296 VK_keymap[VK_LSHIFT] = SDLK_LSHIFT; | |
297 VK_keymap[VK_RCONTROL] = SDLK_RCTRL; | |
298 VK_keymap[VK_LCONTROL] = SDLK_LCTRL; | |
299 VK_keymap[VK_RMENU] = SDLK_RALT; | |
300 VK_keymap[VK_LMENU] = SDLK_LALT; | |
301 VK_keymap[VK_RWIN] = SDLK_RSUPER; | |
302 VK_keymap[VK_LWIN] = SDLK_LSUPER; | |
303 | |
304 VK_keymap[VK_HELP] = SDLK_HELP; | |
305 #ifdef VK_PRINT | |
306 VK_keymap[VK_PRINT] = SDLK_PRINT; | |
307 #endif | |
308 VK_keymap[VK_SNAPSHOT] = SDLK_PRINT; | |
309 VK_keymap[VK_CANCEL] = SDLK_BREAK; | |
310 VK_keymap[VK_APPS] = SDLK_MENU; | |
311 } | |
312 | |
313 static SDL_keysym *TranslateKey(UINT vkey, UINT scancode, SDL_keysym *keysym, int pressed) | |
314 { | |
315 /* Set the keysym information */ | |
316 keysym->scancode = (unsigned char) scancode; | |
317 keysym->sym = VK_keymap[vkey]; | |
318 keysym->mod = KMOD_NONE; | |
319 keysym->unicode = 0; | |
320 if ( pressed && SDL_TranslateUNICODE ) { /* Someday use ToUnicode() */ | |
321 #ifdef NO_GETKEYBOARDSTATE | |
322 /* Uh oh, better hope the vkey is close enough.. */ | |
323 keysym->unicode = vkey; | |
324 #else | |
325 BYTE keystate[256]; | |
326 BYTE chars[2]; | |
327 | |
328 GetKeyboardState(keystate); | |
329 if ( ToAscii(vkey,scancode,keystate,(WORD *)chars,0) == 1 ) { | |
330 keysym->unicode = chars[0]; | |
331 } | |
332 #endif /* NO_GETKEYBOARDSTATE */ | |
333 } | |
334 return(keysym); | |
335 } | |
336 | |
337 int DIB_CreateWindow(_THIS) | |
338 { | |
453
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
421
diff
changeset
|
339 #ifndef CS_BYTEALIGNCLIENT |
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
421
diff
changeset
|
340 #define CS_BYTEALIGNCLIENT 0 |
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
421
diff
changeset
|
341 #endif |
0 | 342 SDL_RegisterApp("SDL_app", CS_BYTEALIGNCLIENT, 0); |
343 if ( SDL_windowid ) { | |
344 SDL_Window = (HWND)strtol(SDL_windowid, NULL, 0); | |
145
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
140
diff
changeset
|
345 |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
140
diff
changeset
|
346 /* DJM: we want all event's for the user specified |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
140
diff
changeset
|
347 window to be handled by SDL. |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
140
diff
changeset
|
348 */ |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
140
diff
changeset
|
349 if (SDL_Window) { |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
140
diff
changeset
|
350 userWindowProc = (WNDPROC)GetWindowLong(SDL_Window, GWL_WNDPROC); |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
140
diff
changeset
|
351 SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)WinMessage); |
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
140
diff
changeset
|
352 } |
0 | 353 } else { |
354 SDL_Window = CreateWindow(SDL_Appname, SDL_Appname, | |
355 (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX), | |
356 0, 0, 0, 0, NULL, NULL, SDL_Instance, NULL); | |
357 if ( SDL_Window == NULL ) { | |
358 SDL_SetError("Couldn't create window"); | |
359 return(-1); | |
360 } | |
361 ShowWindow(SDL_Window, SW_HIDE); | |
362 } | |
363 return(0); | |
364 } | |
365 | |
366 void DIB_DestroyWindow(_THIS) | |
367 { | |
368 if ( SDL_windowid == NULL ) { | |
514
1080bfc4aa96
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
369 #ifdef HAVE_AYGSHELL |
1080bfc4aa96
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
370 /* Unhide taskbar, etc. */ |
1080bfc4aa96
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
371 SHFullScreen(SDL_Window, SHFS_SHOWTASKBAR); |
1080bfc4aa96
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
372 SHFullScreen(SDL_Window, SHFS_SHOWSIPBUTTON); |
1080bfc4aa96
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
373 ShowWindow(FindWindow(TEXT("HHTaskBar"),NULL),SW_SHOWNORMAL); |
1080bfc4aa96
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
374 #endif |
0 | 375 DestroyWindow(SDL_Window); |
376 } | |
377 } |