From 7671f3e035e391110dd087bc01d8803d0dbe085f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 10 Apr 2015 06:10:05 +0200 Subject: [PATCH] Create gfx_ctx_check_window --- gfx/drivers/gl.c | 11 +++-------- gfx/video_context_driver.c | 17 +++++++++++++++++ gfx/video_context_driver.h | 3 +++ 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index dfec3dd16c..aefc29df6e 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -2464,15 +2464,10 @@ static bool gl_alive(void *data) { bool quit = false, resize = false; gl_t *gl = (gl_t*)data; - runloop_t *runloop = rarch_main_get_ptr(); - const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr(); - - if (!gl) - return false; - ctx->check_window(gl, &quit, - &resize, &gl->win_width, &gl->win_height, - runloop->frames.video.count); + if (!gfx_ctx_check_window(data, &quit, + &resize, &gl->win_width, &gl->win_height)) + return false; if (quit) gl->quitting = true; diff --git a/gfx/video_context_driver.c b/gfx/video_context_driver.c index 555262efa0..d6e113ec69 100644 --- a/gfx/video_context_driver.c +++ b/gfx/video_context_driver.c @@ -160,6 +160,23 @@ bool gfx_ctx_has_windowed(void *data) return true; } +bool gfx_ctx_check_window(void *data, bool *quit, bool *resize, + unsigned *width, unsigned *height) +{ + runloop_t *runloop = rarch_main_get_ptr(); + const gfx_ctx_driver_t *ctx = gfx_ctx_get_ptr(); + unsigned frame_count = runloop ? + runloop->frames.video.count : 0; + + if (!data) + return false; + + ctx->check_window(data, quit, resize, width, height, + frame_count); + + return true; +} + /** * find_gfx_ctx_driver_index: * @ident : Identifier of resampler driver to find. diff --git a/gfx/video_context_driver.h b/gfx/video_context_driver.h index 55c9daf13b..f0956f2a64 100644 --- a/gfx/video_context_driver.h +++ b/gfx/video_context_driver.h @@ -221,6 +221,9 @@ void gfx_ctx_show_mouse(void *data, bool state); bool gfx_ctx_has_windowed(void *data); +bool gfx_ctx_check_window(void *data, bool *quit, bool *resize, + unsigned *width, unsigned *height); + retro_proc_address_t gfx_ctx_get_proc_address(const char *sym); #ifdef __cplusplus