diff --git a/gfx/gl.c b/gfx/gl.c index 03ace02cf5..132719fc57 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -784,7 +784,7 @@ static bool gl_frame(void *data, const void* frame, unsigned width, unsigned hei { gl->should_resize = false; - sdlwrap_set_video_mode(gl->win_width, gl->win_height, 0, g_settings.video.fullscreen); + sdlwrap_set_resize(gl->win_width, gl->win_height); #ifdef HAVE_FBO if (!gl->render_to_tex) diff --git a/gfx/sdlwrap.c b/gfx/sdlwrap.c index d397440bd2..052afc7f2d 100644 --- a/gfx/sdlwrap.c +++ b/gfx/sdlwrap.c @@ -170,6 +170,25 @@ bool sdlwrap_set_video_mode( return true; } +// SDL 1.2 has an awkward model where you need to "confirm" window resizing. +// SDL 1.3 luckily removes this quirk. +void sdlwrap_set_resize(unsigned width, unsigned height) +{ +#if SDL_MODERN + (void)width; + (void)height; + (void)bits; + (void)fullscreen; +#else +#ifndef __APPLE__ // Resizing on OSX is broken in 1.2 it seems :) + static const int resizable = SDL_RESIZABLE; +#else + static const int resizable = 0; +#endif + SDL_SetVideoMode(width, height, 0, SDL_OPENGL | (g_fullscreen ? SDL_FULLSCREEN : resizable)); +#endif +} + void sdlwrap_wm_set_caption(const char *str) { #if SDL_MODERN diff --git a/gfx/sdlwrap.h b/gfx/sdlwrap.h index 1d1ef4b951..a835d953cb 100644 --- a/gfx/sdlwrap.h +++ b/gfx/sdlwrap.h @@ -58,6 +58,8 @@ bool sdlwrap_key_pressed(int key); void sdlwrap_check_window(bool *quit, bool *resize, unsigned *width, unsigned *height, unsigned frame_count); +void sdlwrap_set_resize(unsigned width, unsigned height); + bool sdlwrap_get_wm_info(SDL_SysWMinfo *info); bool sdlwrap_window_has_focus(void);