Add GFX_CTL_SUPPRESS_SCREENSAVER

This commit is contained in:
twinaphex 2016-02-13 23:39:12 +01:00
parent f6afe72a1e
commit 154f85c6fa
5 changed files with 15 additions and 13 deletions

View File

@ -889,7 +889,8 @@ static bool d3d_focus(void *data)
static bool d3d_suppress_screensaver(void *data, bool enable)
{
return gfx_ctx_suppress_screensaver(enable);
bool enabled = enable;
return gfx_ctl(GFX_CTL_SUPPRESS_SCREENSAVER, &enabled);
}
static bool d3d_has_windowed(void *data)

View File

@ -2739,7 +2739,8 @@ static bool gl_focus(void *data)
static bool gl_suppress_screensaver(void *data, bool enable)
{
return gfx_ctx_suppress_screensaver(enable);
bool enabled = enable;
return gfx_ctx_ctl(GFX_CTL_SUPPRESS_SCREENSAVER, &enabled);
}
static bool gl_has_windowed(void *data)

View File

@ -413,7 +413,8 @@ static bool vg_focus(void *data)
static bool vg_suppress_screensaver(void *data, bool enable)
{
return gfx_ctx_suppress_screensaver(enable);
bool enabled = enable;
return gfx_ctx_ctl(GFX_CTL_SUPPRESS_SCREENSAVER, &enabled);
}
static bool vg_has_windowed(void *data)

View File

@ -100,14 +100,6 @@ bool gfx_ctx_set_video_mode(
video_context_data, width, height, fullscreen);
}
bool gfx_ctx_suppress_screensaver(bool enable)
{
if (!video_context_data || !current_video_context)
return false;
return current_video_context->suppress_screensaver(
video_context_data, enable);
}
void gfx_ctx_get_video_size(unsigned *width, unsigned *height)
{
if (!current_video_context || !current_video_context->get_video_size)
@ -431,6 +423,14 @@ bool gfx_ctx_ctl(enum gfx_ctx_ctl_state state, void *data)
video_context_data, inp->input, inp->input_data);
}
break;
case GFX_CTL_SUPPRESS_SCREENSAVER:
{
bool *bool_data = (bool*)data;
if (!video_context_data || !current_video_context)
return false;
return current_video_context->suppress_screensaver(
video_context_data, *bool_data);
}
case GFX_CTL_NONE:
default:
break;

View File

@ -78,6 +78,7 @@ enum gfx_ctx_ctl_state
GFX_CTL_TRANSLATE_ASPECT,
GFX_CTL_GET_METRICS,
GFX_CTL_INPUT_DRIVER,
GFX_CTL_SUPPRESS_SCREENSAVER
};
typedef void (*gfx_ctx_proc_t)(void);
@ -260,8 +261,6 @@ const gfx_ctx_driver_t *gfx_ctx_init_first(void *data, const char *ident,
bool gfx_ctx_set_video_mode(unsigned width, unsigned height,
bool fullscreen);
bool gfx_ctx_suppress_screensaver(bool enable);
void gfx_ctx_get_video_size(unsigned *width, unsigned *height);
bool gfx_ctx_set_resize(unsigned width, unsigned height);