Mercurial > sdl-ios-xcode
comparison src/video/windib/SDL_dibevents.c @ 145:29a638dc26db
Applied David MacCormack's patch to fix SDL_WINDOWID on Windows,
and added a function to cache the application handle so DirectInput
still works properly.
author | Sam Lantinga <slouken@libsdl.org> |
---|---|
date | Thu, 09 Aug 2001 12:21:32 +0000 |
parents | 3c35d8f160bd |
children | e8157fcb3114 |
comparison
equal
deleted
inserted
replaced
144:1cfa4282f2eb | 145:29a638dc26db |
---|---|
51 static SDL_keysym *TranslateKey(UINT vkey, UINT scancode, SDL_keysym *keysym, int pressed); | 51 static SDL_keysym *TranslateKey(UINT vkey, UINT scancode, SDL_keysym *keysym, int pressed); |
52 | 52 |
53 /* Masks for processing the windows KEYDOWN and KEYUP messages */ | 53 /* Masks for processing the windows KEYDOWN and KEYUP messages */ |
54 #define REPEATED_KEYMASK (1<<30) | 54 #define REPEATED_KEYMASK (1<<30) |
55 #define EXTENDED_KEYMASK (1<<24) | 55 #define EXTENDED_KEYMASK (1<<24) |
56 | |
57 /* DJM: If the user setup the window for us, we want to save his window proc, | |
58 and give him a chance to handle some messages. */ | |
59 static WNDPROC userWindowProc = NULL; | |
56 | 60 |
57 /* The main Win32 event handler */ | 61 /* The main Win32 event handler */ |
58 LONG | 62 LONG |
59 DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) | 63 DIB_HandleMessage(_THIS, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) |
60 { | 64 { |
148 wmmsg.hwnd = hwnd; | 152 wmmsg.hwnd = hwnd; |
149 wmmsg.msg = msg; | 153 wmmsg.msg = msg; |
150 wmmsg.wParam = wParam; | 154 wmmsg.wParam = wParam; |
151 wmmsg.lParam = lParam; | 155 wmmsg.lParam = lParam; |
152 posted = SDL_PrivateSysWMEvent(&wmmsg); | 156 posted = SDL_PrivateSysWMEvent(&wmmsg); |
157 | |
158 /* DJM: If the user isn't watching for private | |
159 messages in her SDL event loop, then pass it | |
160 along to any win32 specific window proc. | |
161 */ | |
162 } else if (userWindowProc) { | |
163 return userWindowProc(hwnd, msg, wParam, lParam); | |
153 } | 164 } |
154 } | 165 } |
155 break; | 166 break; |
156 } | 167 } |
157 return(DefWindowProc(hwnd, msg, wParam, lParam)); | 168 return(DefWindowProc(hwnd, msg, wParam, lParam)); |
337 ShowWindow(SDL_Window, SW_HIDE); | 348 ShowWindow(SDL_Window, SW_HIDE); |
338 #else | 349 #else |
339 SDL_RegisterApp("SDL_app", CS_BYTEALIGNCLIENT, 0); | 350 SDL_RegisterApp("SDL_app", CS_BYTEALIGNCLIENT, 0); |
340 if ( SDL_windowid ) { | 351 if ( SDL_windowid ) { |
341 SDL_Window = (HWND)strtol(SDL_windowid, NULL, 0); | 352 SDL_Window = (HWND)strtol(SDL_windowid, NULL, 0); |
353 | |
354 /* DJM: we want all event's for the user specified | |
355 window to be handled by SDL. | |
356 */ | |
357 if (SDL_Window) { | |
358 userWindowProc = (WNDPROC)GetWindowLong(SDL_Window, GWL_WNDPROC); | |
359 SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)WinMessage); | |
360 } | |
342 } else { | 361 } else { |
343 SDL_Window = CreateWindow(SDL_Appname, SDL_Appname, | 362 SDL_Window = CreateWindow(SDL_Appname, SDL_Appname, |
344 (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX), | 363 (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX), |
345 0, 0, 0, 0, NULL, NULL, SDL_Instance, NULL); | 364 0, 0, 0, 0, NULL, NULL, SDL_Instance, NULL); |
346 if ( SDL_Window == NULL ) { | 365 if ( SDL_Window == NULL ) { |