Resizing windows in 1.2 should not trigger some init code :)

This commit is contained in:
Themaister 2011-09-22 21:50:57 +02:00
parent 157dcad87b
commit c2cedb1b6f
3 changed files with 22 additions and 1 deletions

View File

@ -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)

View File

@ -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

View File

@ -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);