From 83f80c427bbd9d8a81f9184daeab9e5fb02ac137 Mon Sep 17 00:00:00 2001 From: The Dax Date: Sat, 26 Apr 2014 00:08:20 -0400 Subject: [PATCH] SDL: Let the window be resizable on platforms it makes sense on. --- base/PCMain.cpp | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/base/PCMain.cpp b/base/PCMain.cpp index b134ffe252..67a9afac40 100644 --- a/base/PCMain.cpp +++ b/base/PCMain.cpp @@ -436,7 +436,7 @@ int main(int argc, char *argv[]) { int set_xres = -1; int set_yres = -1; #else - mode = SDL_OPENGL; + mode = SDL_OPENGL | SDL_RESIZABLE; int set_xres = -1; int set_yres = -1; @@ -627,6 +627,23 @@ int main(int argc, char *argv[]) { case SDL_QUIT: g_QuitRequested = 1; break; +#if !defined(MOBILE_DEVICE) + case SDL_VIDEORESIZE: + { + g_Screen = SDL_SetVideoMode(event.resize.w, event.resize.h, 0, SDL_OPENGL | SDL_RESIZABLE); + if (g_Screen == NULL) { + fprintf(stderr, "SDL SetVideoMode failed: Unable to create OpenGL screen: %s\n", SDL_GetError()); + SDL_Quit(); + return 2; + } + pixel_xres = event.resize.w; + pixel_yres = event.resize.h; + dp_xres = (float)pixel_xres * dpi_scale; + dp_yres = (float)pixel_yres * dpi_scale; + NativeResized(); + break; + } +#endif case SDL_KEYDOWN: { int k = event.key.keysym.sym;