src/video/win32/SDL_win32window.c
branchgsoc2008_force_feedback
changeset 2649 7961f1f74dc8
parent 2586 d84c99f5401e
equal deleted inserted replaced
2648:6d705ec89fb6 2649:7961f1f74dc8
    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";
    35 static WCHAR *SDL_HelperWindowClassName = TEXT("SDLHelperWindowInputCatcher");
    36 static const char *SDL_HelperWindowName = "SDLHelperWindowInputMsgWindow";
    36 static WCHAR *SDL_HelperWindowName = TEXT("SDLHelperWindowInputMsgWindow");
    37 static ATOM SDL_HelperWindowClass = 0;
    37 static ATOM SDL_HelperWindowClass = 0;
    38 
    38 
    39 
    39 
    40 static int
    40 static int
    41 SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created)
    41 SetupWindowData(_THIS, SDL_Window * window, HWND hwnd, SDL_bool created)
   425 {
   425 {
   426    HINSTANCE hInstance = GetModuleHandleA(NULL);
   426    HINSTANCE hInstance = GetModuleHandleA(NULL);
   427    WNDCLASSEX wce;
   427    WNDCLASSEX wce;
   428 
   428 
   429    /* Create the class. */
   429    /* Create the class. */
   430    ZeroMemory(&wce, sizeof (wce));
   430    SDL_zero(wce);
   431    wce.cbSize = sizeof(WNDCLASSEX);
   431    wce.cbSize = sizeof(WNDCLASSEX);
   432    wce.lpfnWndProc = DefWindowProcA;
   432    wce.lpfnWndProc = DefWindowProcA;
   433    wce.lpszClassName = (LPCWSTR) SDL_HelperWindowClassName;
   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 = RegisterClassEx(&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, SDL_HelperWindowClassName,
   444    SDL_HelperWindow = CreateWindowEx(0, SDL_HelperWindowClassName,
   445          SDL_HelperWindowName, WS_OVERLAPPEDWINDOW,
   445          SDL_HelperWindowName, WS_OVERLAPPEDWINDOW,
   446          CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
   446          CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
   447          CW_USEDEFAULT, HWND_MESSAGE, NULL, hInstance, NULL);
   447          CW_USEDEFAULT, HWND_MESSAGE, NULL, hInstance, NULL);
   448    if (SDL_HelperWindow == NULL) {
   448    if (SDL_HelperWindow == NULL) {
   449       SDL_SetError("Unable to create Helper Window: error %d.", GetLastError());
   449       SDL_SetError("Unable to create Helper Window: error %d.", GetLastError());
   466       SDL_HelperWindow = NULL;
   466       SDL_HelperWindow = NULL;
   467    }
   467    }
   468 
   468 
   469    /* Unregister the class. */
   469    /* Unregister the class. */
   470    if (SDL_HelperWindowClass) {
   470    if (SDL_HelperWindowClass) {
   471       UnregisterClassA(SDL_HelperWindowClassName, GetModuleHandleA(NULL));
   471       UnregisterClass(SDL_HelperWindowClassName, GetModuleHandleA(NULL));
   472       SDL_HelperWindowClass = 0;
   472       SDL_HelperWindowClass = 0;
   473    }
   473    }
   474 }
   474 }
   475 
   475 
   476 
   476