Mercurial > sdl-ios-xcode
comparison src/video/win32/SDL_win32window.c @ 2585:38f14c05a92c gsoc2008_force_feedback
Trying to fix some issues with the Helper Window.
author | Edgar Simo <bobbens@gmail.com> |
---|---|
date | Mon, 04 Aug 2008 15:34:22 +0000 |
parents | e8644f625d45 |
children | d84c99f5401e |
comparison
equal
deleted
inserted
replaced
2584:e8644f625d45 | 2585:38f14c05a92c |
---|---|
30 #include "SDL_syswm.h" | 30 #include "SDL_syswm.h" |
31 | 31 |
32 | 32 |
33 /* Fake window to help with DirectInput events. */ | 33 /* Fake window to help with DirectInput events. */ |
34 HWND SDL_HelperWindow = NULL; | 34 HWND SDL_HelperWindow = NULL; |
35 static const char *SDL_HelperWindowClassName = "SDLHelperWindowInputCatcher"; | |
36 static const char *SDL_HelperWindowName = "SDLHelperWindowInputMsgWindow"; | |
35 static ATOM SDL_HelperWindowClass = 0; | 37 static ATOM SDL_HelperWindowClass = 0; |
36 | 38 |
37 | 39 |
38 static int | 40 static int |
39 SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) | 41 SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created) |
420 */ | 422 */ |
421 int | 423 int |
422 SDL_HelperWindowCreate(void) | 424 SDL_HelperWindowCreate(void) |
423 { | 425 { |
424 HINSTANCE hInstance = GetModuleHandleA(NULL); | 426 HINSTANCE hInstance = GetModuleHandleA(NULL); |
425 const char *class_name = "SDLHelperWindowInputCatcher"; | |
426 const char *win_name = "SDLHelperWindowInputMsgWindow"; | |
427 WNDCLASSEX wce; | 427 WNDCLASSEX wce; |
428 | 428 |
429 /* Create the class. */ | 429 /* Create the class. */ |
430 ZeroMemory(&wce, sizeof (wce)); | 430 ZeroMemory(&wce, sizeof (wce)); |
431 wce.cbSize = sizeof(WNDCLASSEX); | 431 wce.cbSize = sizeof(WNDCLASSEX); |
432 wce.lpfnWndProc = NULL; | 432 wce.lpfnWndProc = NULL; |
433 wce.lpszClassName = (LPCWSTR) class_name; | 433 wce.lpszClassName = (LPCWSTR) SDL_HelperWindowClassName; |
434 wce.hInstance = hInstance; | 434 wce.hInstance = hInstance; |
435 | 435 |
436 /* Register the class. */ | 436 /* Register the class. */ |
437 SDL_HelperWindowClass = RegisterClassExA(&wce); | 437 SDL_HelperWindowClass = RegisterClassExA(&wce); |
438 if (SDL_HelperWindowClass == 0) { | 438 if (SDL_HelperWindowClass == 0) { |
439 SDL_SetError("Unable to create Helper Window Class: error %d.", GetLastError()); | 439 SDL_SetError("Unable to create Helper Window Class: error %d.", GetLastError()); |
440 return -1; | 440 return -1; |
441 } | 441 } |
442 | 442 |
443 /* Create the window. */ | 443 /* Create the window. */ |
444 SDL_HelperWindow = CreateWindowExA(0, class_name, win_name, WS_OVERLAPPEDWINDOW, | 444 SDL_HelperWindow = CreateWindowExA(0, SDL_HelperWindowClassName, |
445 SDL_HelperWindowName, WS_OVERLAPPEDWINDOW, | |
445 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, | 446 CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, |
446 CW_USEDEFAULT, HWND_MESSAGE, NULL, hInstance, NULL); | 447 CW_USEDEFAULT, HWND_MESSAGE, NULL, hInstance, NULL); |
447 if (SDL_HelperWindow == NULL) { | 448 if (SDL_HelperWindow == NULL) { |
448 SDL_SetError("Unable to create Helper Window: error %d.", GetLastError()); | 449 SDL_SetError("Unable to create Helper Window: error %d.", GetLastError()); |
449 return -1; | 450 return -1; |
465 SDL_HelperWindow = NULL; | 466 SDL_HelperWindow = NULL; |
466 } | 467 } |
467 | 468 |
468 /* Unregister the class. */ | 469 /* Unregister the class. */ |
469 if (SDL_HelperWindowClass) { | 470 if (SDL_HelperWindowClass) { |
470 UnregisterClassA(SDL_HelperWindowClass, GetModuleHandleA(NULL)); | 471 UnregisterClassA(SDL_HelperWindowClassName, GetModuleHandleA(NULL)); |
471 SDL_HelperWindowClass = 0; | 472 SDL_HelperWindowClass = 0; |
472 } | 473 } |
473 } | 474 } |
474 | 475 |
475 | 476 |