From f079ca29e4dc266f574e61d2d367e2e133c4216c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 13 Feb 2016 08:37:10 +0100 Subject: [PATCH] Add GFX_CTL_HAS_WINDOWED --- gfx/d3d/d3d.cpp | 2 +- gfx/drivers/gl.c | 2 +- gfx/drivers/vg.c | 2 +- gfx/video_context_driver.c | 11 ++++------- gfx/video_context_driver.h | 5 ++--- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/gfx/d3d/d3d.cpp b/gfx/d3d/d3d.cpp index a6a85bf80b..da8ce8312a 100644 --- a/gfx/d3d/d3d.cpp +++ b/gfx/d3d/d3d.cpp @@ -881,7 +881,7 @@ static bool d3d_suppress_screensaver(void *data, bool enable) static bool d3d_has_windowed(void *data) { - return gfx_ctx_has_windowed(); + return gfx_ctx_ctl(GFX_CTL_HAS_WINDOWED, NULL); } static void d3d_set_aspect_ratio(void *data, unsigned aspect_ratio_idx) diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 14f5fc30f5..fc940ff091 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -2716,7 +2716,7 @@ static bool gl_suppress_screensaver(void *data, bool enable) static bool gl_has_windowed(void *data) { - return gfx_ctx_has_windowed(); + return gfx_ctx_ctl(GFX_CTL_HAS_WINDOWED, NULL); } static void gl_update_tex_filter_frame(gl_t *gl) diff --git a/gfx/drivers/vg.c b/gfx/drivers/vg.c index d89c2e67bd..6a9703bd74 100644 --- a/gfx/drivers/vg.c +++ b/gfx/drivers/vg.c @@ -389,7 +389,7 @@ static bool vg_suppress_screensaver(void *data, bool enable) static bool vg_has_windowed(void *data) { - return gfx_ctx_has_windowed(); + return gfx_ctx_ctl(GFX_CTL_HAS_WINDOWED, NULL); } static bool vg_set_shader(void *data, diff --git a/gfx/video_context_driver.c b/gfx/video_context_driver.c index c1ac254b2d..cc9c6a8cd2 100644 --- a/gfx/video_context_driver.c +++ b/gfx/video_context_driver.c @@ -200,13 +200,6 @@ void gfx_ctx_show_mouse(bool state) current_video_context->show_mouse(video_context_data, state); } -bool gfx_ctx_has_windowed(void) -{ - if (!video_context_data) - return false; - return current_video_context->has_windowed(video_context_data); -} - bool gfx_ctx_check_window(bool *quit, bool *resize, unsigned *width, unsigned *height) { @@ -434,6 +427,10 @@ bool gfx_ctx_ctl(enum gfx_ctx_ctl_state state, void *data) if (!video_context_data || !current_video_context->has_focus) return false; return current_video_context->has_focus(video_context_data); + case GFX_CTL_HAS_WINDOWED: + if (!video_context_data) + return false; + return current_video_context->has_windowed(video_context_data); case GFX_CTL_FREE: if (current_video_context->destroy) current_video_context->destroy(video_context_data); diff --git a/gfx/video_context_driver.h b/gfx/video_context_driver.h index 8122f62445..0c9fc56a80 100644 --- a/gfx/video_context_driver.h +++ b/gfx/video_context_driver.h @@ -56,7 +56,8 @@ enum gfx_ctx_ctl_state GFX_CTL_NONE = 0, GFX_CTL_FOCUS, GFX_CTL_FREE, - GFX_CTL_SWAP_BUFFERS + GFX_CTL_SWAP_BUFFERS, + GFX_CTL_HAS_WINDOWED }; typedef void (*gfx_ctx_proc_t)(void); @@ -222,8 +223,6 @@ bool gfx_ctx_image_buffer_write(const void *frame, void gfx_ctx_show_mouse(bool state); -bool gfx_ctx_has_windowed(void); - bool gfx_ctx_check_window(bool *quit, bool *resize, unsigned *width, unsigned *height);