From 0a646403031e73f7ccb0fa4c1c9e3f68ba82d42b Mon Sep 17 00:00:00 2001 From: Toad King Date: Wed, 27 Jun 2012 00:44:20 -0400 Subject: [PATCH] don't error on no window manager SDL video --- gfx/context/sdl_ctx.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/gfx/context/sdl_ctx.c b/gfx/context/sdl_ctx.c index 9ebd8bf7e1..dc8842966a 100644 --- a/gfx/context/sdl_ctx.c +++ b/gfx/context/sdl_ctx.c @@ -268,16 +268,19 @@ static void gfx_ctx_get_window_size(unsigned *width, unsigned *height) { SDL_SysWMinfo info; SDL_VERSION(&info.version); - SDL_GetWMInfo(&info); - XWindowAttributes target; - info.info.x11.lock_func(); - XGetWindowAttributes(info.info.x11.display, info.info.x11.window, - &target); - info.info.x11.unlock_func(); + if (SDL_GetWMInfo(&info) > 0) + { + XWindowAttributes target; - *width = target.width; - *height = target.height; + info.info.x11.lock_func(); + XGetWindowAttributes(info.info.x11.display, info.info.x11.window, + &target); + info.info.x11.unlock_func(); + + *width = target.width; + *height = target.height; + } } #endif