Mercurial > sdl-ios-xcode
comparison src/video/win32/SDL_win32window.c @ 2580:64fa227c01ce gsoc2008_force_feedback
Added the concept of the HelperWindow to help with DirectInput.
author | Edgar Simo <bobbens@gmail.com> |
---|---|
date | Mon, 04 Aug 2008 11:22:01 +0000 |
parents | ba0d62354872 |
children | a1c00531ee00 |
comparison
equal
deleted
inserted
replaced
2579:bd2a6c70cb29 | 2580:64fa227c01ce |
---|---|
26 | 26 |
27 #include "SDL_win32video.h" | 27 #include "SDL_win32video.h" |
28 | 28 |
29 /* This is included after SDL_win32video.h, which includes windows.h */ | 29 /* This is included after SDL_win32video.h, which includes windows.h */ |
30 #include "SDL_syswm.h" | 30 #include "SDL_syswm.h" |
31 | |
32 | |
33 /* Fake window to help with DirectInput events. */ | |
34 HWND SDL_HelperWindow = NULL; | |
31 | 35 |
32 | 36 |
33 static int | 37 static int |
34 SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) | 38 SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) |
35 { | 39 { |
407 SDL_MAJOR_VERSION, SDL_MINOR_VERSION); | 411 SDL_MAJOR_VERSION, SDL_MINOR_VERSION); |
408 return SDL_FALSE; | 412 return SDL_FALSE; |
409 } | 413 } |
410 } | 414 } |
411 | 415 |
416 | |
417 /* | |
418 * Creates a HelperWindow used for DirectInput events. | |
419 */ | |
420 int | |
421 SDL_HelperWindowCreate(void) | |
422 { | |
423 HINSTANCE hInstance = pGetModuleHandleA(NULL); | |
424 const char *class_name = "SDLHelperWindowInputCatcher"; | |
425 const char *win_name = "SDLHelperWindowInputMsgWindow"; | |
426 WNDCLASSEX wce; | |
427 | |
428 ZeroMemory(&wce, sizeof (wce)); | |
429 wce.cbSize = sizeof(WNDCLASSEX); | |
430 wce.lpfnWndProc = RawWndProc; | |
431 wce.lpszClassName = class_name; | |
432 wce.hInstance = hInstance; | |
433 | |
434 SDL_HelperWindow = pCreateWindowExA(0, class_name, win_name, WS_OVERLAPPEDWINDOW, | |
435 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, | |
436 CW_USEDEFAULT, HWND_MESSAGE, NULL, hInstance, NULL); | |
437 | |
438 if (SDL_HelperWindow == NULL) { | |
439 SDL_SetError("Unable to create Helper Window."); | |
440 return -1; | |
441 } | |
442 | |
443 return 0; | |
444 } | |
445 | |
446 | |
447 /* | |
448 * Destroys the HelperWindow previously created with SDL_HelperWindowCreate. | |
449 */ | |
450 void | |
451 SDL_HelperWindowDestroy(void) | |
452 { | |
453 if (SDL_HelperWindow) { | |
454 pDestroyWindow(SDL_HelperWindow); | |
455 SDL_HelperWindow = NULL; | |
456 } | |
457 } | |
458 | |
459 | |
412 /* vi: set ts=4 sw=4 expandtab: */ | 460 /* vi: set ts=4 sw=4 expandtab: */ |