# HG changeset patch # User Sam Lantinga # Date 1100552994 0 # Node ID b8427b5151ed27075a761ba14aebf04438df843e # Parent 795ac5fbe2600ed98326a107746c8ce33228a262 Restore the user specified window proc after shutdown diff -r 795ac5fbe260 -r b8427b5151ed src/video/windib/SDL_dibevents.c --- a/src/video/windib/SDL_dibevents.c Mon Nov 15 01:47:53 2004 +0000 +++ b/src/video/windib/SDL_dibevents.c Mon Nov 15 21:09:54 2004 +0000 @@ -369,13 +369,16 @@ if ( SDL_windowid ) { SDL_Window = (HWND)strtol(SDL_windowid, NULL, 0); - /* DJM: we want all event's for the user specified - window to be handled by SDL. - */ - if (SDL_Window) { - userWindowProc = (WNDPROC)GetWindowLong(SDL_Window, GWL_WNDPROC); - SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)WinMessage); - } + if ( SDL_Window == NULL ) { + SDL_SetError("Couldn't get user specified window"); + return(-1); + } + + /* DJM: we want all event's for the user specified + window to be handled by SDL. + */ + userWindowProc = (WNDPROC)GetWindowLong(SDL_Window, GWL_WNDPROC); + SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)WinMessage); } else { SDL_Window = CreateWindow(SDL_Appname, SDL_Appname, (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_MINIMIZEBOX), @@ -391,7 +394,9 @@ void DIB_DestroyWindow(_THIS) { - if ( SDL_windowid == NULL ) { + if ( SDL_windowid ) { + SetWindowLong(SDL_Window, GWL_WNDPROC, (LONG)userWindowProc); + } else { DestroyWindow(SDL_Window); } }