comparison src/video/windib/SDL_dibevents.c @ 974:b8427b5151ed

Restore the user specified window proc after shutdown
author Sam Lantinga <slouken@libsdl.org>
date Mon, 15 Nov 2004 21:09:54 +0000
parents 31fa08b36380
children add87cc1de0a
comparison
equal deleted inserted replaced
973:795ac5fbe260 974:b8427b5151ed
367 #endif 367 #endif
368 SDL_RegisterApp("SDL_app", CS_BYTEALIGNCLIENT, 0); 368 SDL_RegisterApp("SDL_app", CS_BYTEALIGNCLIENT, 0);
369 if ( SDL_windowid ) { 369 if ( SDL_windowid ) {
370 SDL_Window = (HWND)strtol(SDL_windowid, NULL, 0); 370 SDL_Window = (HWND)strtol(SDL_windowid, NULL, 0);
371 371
372 /* DJM: we want all event's for the user specified 372 if ( SDL_Window == NULL ) {
373 window to be handled by SDL. 373 SDL_SetError("Couldn't get user specified window");
374 */ 374 return(-1);
375 if (SDL_Window) { 375 }
376 userWindowProc = (WNDPROC)GetWindowLong(SDL_Window, GWL_WNDPROC); 376
377 SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)WinMessage); 377 /* DJM: we want all event's for the user specified
378 } 378 window to be handled by SDL.
379 */
380 userWindowProc = (WNDPROC)GetWindowLong(SDL_Window, GWL_WNDPROC);
381 SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)WinMessage);
379 } else { 382 } else {
380 SDL_Window = CreateWindow(SDL_Appname, SDL_Appname, 383 SDL_Window = CreateWindow(SDL_Appname, SDL_Appname,
381 (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX), 384 (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX),
382 CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, NULL, NULL, SDL_Instance, NULL); 385 CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, NULL, NULL, SDL_Instance, NULL);
383 if ( SDL_Window == NULL ) { 386 if ( SDL_Window == NULL ) {
389 return(0); 392 return(0);
390 } 393 }
391 394
392 void DIB_DestroyWindow(_THIS) 395 void DIB_DestroyWindow(_THIS)
393 { 396 {
394 if ( SDL_windowid == NULL ) { 397 if ( SDL_windowid ) {
398 SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)userWindowProc);
399 } else {
395 DestroyWindow(SDL_Window); 400 DestroyWindow(SDL_Window);
396 } 401 }
397 } 402 }