Mercurial > sdl-ios-xcode
diff 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 |
line wrap: on
line diff
--- 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); } }