From 0d897dd65dc8eb8f95c08444acdafe610cd75d67 Mon Sep 17 00:00:00 2001 From: Themaister Date: Tue, 13 Sep 2011 22:38:32 +0200 Subject: [PATCH] Check some additional WM messages. --- gfx/sdlwrap.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/gfx/sdlwrap.c b/gfx/sdlwrap.c index fcd27168a8..d397440bd2 100644 --- a/gfx/sdlwrap.c +++ b/gfx/sdlwrap.c @@ -240,17 +240,35 @@ void sdlwrap_check_window(bool *quit, { case SDL_QUIT: *quit = true; + return; + + case SDL_WINDOWEVENT: + switch (event.window.event) + { + case SDL_WINDOWEVENT_CLOSE: + *quit = true; + return; + + case SDL_WINDOWEVENT_RESIZED: + *resize = true; + *width = event.window.data1; + *height = event.window.data2; + break; + } break; } } - int w, h; - SDL_GetWindowSize(g_window, &w, &h); - if (*width != (unsigned)w || *height != (unsigned)h) + if (!*resize) { - *resize = true; - *width = w; - *height = h; + int w, h; + SDL_GetWindowSize(g_window, &w, &h); + if (*width != (unsigned)w || *height != (unsigned)h) + { + *resize = true; + *width = w; + *height = h; + } } #else while (SDL_PollEvent(&event))