Suspend screensaver on SDL/GL as well.

This commit is contained in:
Themaister 2012-07-28 01:54:00 +02:00
parent b29b04b4b0
commit 7346d0f959
2 changed files with 15 additions and 3 deletions

View File

@ -33,7 +33,7 @@
// //
#if SDL_MODERN #if SDL_MODERN
static SDL_Window* g_window; static SDL_Window *g_window;
static SDL_GLContext g_ctx; static SDL_GLContext g_ctx;
#endif #endif
@ -118,6 +118,7 @@ bool gfx_ctx_init(void)
#endif #endif
if (!ret) if (!ret)
RARCH_ERR("Failed to init SDL video.\n"); RARCH_ERR("Failed to init SDL video.\n");
return ret; return ret;
} }
@ -213,6 +214,17 @@ bool gfx_ctx_set_video_mode(
// Remove that ugly mouse :D // Remove that ugly mouse :D
SDL_ShowCursor(SDL_DISABLE); SDL_ShowCursor(SDL_DISABLE);
// Suspend screensaver on X11.
#ifdef HAVE_X11
RARCH_LOG("Suspending screensaver (X11).\n");
SDL_SysWMinfo info;
if (gfx_ctx_get_wm_info(&info))
gfx_suspend_screensaver(info.info.x11.window);
else
RARCH_ERR("Failed to get SDL WM info, cannot suspend screensaver.\n");
#endif
return true; return true;
} }
@ -392,11 +404,13 @@ bool gfx_ctx_get_wm_info(SDL_SysWMinfo *info)
(void)info; (void)info;
return false; return false;
#elif SDL_MODERN #elif SDL_MODERN
SDL_VERSION(&info->version);
if (g_window) if (g_window)
return SDL_GetWindowWMInfo(g_window, info); return SDL_GetWindowWMInfo(g_window, info);
else else
return SDL_GetWMInfo(info) == 1; return SDL_GetWMInfo(info) == 1;
#else #else
SDL_VERSION(&info->version);
return SDL_GetWMInfo(info) == 1; return SDL_GetWMInfo(info) == 1;
#endif #endif
} }

View File

@ -106,8 +106,6 @@ sdl_dinput_t* sdl_dinput_init(void)
CoInitialize(NULL); CoInitialize(NULL);
SDL_SysWMinfo info; SDL_SysWMinfo info;
SDL_VERSION(&info.version);
if (!gfx_ctx_get_wm_info(&info)) if (!gfx_ctx_get_wm_info(&info))
{ {
RARCH_ERR("Failed to get SysWM info.\n"); RARCH_ERR("Failed to get SysWM info.\n");