comparison src/video/win32/SDL_win32window.c @ 3045:9acb9f0f7f0d

Some more safety around the SDL_HelperWindow stuff to avoid double creations.
author Edgar Simo <bobbens@gmail.com>
date Sun, 18 Jan 2009 17:00:02 +0000
parents 502adab079a4
children 089a77aebb7d
comparison
equal deleted inserted replaced
3044:b36579172f27 3045:9acb9f0f7f0d
559 SDL_HelperWindowCreate(void) 559 SDL_HelperWindowCreate(void)
560 { 560 {
561 HINSTANCE hInstance = GetModuleHandleA(NULL); 561 HINSTANCE hInstance = GetModuleHandleA(NULL);
562 WNDCLASSEX wce; 562 WNDCLASSEX wce;
563 563
564 /* Make sure window isn't created twice. */
565 if (SDL_HelperWindow != NULL) {
566 return 0;
567 }
568
564 /* Create the class. */ 569 /* Create the class. */
565 SDL_zero(wce); 570 SDL_zero(wce);
566 wce.cbSize = sizeof(WNDCLASSEX); 571 wce.cbSize = sizeof(WNDCLASSEX);
567 wce.lpfnWndProc = DefWindowProcA; 572 wce.lpfnWndProc = DefWindowProcA;
568 wce.lpszClassName = (LPCWSTR) SDL_HelperWindowClassName; 573 wce.lpszClassName = (LPCWSTR) SDL_HelperWindowClassName;
582 WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, 587 WS_OVERLAPPEDWINDOW, CW_USEDEFAULT,
583 CW_USEDEFAULT, CW_USEDEFAULT, 588 CW_USEDEFAULT, CW_USEDEFAULT,
584 CW_USEDEFAULT, HWND_MESSAGE, NULL, 589 CW_USEDEFAULT, HWND_MESSAGE, NULL,
585 hInstance, NULL); 590 hInstance, NULL);
586 if (SDL_HelperWindow == NULL) { 591 if (SDL_HelperWindow == NULL) {
592 UnregisterClass(SDL_HelperWindowClassName, hInstance);
587 SDL_SetError("Unable to create Helper Window: error %d.", 593 SDL_SetError("Unable to create Helper Window: error %d.",
588 GetLastError()); 594 GetLastError());
589 return -1; 595 return -1;
590 } 596 }
591 597