Only use hack on X when in windowed mode.

This commit is contained in:
Themaister 2011-08-16 10:26:36 +02:00
parent 22e8c3d895
commit bce679df78
3 changed files with 7 additions and 14 deletions

View File

@ -116,18 +116,9 @@ void gfx_set_dwm(void)
#include "SDL_syswm.h"
#include "SDL.h"
#ifndef __APPLE__
#if !defined(__APPLE__) && !defined(_WIN32)
void gfx_get_window_size(unsigned *width, unsigned *height)
{
#ifdef _WIN32
SDL_Event evnt;
while (SDL_PollEvent(&evnt));
const SDL_VideoInfo *info = SDL_GetVideoInfo();
*width = info->current_w;
*height = info->current_h;
#else
// It seems that we need to go hardcore to get the actual
// window sizes properly right after startup ... :D
SDL_SysWMinfo info;
SDL_VERSION(&info.version);
SDL_GetWMInfo(&info);
@ -139,6 +130,5 @@ void gfx_get_window_size(unsigned *width, unsigned *height)
*width = target.width;
*height = target.height;
#endif
}
#endif

View File

@ -28,7 +28,7 @@ void gfx_window_title_reset(void);
void gfx_set_dwm(void);
#endif
#ifndef __APPLE__
#if !defined(__APPLE__) && !defined(_WIN32)
void gfx_get_window_size(unsigned *width, unsigned *height);
#endif

View File

@ -147,6 +147,7 @@ typedef struct gl
bool should_resize;
bool quitting;
bool fullscreen;
bool keep_aspect;
unsigned full_x, full_y;
@ -706,8 +707,9 @@ static void check_window(gl_t *gl)
}
}
#ifndef __APPLE__ // This check breaks on OSX for some reason. Oh well :)
if (!gl->should_resize)
#if !defined(__APPLE__) && !defined(_WIN32)
// Hack to workaround limitations in tiling WMs ...
if (!gl->should_resize && !gl->fullscreen)
{
unsigned new_width, new_height;
gfx_get_window_size(&new_width, &new_height);
@ -1097,6 +1099,7 @@ static void* gl_init(const video_info_t *video, const input_driver_t **input, vo
}
gl->vsync = video->vsync;
gl->fullscreen = video->fullscreen;
int attr = 0;
SDL_GL_GetAttribute(SDL_GL_SWAP_CONTROL, &attr);
if (attr <= 0 && video->vsync)