Mercurial > sdl-ios-xcode
annotate src/video/windx5/SDL_dx5events.c @ 1379:c0a74f199ecf
Use only safe string functions
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Sun, 19 Feb 2006 23:46:34 +0000 |
parents | 19418e4422cb |
children | d910939febfa |
rev | line source |
---|---|
0 | 1 /* |
2 SDL - Simple DirectMedia Layer | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1303
diff
changeset
|
3 Copyright (C) 1997-2006 Sam Lantinga |
0 | 4 |
5 This library is free software; you can redistribute it and/or | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1303
diff
changeset
|
6 modify it under the terms of the GNU Lesser General Public |
0 | 7 License as published by the Free Software Foundation; either |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1303
diff
changeset
|
8 version 2.1 of the License, or (at your option) any later version. |
0 | 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 | |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1303
diff
changeset
|
13 Lesser General Public License for more details. |
0 | 14 |
1312
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1303
diff
changeset
|
15 You should have received a copy of the GNU Lesser General Public |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1303
diff
changeset
|
16 License along with this library; if not, write to the Free Software |
c9b51268668f
Updated copyright information and removed rcs id lines (problematic in branch merges)
Sam Lantinga <slouken@libsdl.org>
parents:
1303
diff
changeset
|
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
0 | 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 /* CAUTION!!!! If you modify this file, check ../windib/SDL_sysevents.c */ | |
24 | |
25 #include "directx.h" | |
26 | |
1358
c71e05b4dc2e
More header massaging... works great on Windows. ;-)
Sam Lantinga <slouken@libsdl.org>
parents:
1348
diff
changeset
|
27 #include "SDL_main.h" |
0 | 28 #include "SDL_events.h" |
29 #include "SDL_video.h" | |
30 #include "SDL_syswm.h" | |
1361
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
31 #include "../../events/SDL_sysevents.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
32 #include "../../events/SDL_events_c.h" |
19418e4422cb
New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents:
1358
diff
changeset
|
33 #include "../wincommon/SDL_lowvideo.h" |
0 | 34 #include "SDL_dx5video.h" |
35 | |
36 #ifndef WM_APP | |
37 #define WM_APP 0x8000 | |
38 #endif | |
39 | |
453
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
40 #ifdef _WIN32_WCE |
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
41 #define NO_GETKEYBOARDSTATE |
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
42 #endif |
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
43 |
0 | 44 /* The keyboard and mouse device input */ |
45 #define MAX_INPUTS 16 /* Maximum of 16-1 input devices */ | |
536
bf7f477fb2b2
Fixed potential dropped events under DirectInput
Sam Lantinga <slouken@libsdl.org>
parents:
523
diff
changeset
|
46 #define INPUT_QSIZE 512 /* Buffer up to 512 input messages */ |
0 | 47 |
48 static LPDIRECTINPUT dinput = NULL; | |
49 static LPDIRECTINPUTDEVICE2 SDL_DIdev[MAX_INPUTS]; | |
50 static HANDLE SDL_DIevt[MAX_INPUTS]; | |
51 static void (*SDL_DIfun[MAX_INPUTS])(const int, DIDEVICEOBJECTDATA *); | |
52 static int SDL_DIndev = 0; | |
53 static int mouse_lost; | |
54 static int mouse_pressed; | |
491
da6a7e859616
Applied John Popplewell's fix for left-handed mice under Windows.
Sam Lantinga <slouken@libsdl.org>
parents:
460
diff
changeset
|
55 static int mouse_buttons_swapped = 0; |
0 | 56 |
57 /* The translation table from a DirectInput scancode to an SDL keysym */ | |
58 static SDLKey DIK_keymap[256]; | |
59 static SDL_keysym *TranslateKey(UINT scancode, SDL_keysym *keysym, int pressed); | |
60 | |
145
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
61
diff
changeset
|
61 /* 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:
61
diff
changeset
|
62 and give him a chance to handle some messages. */ |
1303
52b5afd7ecee
Date: Tue, 05 Jul 2005 21:43:26 +1000
Sam Lantinga <slouken@libsdl.org>
parents:
1288
diff
changeset
|
63 #ifdef STRICT |
52b5afd7ecee
Date: Tue, 05 Jul 2005 21:43:26 +1000
Sam Lantinga <slouken@libsdl.org>
parents:
1288
diff
changeset
|
64 #define WNDPROCTYPE WNDPROC |
52b5afd7ecee
Date: Tue, 05 Jul 2005 21:43:26 +1000
Sam Lantinga <slouken@libsdl.org>
parents:
1288
diff
changeset
|
65 #else |
52b5afd7ecee
Date: Tue, 05 Jul 2005 21:43:26 +1000
Sam Lantinga <slouken@libsdl.org>
parents:
1288
diff
changeset
|
66 #define WNDPROCTYPE FARPROC |
52b5afd7ecee
Date: Tue, 05 Jul 2005 21:43:26 +1000
Sam Lantinga <slouken@libsdl.org>
parents:
1288
diff
changeset
|
67 #endif |
52b5afd7ecee
Date: Tue, 05 Jul 2005 21:43:26 +1000
Sam Lantinga <slouken@libsdl.org>
parents:
1288
diff
changeset
|
68 static WNDPROCTYPE userWindowProc = NULL; |
145
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
61
diff
changeset
|
69 |
1114
242a35a85852
Patches to make SDL compatible with Win95 again.
Ryan C. Gordon <icculus@icculus.org>
parents:
975
diff
changeset
|
70 static HWND GetTopLevelParent(HWND hWnd) |
242a35a85852
Patches to make SDL compatible with Win95 again.
Ryan C. Gordon <icculus@icculus.org>
parents:
975
diff
changeset
|
71 { |
242a35a85852
Patches to make SDL compatible with Win95 again.
Ryan C. Gordon <icculus@icculus.org>
parents:
975
diff
changeset
|
72 HWND hParentWnd; |
242a35a85852
Patches to make SDL compatible with Win95 again.
Ryan C. Gordon <icculus@icculus.org>
parents:
975
diff
changeset
|
73 while (1) |
242a35a85852
Patches to make SDL compatible with Win95 again.
Ryan C. Gordon <icculus@icculus.org>
parents:
975
diff
changeset
|
74 { |
242a35a85852
Patches to make SDL compatible with Win95 again.
Ryan C. Gordon <icculus@icculus.org>
parents:
975
diff
changeset
|
75 hParentWnd = GetParent(hWnd); |
242a35a85852
Patches to make SDL compatible with Win95 again.
Ryan C. Gordon <icculus@icculus.org>
parents:
975
diff
changeset
|
76 if (hParentWnd == NULL) |
242a35a85852
Patches to make SDL compatible with Win95 again.
Ryan C. Gordon <icculus@icculus.org>
parents:
975
diff
changeset
|
77 break; |
242a35a85852
Patches to make SDL compatible with Win95 again.
Ryan C. Gordon <icculus@icculus.org>
parents:
975
diff
changeset
|
78 hWnd = hParentWnd; |
242a35a85852
Patches to make SDL compatible with Win95 again.
Ryan C. Gordon <icculus@icculus.org>
parents:
975
diff
changeset
|
79 } |
242a35a85852
Patches to make SDL compatible with Win95 again.
Ryan C. Gordon <icculus@icculus.org>
parents:
975
diff
changeset
|
80 return hWnd; |
242a35a85852
Patches to make SDL compatible with Win95 again.
Ryan C. Gordon <icculus@icculus.org>
parents:
975
diff
changeset
|
81 } |
242a35a85852
Patches to make SDL compatible with Win95 again.
Ryan C. Gordon <icculus@icculus.org>
parents:
975
diff
changeset
|
82 |
0 | 83 /* Convert a DirectInput return code to a text message */ |
84 static void SetDIerror(char *function, int code) | |
85 { | |
86 static char *error; | |
453
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
87 static char errbuf[1024]; |
0 | 88 |
89 errbuf[0] = 0; | |
90 switch (code) { | |
91 case DIERR_GENERIC: | |
92 error = "Undefined error!"; | |
93 break; | |
94 case DIERR_OLDDIRECTINPUTVERSION: | |
95 error = "Your version of DirectInput needs upgrading"; | |
96 break; | |
97 case DIERR_INVALIDPARAM: | |
98 error = "Invalid parameters"; | |
99 break; | |
100 case DIERR_OUTOFMEMORY: | |
101 error = "Out of memory"; | |
102 break; | |
103 case DIERR_DEVICENOTREG: | |
104 error = "Device not registered"; | |
105 break; | |
106 case DIERR_NOINTERFACE: | |
107 error = "Interface not supported"; | |
108 break; | |
109 case DIERR_NOTINITIALIZED: | |
110 error = "Device not initialized"; | |
111 break; | |
112 default: | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1330
diff
changeset
|
113 SDL_snprintf(errbuf, SDL_arraysize(errbuf), |
1330
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
114 "%s: Unknown DirectInput error: 0x%x", |
0 | 115 function, code); |
116 break; | |
117 } | |
118 if ( ! errbuf[0] ) { | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1330
diff
changeset
|
119 SDL_snprintf(errbuf, SDL_arraysize(errbuf), "%s: %s", function, error); |
0 | 120 } |
121 SDL_SetError("%s", errbuf); | |
122 return; | |
123 } | |
124 | |
125 /* Initialize DirectInput | |
126 Note: If NONEXCLUSIVE access is requested for the devices, normal | |
127 windows input messages will continue to be generated for that | |
128 input device, in addition to DirectInput messages. | |
129 */ | |
130 static void handle_keyboard(const int numevents, DIDEVICEOBJECTDATA *events); | |
131 static void handle_mouse(const int numevents, DIDEVICEOBJECTDATA *events); | |
132 struct { | |
133 char *name; | |
134 REFGUID guid; | |
135 LPCDIDATAFORMAT format; | |
136 DWORD win_level; | |
137 DWORD raw_level; | |
138 void (*fun)(const int numevents, DIDEVICEOBJECTDATA *events); | |
139 } inputs[] = { | |
140 { "keyboard", | |
141 &GUID_SysKeyboard, &c_dfDIKeyboard, | |
142 (DISCL_FOREGROUND|DISCL_NONEXCLUSIVE), | |
143 (DISCL_FOREGROUND|DISCL_NONEXCLUSIVE), handle_keyboard }, | |
144 { "mouse", | |
145 &GUID_SysMouse, &c_dfDIMouse, | |
146 (DISCL_FOREGROUND|DISCL_NONEXCLUSIVE), | |
147 (DISCL_FOREGROUND|DISCL_EXCLUSIVE), handle_mouse }, | |
148 { NULL, NULL, NULL, 0, 0, NULL } | |
149 }; | |
150 | |
151 static int DX5_DInputInit(_THIS) | |
152 { | |
153 int i; | |
154 LPDIRECTINPUTDEVICE device; | |
155 HRESULT result; | |
156 DIPROPDWORD dipdw; | |
970
fb8b91365766
Date: Tue, 19 Oct 2004 23:04:58 -0700
Sam Lantinga <slouken@libsdl.org>
parents:
833
diff
changeset
|
157 HWND topwnd; |
0 | 158 |
159 /* Create the DirectInput object */ | |
160 result = DInputCreate(SDL_Instance, DIRECTINPUT_VERSION, | |
161 &dinput, NULL); | |
162 if ( result != DI_OK ) { | |
163 SetDIerror("DirectInputCreate", result); | |
164 return(-1); | |
165 } | |
166 | |
167 /* Create all of our registered input devices */ | |
168 SDL_DIndev = 0; | |
169 for ( i=0; inputs[i].name; ++i ) { | |
170 /* Create the DirectInput device */ | |
171 result = IDirectInput_CreateDevice(dinput, inputs[i].guid, | |
172 &device, NULL); | |
173 if ( result != DI_OK ) { | |
174 SetDIerror("DirectInput::CreateDevice", result); | |
175 return(-1); | |
176 } | |
177 result = IDirectInputDevice_QueryInterface(device, | |
178 &IID_IDirectInputDevice2, (LPVOID *)&SDL_DIdev[i]); | |
179 IDirectInputDevice_Release(device); | |
180 if ( result != DI_OK ) { | |
181 SetDIerror("DirectInputDevice::QueryInterface", result); | |
182 return(-1); | |
183 } | |
1115
040aa1bea9fc
Fixed mismerged patch.
Ryan C. Gordon <icculus@icculus.org>
parents:
1114
diff
changeset
|
184 topwnd = GetTopLevelParent(SDL_Window); |
0 | 185 result = IDirectInputDevice2_SetCooperativeLevel(SDL_DIdev[i], |
970
fb8b91365766
Date: Tue, 19 Oct 2004 23:04:58 -0700
Sam Lantinga <slouken@libsdl.org>
parents:
833
diff
changeset
|
186 topwnd, inputs[i].win_level); |
0 | 187 if ( result != DI_OK ) { |
188 SetDIerror("DirectInputDevice::SetCooperativeLevel", | |
189 result); | |
190 return(-1); | |
191 } | |
192 result = IDirectInputDevice2_SetDataFormat(SDL_DIdev[i], | |
193 inputs[i].format); | |
194 if ( result != DI_OK ) { | |
195 SetDIerror("DirectInputDevice::SetDataFormat", result); | |
196 return(-1); | |
197 } | |
198 | |
199 /* Set buffered input -- we aren't polling */ | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1330
diff
changeset
|
200 SDL_memset(&dipdw, 0, sizeof(dipdw)); |
0 | 201 dipdw.diph.dwSize = sizeof(dipdw); |
202 dipdw.diph.dwHeaderSize = sizeof(dipdw.diph); | |
203 dipdw.diph.dwObj = 0; | |
204 dipdw.diph.dwHow = DIPH_DEVICE; | |
205 dipdw.dwData = INPUT_QSIZE; | |
206 result = IDirectInputDevice2_SetProperty(SDL_DIdev[i], | |
207 DIPROP_BUFFERSIZE, &dipdw.diph); | |
208 if ( result != DI_OK ) { | |
209 SetDIerror("DirectInputDevice::SetProperty", result); | |
210 return(-1); | |
211 } | |
212 | |
213 /* Create an event to be signaled when input is ready */ | |
214 SDL_DIevt[i] = CreateEvent(NULL, FALSE, FALSE, NULL); | |
215 if ( SDL_DIevt[i] == NULL ) { | |
216 SDL_SetError("Couldn't create DirectInput event"); | |
217 return(-1); | |
218 } | |
219 result = IDirectInputDevice2_SetEventNotification(SDL_DIdev[i], | |
220 SDL_DIevt[i]); | |
221 if ( result != DI_OK ) { | |
222 SetDIerror("DirectInputDevice::SetEventNotification", | |
223 result); | |
224 return(-1); | |
225 } | |
226 SDL_DIfun[i] = inputs[i].fun; | |
227 | |
228 /* Acquire the device for input */ | |
229 IDirectInputDevice2_Acquire(SDL_DIdev[i]); | |
230 | |
231 /* Increment the number of devices we have */ | |
232 ++SDL_DIndev; | |
233 } | |
234 mouse_pressed = 0; | |
491
da6a7e859616
Applied John Popplewell's fix for left-handed mice under Windows.
Sam Lantinga <slouken@libsdl.org>
parents:
460
diff
changeset
|
235 mouse_buttons_swapped = GetSystemMetrics(SM_SWAPBUTTON); |
0 | 236 |
237 /* DirectInput is ready! */ | |
238 return(0); | |
239 } | |
240 | |
241 /* Clean up DirectInput */ | |
242 static void DX5_DInputQuit(_THIS) | |
243 { | |
244 int i; | |
245 | |
246 if ( dinput != NULL ) { | |
247 /* Close and release all DirectInput devices */ | |
248 for ( i=0; i<MAX_INPUTS; ++i ) { | |
249 if ( SDL_DIdev[i] != NULL ) { | |
250 IDirectInputDevice2_Unacquire(SDL_DIdev[i]); | |
251 IDirectInputDevice2_SetEventNotification( | |
252 SDL_DIdev[i], NULL); | |
253 if ( SDL_DIevt[i] != NULL ) { | |
254 CloseHandle(SDL_DIevt[i]); | |
255 SDL_DIevt[i] = NULL; | |
256 } | |
257 IDirectInputDevice2_Release(SDL_DIdev[i]); | |
258 SDL_DIdev[i] = NULL; | |
259 } | |
260 } | |
261 /* Release DirectInput */ | |
262 IDirectInput_Release(dinput); | |
263 dinput = NULL; | |
264 } | |
265 } | |
266 | |
267 /* Flag to tell SDL whether or not we queued an event */ | |
268 static int posted = 0; | |
269 | |
270 /* Input event handler functions */ | |
271 static void handle_keyboard(const int numevents, DIDEVICEOBJECTDATA *keybuf) | |
272 { | |
273 int i; | |
274 SDL_keysym keysym; | |
275 | |
276 /* Translate keyboard messages */ | |
277 for ( i=0; i<numevents; ++i ) { | |
278 if ( keybuf[i].dwData & 0x80 ) { | |
279 posted = SDL_PrivateKeyboard(SDL_PRESSED, | |
280 TranslateKey(keybuf[i].dwOfs, &keysym, 1)); | |
281 } else { | |
282 posted = SDL_PrivateKeyboard(SDL_RELEASED, | |
283 TranslateKey(keybuf[i].dwOfs, &keysym, 0)); | |
284 } | |
285 } | |
286 } | |
287 static void handle_mouse(const int numevents, DIDEVICEOBJECTDATA *ptrbuf) | |
288 { | |
289 int i; | |
290 Sint16 xrel, yrel; | |
291 Uint8 state; | |
292 Uint8 button; | |
536
bf7f477fb2b2
Fixed potential dropped events under DirectInput
Sam Lantinga <slouken@libsdl.org>
parents:
523
diff
changeset
|
293 DWORD timestamp = 0; |
0 | 294 |
717
42ed44b2c8b6
Date: Sun, 14 Sep 2003 17:04:55 -0400
Ryan C. Gordon <icculus@icculus.org>
parents:
536
diff
changeset
|
295 /* Sanity check. Mailing list reports this being NULL unexpectedly. */ |
42ed44b2c8b6
Date: Sun, 14 Sep 2003 17:04:55 -0400
Ryan C. Gordon <icculus@icculus.org>
parents:
536
diff
changeset
|
296 if (SDL_PublicSurface == NULL) { |
42ed44b2c8b6
Date: Sun, 14 Sep 2003 17:04:55 -0400
Ryan C. Gordon <icculus@icculus.org>
parents:
536
diff
changeset
|
297 return; |
42ed44b2c8b6
Date: Sun, 14 Sep 2003 17:04:55 -0400
Ryan C. Gordon <icculus@icculus.org>
parents:
536
diff
changeset
|
298 } |
42ed44b2c8b6
Date: Sun, 14 Sep 2003 17:04:55 -0400
Ryan C. Gordon <icculus@icculus.org>
parents:
536
diff
changeset
|
299 |
0 | 300 /* If we are in windowed mode, Windows is taking care of the mouse */ |
325
1b5457c0a8ad
Fixed the bug where mouse cursor and SDL mouse coordinates didn't match
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
301 if ( (SDL_PublicSurface->flags & SDL_OPENGL) || |
1b5457c0a8ad
Fixed the bug where mouse cursor and SDL mouse coordinates didn't match
Sam Lantinga <slouken@libsdl.org>
parents:
297
diff
changeset
|
302 !(SDL_PublicSurface->flags & SDL_FULLSCREEN) ) { |
0 | 303 return; |
304 } | |
305 | |
306 /* If the mouse was lost, regain some sense of mouse state */ | |
307 if ( mouse_lost ) { | |
308 POINT mouse_pos; | |
309 Uint8 old_state; | |
310 Uint8 new_state; | |
311 | |
312 /* Set ourselves up with the current cursor position */ | |
313 GetCursorPos(&mouse_pos); | |
314 ScreenToClient(SDL_Window, &mouse_pos); | |
315 posted = SDL_PrivateMouseMotion(0, 0, | |
316 (Sint16)mouse_pos.x, (Sint16)mouse_pos.y); | |
317 | |
318 /* Check for mouse button changes */ | |
319 old_state = SDL_GetMouseState(NULL, NULL); | |
320 new_state = 0; | |
321 { /* Get the new DirectInput button state for the mouse */ | |
322 DIMOUSESTATE distate; | |
323 HRESULT result; | |
324 | |
325 result=IDirectInputDevice2_GetDeviceState(SDL_DIdev[1], | |
326 sizeof(distate), &distate); | |
327 if ( result != DI_OK ) { | |
328 /* Try again next time */ | |
329 SetDIerror( | |
330 "IDirectInputDevice2::GetDeviceState", result); | |
331 return; | |
332 } | |
333 for ( i=3; i>=0; --i ) { | |
334 if ( (distate.rgbButtons[i]&0x80) == 0x80 ) { | |
335 new_state |= 0x01; | |
336 } | |
337 new_state <<= 1; | |
338 } | |
339 } | |
340 for ( i=0; i<8; ++i ) { | |
341 if ( (old_state&0x01) != (new_state&0x01) ) { | |
342 button = (Uint8)(i+1); | |
343 /* Button #2 on two button mice is button 3 | |
344 (the middle button is button 2) | |
345 */ | |
346 if ( button == 2 ) { | |
347 button = 3; | |
348 } else | |
349 if ( button == 3 ) { | |
350 button = 2; | |
351 } | |
352 if ( new_state & 0x01 ) { | |
353 /* Grab mouse so we get mouse-up */ | |
354 if ( ++mouse_pressed > 0 ) { | |
355 SetCapture(SDL_Window); | |
356 } | |
357 state = SDL_PRESSED; | |
358 } else { | |
359 /* Release mouse after all mouse-ups */ | |
360 if ( --mouse_pressed <= 0 ) { | |
361 ReleaseCapture(); | |
362 mouse_pressed = 0; | |
363 } | |
364 state = SDL_RELEASED; | |
365 } | |
491
da6a7e859616
Applied John Popplewell's fix for left-handed mice under Windows.
Sam Lantinga <slouken@libsdl.org>
parents:
460
diff
changeset
|
366 if ( mouse_buttons_swapped ) { |
da6a7e859616
Applied John Popplewell's fix for left-handed mice under Windows.
Sam Lantinga <slouken@libsdl.org>
parents:
460
diff
changeset
|
367 if ( button == 1 ) button = 3; |
da6a7e859616
Applied John Popplewell's fix for left-handed mice under Windows.
Sam Lantinga <slouken@libsdl.org>
parents:
460
diff
changeset
|
368 else |
da6a7e859616
Applied John Popplewell's fix for left-handed mice under Windows.
Sam Lantinga <slouken@libsdl.org>
parents:
460
diff
changeset
|
369 if ( button == 3 ) button = 1; |
da6a7e859616
Applied John Popplewell's fix for left-handed mice under Windows.
Sam Lantinga <slouken@libsdl.org>
parents:
460
diff
changeset
|
370 } |
0 | 371 posted = SDL_PrivateMouseButton(state, button, |
372 0, 0); | |
373 } | |
374 old_state >>= 1; | |
375 new_state >>= 1; | |
376 } | |
377 mouse_lost = 0; | |
378 return; | |
379 } | |
380 | |
381 /* Translate mouse messages */ | |
382 xrel = 0; | |
383 yrel = 0; | |
384 for ( i=0; i<(int)numevents; ++i ) { | |
385 switch (ptrbuf[i].dwOfs) { | |
386 case DIMOFS_X: | |
536
bf7f477fb2b2
Fixed potential dropped events under DirectInput
Sam Lantinga <slouken@libsdl.org>
parents:
523
diff
changeset
|
387 if ( timestamp != ptrbuf[i].dwTimeStamp ) { |
bf7f477fb2b2
Fixed potential dropped events under DirectInput
Sam Lantinga <slouken@libsdl.org>
parents:
523
diff
changeset
|
388 if ( xrel || yrel ) { |
bf7f477fb2b2
Fixed potential dropped events under DirectInput
Sam Lantinga <slouken@libsdl.org>
parents:
523
diff
changeset
|
389 posted = SDL_PrivateMouseMotion( |
bf7f477fb2b2
Fixed potential dropped events under DirectInput
Sam Lantinga <slouken@libsdl.org>
parents:
523
diff
changeset
|
390 0, 1, xrel, yrel); |
bf7f477fb2b2
Fixed potential dropped events under DirectInput
Sam Lantinga <slouken@libsdl.org>
parents:
523
diff
changeset
|
391 xrel = 0; |
bf7f477fb2b2
Fixed potential dropped events under DirectInput
Sam Lantinga <slouken@libsdl.org>
parents:
523
diff
changeset
|
392 yrel = 0; |
bf7f477fb2b2
Fixed potential dropped events under DirectInput
Sam Lantinga <slouken@libsdl.org>
parents:
523
diff
changeset
|
393 } |
bf7f477fb2b2
Fixed potential dropped events under DirectInput
Sam Lantinga <slouken@libsdl.org>
parents:
523
diff
changeset
|
394 timestamp = ptrbuf[i].dwTimeStamp; |
bf7f477fb2b2
Fixed potential dropped events under DirectInput
Sam Lantinga <slouken@libsdl.org>
parents:
523
diff
changeset
|
395 } |
0 | 396 xrel += (Sint16)ptrbuf[i].dwData; |
397 break; | |
398 case DIMOFS_Y: | |
536
bf7f477fb2b2
Fixed potential dropped events under DirectInput
Sam Lantinga <slouken@libsdl.org>
parents:
523
diff
changeset
|
399 if ( timestamp != ptrbuf[i].dwTimeStamp ) { |
bf7f477fb2b2
Fixed potential dropped events under DirectInput
Sam Lantinga <slouken@libsdl.org>
parents:
523
diff
changeset
|
400 if ( xrel || yrel ) { |
bf7f477fb2b2
Fixed potential dropped events under DirectInput
Sam Lantinga <slouken@libsdl.org>
parents:
523
diff
changeset
|
401 posted = SDL_PrivateMouseMotion( |
bf7f477fb2b2
Fixed potential dropped events under DirectInput
Sam Lantinga <slouken@libsdl.org>
parents:
523
diff
changeset
|
402 0, 1, xrel, yrel); |
bf7f477fb2b2
Fixed potential dropped events under DirectInput
Sam Lantinga <slouken@libsdl.org>
parents:
523
diff
changeset
|
403 xrel = 0; |
bf7f477fb2b2
Fixed potential dropped events under DirectInput
Sam Lantinga <slouken@libsdl.org>
parents:
523
diff
changeset
|
404 yrel = 0; |
bf7f477fb2b2
Fixed potential dropped events under DirectInput
Sam Lantinga <slouken@libsdl.org>
parents:
523
diff
changeset
|
405 } |
bf7f477fb2b2
Fixed potential dropped events under DirectInput
Sam Lantinga <slouken@libsdl.org>
parents:
523
diff
changeset
|
406 timestamp = ptrbuf[i].dwTimeStamp; |
bf7f477fb2b2
Fixed potential dropped events under DirectInput
Sam Lantinga <slouken@libsdl.org>
parents:
523
diff
changeset
|
407 } |
0 | 408 yrel += (Sint16)ptrbuf[i].dwData; |
409 break; | |
61
994ed1d668e7
Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
410 case DIMOFS_Z: |
994ed1d668e7
Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
411 if ( xrel || yrel ) { |
994ed1d668e7
Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
412 posted = SDL_PrivateMouseMotion( |
994ed1d668e7
Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
413 0, 1, xrel, yrel); |
994ed1d668e7
Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
414 xrel = 0; |
994ed1d668e7
Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
415 yrel = 0; |
994ed1d668e7
Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
416 } |
536
bf7f477fb2b2
Fixed potential dropped events under DirectInput
Sam Lantinga <slouken@libsdl.org>
parents:
523
diff
changeset
|
417 timestamp = 0; |
61
994ed1d668e7
Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
418 if((int)ptrbuf[i].dwData > 0) |
460
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
419 button = SDL_BUTTON_WHEELUP; |
332 | 420 else |
460
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
421 button = SDL_BUTTON_WHEELDOWN; |
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
422 posted = SDL_PrivateMouseButton( |
332 | 423 SDL_PRESSED, button, 0, 0); |
424 posted |= SDL_PrivateMouseButton( | |
425 SDL_RELEASED, button, 0, 0); | |
61
994ed1d668e7
Mouse wheel sends mouse button (4/5) events on Windows
Sam Lantinga <slouken@lokigames.com>
parents:
0
diff
changeset
|
426 break; |
0 | 427 case DIMOFS_BUTTON0: |
428 case DIMOFS_BUTTON1: | |
429 case DIMOFS_BUTTON2: | |
430 case DIMOFS_BUTTON3: | |
431 if ( xrel || yrel ) { | |
432 posted = SDL_PrivateMouseMotion( | |
433 0, 1, xrel, yrel); | |
434 xrel = 0; | |
435 yrel = 0; | |
436 } | |
536
bf7f477fb2b2
Fixed potential dropped events under DirectInput
Sam Lantinga <slouken@libsdl.org>
parents:
523
diff
changeset
|
437 timestamp = 0; |
0 | 438 button = (Uint8)(ptrbuf[i].dwOfs-DIMOFS_BUTTON0)+1; |
439 /* Button #2 on two button mice is button 3 | |
440 (the middle button is button 2) | |
441 */ | |
442 if ( button == 2 ) { | |
443 button = 3; | |
444 } else | |
445 if ( button == 3 ) { | |
446 button = 2; | |
447 } | |
448 if ( ptrbuf[i].dwData & 0x80 ) { | |
449 /* Grab mouse so we get mouse-up */ | |
450 if ( ++mouse_pressed > 0 ) { | |
451 SetCapture(SDL_Window); | |
452 } | |
453 state = SDL_PRESSED; | |
454 } else { | |
455 /* Release mouse after all mouse-ups */ | |
456 if ( --mouse_pressed <= 0 ) { | |
457 ReleaseCapture(); | |
458 mouse_pressed = 0; | |
459 } | |
460 state = SDL_RELEASED; | |
461 } | |
491
da6a7e859616
Applied John Popplewell's fix for left-handed mice under Windows.
Sam Lantinga <slouken@libsdl.org>
parents:
460
diff
changeset
|
462 if ( mouse_buttons_swapped ) { |
da6a7e859616
Applied John Popplewell's fix for left-handed mice under Windows.
Sam Lantinga <slouken@libsdl.org>
parents:
460
diff
changeset
|
463 if ( button == 1 ) button = 3; |
da6a7e859616
Applied John Popplewell's fix for left-handed mice under Windows.
Sam Lantinga <slouken@libsdl.org>
parents:
460
diff
changeset
|
464 else |
da6a7e859616
Applied John Popplewell's fix for left-handed mice under Windows.
Sam Lantinga <slouken@libsdl.org>
parents:
460
diff
changeset
|
465 if ( button == 3 ) button = 1; |
da6a7e859616
Applied John Popplewell's fix for left-handed mice under Windows.
Sam Lantinga <slouken@libsdl.org>
parents:
460
diff
changeset
|
466 } |
0 | 467 posted = SDL_PrivateMouseButton(state, button, |
468 0, 0); | |
469 break; | |
470 } | |
471 } | |
472 if ( xrel || yrel ) { | |
473 posted = SDL_PrivateMouseMotion( 0, 1, xrel, yrel); | |
474 } | |
475 } | |
476 | |
477 /* The main Win32 event handler */ | |
478 LONG | |
479 DX5_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) | |
480 { | |
481 switch (msg) { | |
453
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
482 #ifdef WM_ACTIVATEAPP |
0 | 483 case WM_ACTIVATEAPP: { |
484 int i, active; | |
485 | |
486 active = (wParam && (GetForegroundWindow() == hwnd)); | |
487 if ( active ) { | |
488 for ( i=0; SDL_DIdev[i]; ++i ) { | |
489 IDirectInputDevice2_Acquire( | |
490 SDL_DIdev[i]); | |
491 } | |
492 } else { | |
493 for ( i=0; SDL_DIdev[i]; ++i ) { | |
494 IDirectInputDevice2_Unacquire( | |
495 SDL_DIdev[i]); | |
496 } | |
497 mouse_lost = 1; | |
498 } | |
499 } | |
500 break; | |
453
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
501 #endif /* WM_ACTIVATEAPP */ |
0 | 502 |
453
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
503 #ifdef WM_DISPLAYCHANGE |
0 | 504 case WM_DISPLAYCHANGE: { |
505 WORD BitsPerPixel; | |
506 WORD SizeX, SizeY; | |
507 | |
508 /* Ack! The display changed size and/or depth! */ | |
509 SizeX = LOWORD(lParam); | |
510 SizeY = HIWORD(lParam); | |
511 BitsPerPixel = wParam; | |
512 /* We cause this message when we go fullscreen */ | |
513 } | |
514 break; | |
453
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
515 #endif /* WM_DISPLAYCHANGE */ |
0 | 516 |
517 /* The keyboard is handled via DirectInput */ | |
518 case WM_SYSKEYUP: | |
1348
40d0975c1769
Date: Mon, 6 Feb 2006 11:41:04 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
1338
diff
changeset
|
519 case WM_SYSKEYDOWN: { |
40d0975c1769
Date: Mon, 6 Feb 2006 11:41:04 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
1338
diff
changeset
|
520 /* Pass syskey to DefWindwoProc (ALT-F4, etc.) */ |
40d0975c1769
Date: Mon, 6 Feb 2006 11:41:04 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
1338
diff
changeset
|
521 } |
40d0975c1769
Date: Mon, 6 Feb 2006 11:41:04 -0500
Sam Lantinga <slouken@libsdl.org>
parents:
1338
diff
changeset
|
522 break; |
0 | 523 case WM_KEYUP: |
524 case WM_KEYDOWN: { | |
525 /* Ignore windows keyboard messages */; | |
526 } | |
527 return(0); | |
528 | |
453
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
529 #if defined(SC_SCREENSAVE) || defined(SC_MONITORPOWER) |
0 | 530 /* Don't allow screen savers or monitor power downs. |
531 This is because they quietly clear DirectX surfaces. | |
532 It would be better to allow the application to | |
533 decide whether or not to blow these off, but the | |
534 semantics of SDL_PrivateSysWMEvent() don't allow | |
535 the application that choice. | |
536 */ | |
537 case WM_SYSCOMMAND: { | |
538 if ((wParam&0xFFF0)==SC_SCREENSAVE || | |
539 (wParam&0xFFF0)==SC_MONITORPOWER) | |
540 return(0); | |
541 } | |
453
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
542 /* Fall through to default processing */ |
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
543 |
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
544 #endif /* SC_SCREENSAVE || SC_MONITORPOWER */ |
0 | 545 |
546 default: { | |
547 /* Only post the event if we're watching for it */ | |
548 if ( SDL_ProcessEvents[SDL_SYSWMEVENT] == SDL_ENABLE ) { | |
549 SDL_SysWMmsg wmmsg; | |
550 | |
551 SDL_VERSION(&wmmsg.version); | |
552 wmmsg.hwnd = hwnd; | |
553 wmmsg.msg = msg; | |
554 wmmsg.wParam = wParam; | |
555 wmmsg.lParam = lParam; | |
556 posted = SDL_PrivateSysWMEvent(&wmmsg); | |
145
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
61
diff
changeset
|
557 |
721
ab0656314eef
Date: Thu, 18 Sep 2003 14:24:35 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
717
diff
changeset
|
558 /* DJM: If the user isn't watching for private |
ab0656314eef
Date: Thu, 18 Sep 2003 14:24:35 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
717
diff
changeset
|
559 messages in her SDL event loop, then pass it |
ab0656314eef
Date: Thu, 18 Sep 2003 14:24:35 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
717
diff
changeset
|
560 along to any win32 specific window proc. |
ab0656314eef
Date: Thu, 18 Sep 2003 14:24:35 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
717
diff
changeset
|
561 */ |
ab0656314eef
Date: Thu, 18 Sep 2003 14:24:35 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
717
diff
changeset
|
562 } else if (userWindowProc) { |
ab0656314eef
Date: Thu, 18 Sep 2003 14:24:35 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
717
diff
changeset
|
563 return CallWindowProc(userWindowProc, hwnd, msg, wParam, lParam); |
ab0656314eef
Date: Thu, 18 Sep 2003 14:24:35 -0400
Sam Lantinga <slouken@libsdl.org>
parents:
717
diff
changeset
|
564 } |
0 | 565 } |
566 break; | |
567 } | |
568 return(DefWindowProc(hwnd, msg, wParam, lParam)); | |
569 } | |
570 | |
571 /* This function checks the windows message queue and DirectInput and returns | |
572 1 if there was input, 0 if there was no input, or -1 if the application has | |
573 posted a quit message. | |
574 */ | |
460
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
575 static int DX5_CheckInput(_THIS, int timeout, BOOL processInput) |
0 | 576 { |
577 MSG msg; | |
578 int i; | |
579 HRESULT result; | |
580 DWORD event; | |
581 | |
582 /* Check the normal windows queue (highest preference) */ | |
583 posted = 0; | |
584 while ( ! posted && | |
523
c210010f50f4
Fixed windows event handling for ActiveX controls (thanks Huib-Jan!)
Sam Lantinga <slouken@libsdl.org>
parents:
491
diff
changeset
|
585 PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) ) { |
c210010f50f4
Fixed windows event handling for ActiveX controls (thanks Huib-Jan!)
Sam Lantinga <slouken@libsdl.org>
parents:
491
diff
changeset
|
586 if ( GetMessage(&msg, NULL, 0, 0) > 0 ) { |
0 | 587 DispatchMessage(&msg); |
588 } else { | |
589 return(-1); | |
590 } | |
591 } | |
592 if ( posted ) { | |
593 return(1); | |
594 } | |
595 | |
596 /* Pump the DirectInput flow */ | |
597 if ( SDL_GetAppState() & SDL_APPINPUTFOCUS ) { | |
598 for ( i=0; i<SDL_DIndev; ++i ) { | |
599 result = IDirectInputDevice2_Poll(SDL_DIdev[i]); | |
600 if ( (result == DIERR_INPUTLOST) || | |
601 (result == DIERR_NOTACQUIRED) ) { | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1330
diff
changeset
|
602 if ( SDL_strcmp(inputs[i].name, "mouse") == 0 ) { |
0 | 603 mouse_lost = 1; |
604 } | |
605 IDirectInputDevice2_Acquire(SDL_DIdev[i]); | |
606 IDirectInputDevice2_Poll(SDL_DIdev[i]); | |
607 } | |
608 } | |
609 } | |
610 | |
611 /* Wait for messages and input events */ | |
612 event = MsgWaitForMultipleObjects(SDL_DIndev, SDL_DIevt, FALSE, | |
613 timeout, QS_ALLEVENTS); | |
614 if ((event >= WAIT_OBJECT_0) && (event < (WAIT_OBJECT_0+SDL_DIndev))) { | |
615 DWORD numevents; | |
1330
450721ad5436
It's now possible to build SDL without any C runtime at all on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
1312
diff
changeset
|
616 static DIDEVICEOBJECTDATA evtbuf[INPUT_QSIZE]; |
0 | 617 |
618 event -= WAIT_OBJECT_0; | |
619 numevents = INPUT_QSIZE; | |
620 result = IDirectInputDevice2_GetDeviceData( | |
621 SDL_DIdev[event], sizeof(DIDEVICEOBJECTDATA), | |
622 evtbuf, &numevents, 0); | |
623 if ( (result == DIERR_INPUTLOST) || | |
624 (result == DIERR_NOTACQUIRED) ) { | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1330
diff
changeset
|
625 if ( SDL_strcmp(inputs[event].name, "mouse") == 0 ) { |
0 | 626 mouse_lost = 1; |
627 } | |
628 IDirectInputDevice2_Acquire(SDL_DIdev[event]); | |
629 result = IDirectInputDevice2_GetDeviceData( | |
630 SDL_DIdev[event], sizeof(DIDEVICEOBJECTDATA), | |
631 evtbuf, &numevents, 0); | |
632 } | |
633 /* Handle the events */ | |
460
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
634 if ( result == DI_OK && processInput ) { |
0 | 635 /* Note: This can post multiple events to event queue |
636 */ | |
637 (*SDL_DIfun[event])((int)numevents, evtbuf); | |
638 return(1); | |
639 } | |
640 } | |
641 if ( event != WAIT_TIMEOUT ) { | |
642 /* Maybe there was a windows message? */ | |
643 if ( PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE) ) { | |
644 if ( GetMessage(&msg, NULL, 0, 0) > 0 ) { | |
645 DispatchMessage(&msg); | |
646 } else { | |
647 return(-1); | |
648 } | |
649 return(1); | |
650 } | |
651 } | |
652 return(0); | |
653 } | |
654 | |
460
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
655 /* Change cooperative level based on whether or not we are fullscreen */ |
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
656 void DX5_DInputReset(_THIS, int fullscreen) |
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
657 { |
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
658 DWORD level; |
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
659 int i; |
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
660 HRESULT result; |
970
fb8b91365766
Date: Tue, 19 Oct 2004 23:04:58 -0700
Sam Lantinga <slouken@libsdl.org>
parents:
833
diff
changeset
|
661 HWND topwnd; |
460
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
662 |
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
663 for ( i=0; i<MAX_INPUTS; ++i ) { |
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
664 if ( SDL_DIdev[i] != NULL ) { |
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
665 if ( fullscreen ) { |
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
666 level = inputs[i].raw_level; |
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
667 } else { |
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
668 level = inputs[i].win_level; |
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
669 } |
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
670 IDirectInputDevice2_Unacquire(SDL_DIdev[i]); |
1115
040aa1bea9fc
Fixed mismerged patch.
Ryan C. Gordon <icculus@icculus.org>
parents:
1114
diff
changeset
|
671 topwnd = GetTopLevelParent(SDL_Window); |
460
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
672 result = IDirectInputDevice2_SetCooperativeLevel( |
970
fb8b91365766
Date: Tue, 19 Oct 2004 23:04:58 -0700
Sam Lantinga <slouken@libsdl.org>
parents:
833
diff
changeset
|
673 SDL_DIdev[i], topwnd, level); |
460
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
674 IDirectInputDevice2_Acquire(SDL_DIdev[i]); |
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
675 if ( result != DI_OK ) { |
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
676 SetDIerror( |
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
677 "DirectInputDevice::SetCooperativeLevel", result); |
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
678 } |
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
679 } |
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
680 } |
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
681 mouse_lost = 1; |
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
682 |
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
683 /* Flush pending input */ |
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
684 DX5_CheckInput(this, 0, FALSE); |
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
685 } |
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
686 |
0 | 687 void DX5_PumpEvents(_THIS) |
688 { | |
689 /* Wait for messages and DirectInput */ | |
460
a888b3ae31ff
Reset mouse state when changing video modes
Sam Lantinga <slouken@libsdl.org>
parents:
458
diff
changeset
|
690 while ( DX5_CheckInput(this, 0, TRUE) > 0 ) { |
0 | 691 /* Loop and check again */; |
692 } | |
693 } | |
694 | |
695 void DX5_InitOSKeymap(_THIS) | |
696 { | |
275
53fc686e9428
Added support for the pause key under DirectX
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
697 #ifndef DIK_PAUSE |
53fc686e9428
Added support for the pause key under DirectX
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
698 #define DIK_PAUSE 0xC5 |
53fc686e9428
Added support for the pause key under DirectX
Sam Lantinga <slouken@libsdl.org>
parents:
252
diff
changeset
|
699 #endif |
327
13fc64213765
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
325
diff
changeset
|
700 #ifndef DIK_OEM_102 |
13fc64213765
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
325
diff
changeset
|
701 #define DIK_OEM_102 0x56 /* < > | on UK/Germany keyboards */ |
13fc64213765
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
325
diff
changeset
|
702 #endif |
0 | 703 int i; |
704 | |
705 /* Map the DIK scancodes to SDL keysyms */ | |
1379
c0a74f199ecf
Use only safe string functions
Sam Lantinga <slouken@libsdl.org>
parents:
1361
diff
changeset
|
706 for ( i=0; i<SDL_arraysize(DIK_keymap); ++i ) |
0 | 707 DIK_keymap[i] = 0; |
708 | |
709 /* Defined DIK_* constants */ | |
710 DIK_keymap[DIK_ESCAPE] = SDLK_ESCAPE; | |
711 DIK_keymap[DIK_1] = SDLK_1; | |
712 DIK_keymap[DIK_2] = SDLK_2; | |
713 DIK_keymap[DIK_3] = SDLK_3; | |
714 DIK_keymap[DIK_4] = SDLK_4; | |
715 DIK_keymap[DIK_5] = SDLK_5; | |
716 DIK_keymap[DIK_6] = SDLK_6; | |
717 DIK_keymap[DIK_7] = SDLK_7; | |
718 DIK_keymap[DIK_8] = SDLK_8; | |
719 DIK_keymap[DIK_9] = SDLK_9; | |
720 DIK_keymap[DIK_0] = SDLK_0; | |
721 DIK_keymap[DIK_MINUS] = SDLK_MINUS; | |
722 DIK_keymap[DIK_EQUALS] = SDLK_EQUALS; | |
723 DIK_keymap[DIK_BACK] = SDLK_BACKSPACE; | |
724 DIK_keymap[DIK_TAB] = SDLK_TAB; | |
725 DIK_keymap[DIK_Q] = SDLK_q; | |
726 DIK_keymap[DIK_W] = SDLK_w; | |
727 DIK_keymap[DIK_E] = SDLK_e; | |
728 DIK_keymap[DIK_R] = SDLK_r; | |
729 DIK_keymap[DIK_T] = SDLK_t; | |
730 DIK_keymap[DIK_Y] = SDLK_y; | |
731 DIK_keymap[DIK_U] = SDLK_u; | |
732 DIK_keymap[DIK_I] = SDLK_i; | |
733 DIK_keymap[DIK_O] = SDLK_o; | |
734 DIK_keymap[DIK_P] = SDLK_p; | |
735 DIK_keymap[DIK_LBRACKET] = SDLK_LEFTBRACKET; | |
736 DIK_keymap[DIK_RBRACKET] = SDLK_RIGHTBRACKET; | |
737 DIK_keymap[DIK_RETURN] = SDLK_RETURN; | |
738 DIK_keymap[DIK_LCONTROL] = SDLK_LCTRL; | |
739 DIK_keymap[DIK_A] = SDLK_a; | |
740 DIK_keymap[DIK_S] = SDLK_s; | |
741 DIK_keymap[DIK_D] = SDLK_d; | |
742 DIK_keymap[DIK_F] = SDLK_f; | |
743 DIK_keymap[DIK_G] = SDLK_g; | |
744 DIK_keymap[DIK_H] = SDLK_h; | |
745 DIK_keymap[DIK_J] = SDLK_j; | |
746 DIK_keymap[DIK_K] = SDLK_k; | |
747 DIK_keymap[DIK_L] = SDLK_l; | |
748 DIK_keymap[DIK_SEMICOLON] = SDLK_SEMICOLON; | |
749 DIK_keymap[DIK_APOSTROPHE] = SDLK_QUOTE; | |
750 DIK_keymap[DIK_GRAVE] = SDLK_BACKQUOTE; | |
751 DIK_keymap[DIK_LSHIFT] = SDLK_LSHIFT; | |
752 DIK_keymap[DIK_BACKSLASH] = SDLK_BACKSLASH; | |
327
13fc64213765
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
325
diff
changeset
|
753 DIK_keymap[DIK_OEM_102] = SDLK_BACKSLASH; |
0 | 754 DIK_keymap[DIK_Z] = SDLK_z; |
755 DIK_keymap[DIK_X] = SDLK_x; | |
756 DIK_keymap[DIK_C] = SDLK_c; | |
757 DIK_keymap[DIK_V] = SDLK_v; | |
758 DIK_keymap[DIK_B] = SDLK_b; | |
759 DIK_keymap[DIK_N] = SDLK_n; | |
760 DIK_keymap[DIK_M] = SDLK_m; | |
761 DIK_keymap[DIK_COMMA] = SDLK_COMMA; | |
762 DIK_keymap[DIK_PERIOD] = SDLK_PERIOD; | |
763 DIK_keymap[DIK_SLASH] = SDLK_SLASH; | |
764 DIK_keymap[DIK_RSHIFT] = SDLK_RSHIFT; | |
765 DIK_keymap[DIK_MULTIPLY] = SDLK_KP_MULTIPLY; | |
766 DIK_keymap[DIK_LMENU] = SDLK_LALT; | |
767 DIK_keymap[DIK_SPACE] = SDLK_SPACE; | |
768 DIK_keymap[DIK_CAPITAL] = SDLK_CAPSLOCK; | |
769 DIK_keymap[DIK_F1] = SDLK_F1; | |
770 DIK_keymap[DIK_F2] = SDLK_F2; | |
771 DIK_keymap[DIK_F3] = SDLK_F3; | |
772 DIK_keymap[DIK_F4] = SDLK_F4; | |
773 DIK_keymap[DIK_F5] = SDLK_F5; | |
774 DIK_keymap[DIK_F6] = SDLK_F6; | |
775 DIK_keymap[DIK_F7] = SDLK_F7; | |
776 DIK_keymap[DIK_F8] = SDLK_F8; | |
777 DIK_keymap[DIK_F9] = SDLK_F9; | |
778 DIK_keymap[DIK_F10] = SDLK_F10; | |
779 DIK_keymap[DIK_NUMLOCK] = SDLK_NUMLOCK; | |
780 DIK_keymap[DIK_SCROLL] = SDLK_SCROLLOCK; | |
781 DIK_keymap[DIK_NUMPAD7] = SDLK_KP7; | |
782 DIK_keymap[DIK_NUMPAD8] = SDLK_KP8; | |
783 DIK_keymap[DIK_NUMPAD9] = SDLK_KP9; | |
784 DIK_keymap[DIK_SUBTRACT] = SDLK_KP_MINUS; | |
785 DIK_keymap[DIK_NUMPAD4] = SDLK_KP4; | |
786 DIK_keymap[DIK_NUMPAD5] = SDLK_KP5; | |
787 DIK_keymap[DIK_NUMPAD6] = SDLK_KP6; | |
788 DIK_keymap[DIK_ADD] = SDLK_KP_PLUS; | |
789 DIK_keymap[DIK_NUMPAD1] = SDLK_KP1; | |
790 DIK_keymap[DIK_NUMPAD2] = SDLK_KP2; | |
791 DIK_keymap[DIK_NUMPAD3] = SDLK_KP3; | |
792 DIK_keymap[DIK_NUMPAD0] = SDLK_KP0; | |
793 DIK_keymap[DIK_DECIMAL] = SDLK_KP_PERIOD; | |
794 DIK_keymap[DIK_F11] = SDLK_F11; | |
795 DIK_keymap[DIK_F12] = SDLK_F12; | |
796 | |
797 DIK_keymap[DIK_F13] = SDLK_F13; | |
798 DIK_keymap[DIK_F14] = SDLK_F14; | |
799 DIK_keymap[DIK_F15] = SDLK_F15; | |
800 | |
801 DIK_keymap[DIK_NUMPADEQUALS] = SDLK_KP_EQUALS; | |
802 DIK_keymap[DIK_NUMPADENTER] = SDLK_KP_ENTER; | |
803 DIK_keymap[DIK_RCONTROL] = SDLK_RCTRL; | |
804 DIK_keymap[DIK_DIVIDE] = SDLK_KP_DIVIDE; | |
805 DIK_keymap[DIK_SYSRQ] = SDLK_SYSREQ; | |
806 DIK_keymap[DIK_RMENU] = SDLK_RALT; | |
290
9a02597bc1b0
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
275
diff
changeset
|
807 DIK_keymap[DIK_PAUSE] = SDLK_PAUSE; |
0 | 808 DIK_keymap[DIK_HOME] = SDLK_HOME; |
809 DIK_keymap[DIK_UP] = SDLK_UP; | |
810 DIK_keymap[DIK_PRIOR] = SDLK_PAGEUP; | |
811 DIK_keymap[DIK_LEFT] = SDLK_LEFT; | |
812 DIK_keymap[DIK_RIGHT] = SDLK_RIGHT; | |
813 DIK_keymap[DIK_END] = SDLK_END; | |
814 DIK_keymap[DIK_DOWN] = SDLK_DOWN; | |
815 DIK_keymap[DIK_NEXT] = SDLK_PAGEDOWN; | |
816 DIK_keymap[DIK_INSERT] = SDLK_INSERT; | |
817 DIK_keymap[DIK_DELETE] = SDLK_DELETE; | |
818 DIK_keymap[DIK_LWIN] = SDLK_LMETA; | |
819 DIK_keymap[DIK_RWIN] = SDLK_RMETA; | |
820 DIK_keymap[DIK_APPS] = SDLK_MENU; | |
821 } | |
822 | |
823 static SDL_keysym *TranslateKey(UINT scancode, SDL_keysym *keysym, int pressed) | |
824 { | |
825 /* Set the keysym information */ | |
826 keysym->scancode = (unsigned char)scancode; | |
827 keysym->sym = DIK_keymap[scancode]; | |
828 keysym->mod = KMOD_NONE; | |
829 keysym->unicode = 0; | |
1253
7c7ddaf195bf
Implemented ToUnicode() support on Windows 95/98/ME/NT/2000/XP
Sam Lantinga <slouken@libsdl.org>
parents:
1115
diff
changeset
|
830 if ( pressed && SDL_TranslateUNICODE ) { |
0 | 831 UINT vkey; |
453
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
832 #ifndef NO_GETKEYBOARDSTATE |
1253
7c7ddaf195bf
Implemented ToUnicode() support on Windows 95/98/ME/NT/2000/XP
Sam Lantinga <slouken@libsdl.org>
parents:
1115
diff
changeset
|
833 BYTE keystate[256]; |
7c7ddaf195bf
Implemented ToUnicode() support on Windows 95/98/ME/NT/2000/XP
Sam Lantinga <slouken@libsdl.org>
parents:
1115
diff
changeset
|
834 Uint16 wchars[2]; |
453
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
835 #endif |
0 | 836 |
837 vkey = MapVirtualKey(scancode, 1); | |
453
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
838 #ifdef NO_GETKEYBOARDSTATE |
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
839 /* Uh oh, better hope the vkey is close enough.. */ |
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
840 keysym->unicode = vkey; |
a6fa62b1be09
Updated for embedded Visual C++ 4.0
Sam Lantinga <slouken@libsdl.org>
parents:
332
diff
changeset
|
841 #else |
0 | 842 GetKeyboardState(keystate); |
1253
7c7ddaf195bf
Implemented ToUnicode() support on Windows 95/98/ME/NT/2000/XP
Sam Lantinga <slouken@libsdl.org>
parents:
1115
diff
changeset
|
843 if (SDL_ToUnicode(vkey, scancode, keystate, wchars, sizeof(wchars)/sizeof(wchars[0]), 0) == 1) |
7c7ddaf195bf
Implemented ToUnicode() support on Windows 95/98/ME/NT/2000/XP
Sam Lantinga <slouken@libsdl.org>
parents:
1115
diff
changeset
|
844 { |
7c7ddaf195bf
Implemented ToUnicode() support on Windows 95/98/ME/NT/2000/XP
Sam Lantinga <slouken@libsdl.org>
parents:
1115
diff
changeset
|
845 keysym->unicode = wchars[0]; |
0 | 846 } |
1253
7c7ddaf195bf
Implemented ToUnicode() support on Windows 95/98/ME/NT/2000/XP
Sam Lantinga <slouken@libsdl.org>
parents:
1115
diff
changeset
|
847 #endif /* NO_GETKEYBOARDSTATE */ |
0 | 848 } |
849 return(keysym); | |
850 } | |
851 | |
852 int DX5_CreateWindow(_THIS) | |
853 { | |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1330
diff
changeset
|
854 char *windowid = SDL_getenv("SDL_WINDOWID"); |
0 | 855 int i; |
856 | |
857 /* Clear out DirectInput variables in case we fail */ | |
858 for ( i=0; i<MAX_INPUTS; ++i ) { | |
859 SDL_DIdev[i] = NULL; | |
860 SDL_DIevt[i] = NULL; | |
861 SDL_DIfun[i] = NULL; | |
862 } | |
863 | |
1288
ea3888b472bf
Cleaned up the app registration stuff a bit
Sam Lantinga <slouken@libsdl.org>
parents:
1280
diff
changeset
|
864 SDL_RegisterApp(NULL, 0, 0); |
1280
f61f045343d3
Re-query the SDL_WINDOWID each time we initialize the video
Sam Lantinga <slouken@libsdl.org>
parents:
1253
diff
changeset
|
865 |
f61f045343d3
Re-query the SDL_WINDOWID each time we initialize the video
Sam Lantinga <slouken@libsdl.org>
parents:
1253
diff
changeset
|
866 SDL_windowid = (windowid != NULL); |
0 | 867 if ( SDL_windowid ) { |
1336
3692456e7b0f
Use SDL_ prefixed versions of C library functions.
Sam Lantinga <slouken@libsdl.org>
parents:
1330
diff
changeset
|
868 SDL_Window = (HWND)SDL_strtol(windowid, NULL, 0); |
975
add87cc1de0a
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
970
diff
changeset
|
869 if ( SDL_Window == NULL ) { |
add87cc1de0a
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
970
diff
changeset
|
870 SDL_SetError("Couldn't get user specified window"); |
add87cc1de0a
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
970
diff
changeset
|
871 return(-1); |
add87cc1de0a
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
970
diff
changeset
|
872 } |
145
29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
Sam Lantinga <slouken@libsdl.org>
parents:
61
diff
changeset
|
873 |
458
a8a0a4f19df7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
874 /* DJM: we want all event's for the user specified |
975
add87cc1de0a
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
970
diff
changeset
|
875 window to be handled by SDL. |
458
a8a0a4f19df7
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
453
diff
changeset
|
876 */ |
1303
52b5afd7ecee
Date: Tue, 05 Jul 2005 21:43:26 +1000
Sam Lantinga <slouken@libsdl.org>
parents:
1288
diff
changeset
|
877 userWindowProc = (WNDPROCTYPE)GetWindowLong(SDL_Window, GWL_WNDPROC); |
975
add87cc1de0a
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
970
diff
changeset
|
878 SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)WinMessage); |
0 | 879 } else { |
880 SDL_Window = CreateWindow(SDL_Appname, SDL_Appname, | |
881 (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX), | |
833
31fa08b36380
Added support for SDL_VIDEO_WINDOW_POS and SDL_VIDEO_CENTERED on Windows
Sam Lantinga <slouken@libsdl.org>
parents:
769
diff
changeset
|
882 CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, NULL, NULL, SDL_Instance, NULL); |
0 | 883 if ( SDL_Window == NULL ) { |
884 SDL_SetError("Couldn't create window"); | |
885 return(-1); | |
886 } | |
887 ShowWindow(SDL_Window, SW_HIDE); | |
888 } | |
889 | |
890 /* Initialize DirectInput */ | |
891 if ( DX5_DInputInit(this) < 0 ) { | |
892 return(-1); | |
893 } | |
894 | |
895 /* Ready to roll */ | |
896 return(0); | |
897 } | |
898 | |
899 void DX5_DestroyWindow(_THIS) | |
900 { | |
901 /* Close down DirectInput */ | |
902 DX5_DInputQuit(this); | |
903 | |
904 /* Destroy our window */ | |
975
add87cc1de0a
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
970
diff
changeset
|
905 if ( SDL_windowid ) { |
add87cc1de0a
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
970
diff
changeset
|
906 SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)userWindowProc); |
add87cc1de0a
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
970
diff
changeset
|
907 } else { |
add87cc1de0a
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
970
diff
changeset
|
908 DestroyWindow(SDL_Window); |
add87cc1de0a
*** empty log message ***
Sam Lantinga <slouken@libsdl.org>
parents:
970
diff
changeset
|
909 } |
1288
ea3888b472bf
Cleaned up the app registration stuff a bit
Sam Lantinga <slouken@libsdl.org>
parents:
1280
diff
changeset
|
910 SDL_UnregisterApp(); |
0 | 911 } |