diff --git a/gfx/drivers/d3d.cpp b/gfx/drivers/d3d.cpp index 0f733ea9ef..08cdb11e1e 100644 --- a/gfx/drivers/d3d.cpp +++ b/gfx/drivers/d3d.cpp @@ -906,11 +906,6 @@ static bool d3d_alive(void *data) return ret; } -static bool d3d_focus(void *data) -{ - return video_context_driver_focus(); -} - static bool d3d_suppress_screensaver(void *data, bool enable) { bool enabled = enable; @@ -1714,9 +1709,9 @@ video_driver_t video_d3d = { d3d_frame, d3d_set_nonblock_state, d3d_alive, - d3d_focus, + NULL, /* focus */ d3d_suppress_screensaver, - NULL, /* has_windowed */ + NULL, /* has_windowed */ d3d_set_shader, d3d_free, "d3d", @@ -1724,7 +1719,7 @@ video_driver_t video_d3d = { d3d_set_rotation, d3d_viewport_info, d3d_read_viewport, - NULL, /* read_frame_raw */ + NULL, /* read_frame_raw */ #ifdef HAVE_OVERLAY d3d_get_overlay_interface, #endif diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index 080f1a4490..d0c931f53f 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -2130,11 +2130,6 @@ static bool gl_alive(void *data) return ret; } -static bool gl_focus(void *data) -{ - return video_context_driver_focus(); -} - static bool gl_suppress_screensaver(void *data, bool enable) { bool enabled = enable; @@ -2709,7 +2704,7 @@ video_driver_t video_gl = { gl_frame, gl_set_nonblock_state, gl_alive, - gl_focus, + NULL, /* focus */ gl_suppress_screensaver, NULL, /* has_windowed */ diff --git a/gfx/drivers/vg.c b/gfx/drivers/vg.c index 4ce1d9b7bf..cb22429821 100644 --- a/gfx/drivers/vg.c +++ b/gfx/drivers/vg.c @@ -448,11 +448,6 @@ static bool vg_alive(void *data) return !quit; } -static bool vg_focus(void *data) -{ - return video_context_driver_focus(); -} - static bool vg_suppress_screensaver(void *data, bool enable) { bool enabled = enable; @@ -502,19 +497,19 @@ video_driver_t video_vg = { vg_frame, vg_set_nonblock_state, vg_alive, - vg_focus, + NULL, /* focused */ vg_suppress_screensaver, - NULL, /* has_windowed */ + NULL, /* has_windowed */ vg_set_shader, vg_free, "vg", - NULL, /* set_viewport */ + NULL, /* set_viewport */ vg_set_rotation, vg_viewport_info, vg_read_viewport, - NULL, /* read_frame_raw */ + NULL, /* read_frame_raw */ #ifdef HAVE_OVERLAY - NULL, /* overlay_interface */ + NULL, /* overlay_interface */ #endif vg_get_poke_interface }; diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index c8a37ce1f6..8d8e142d61 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -1258,12 +1258,6 @@ static bool vulkan_alive(void *data) return ret; } -static bool vulkan_focus(void *data) -{ - (void)data; - return video_context_driver_focus(); -} - static bool vulkan_suppress_screensaver(void *data, bool enable) { (void)data; @@ -2570,9 +2564,9 @@ video_driver_t video_vulkan = { vulkan_frame, vulkan_set_nonblock_state, vulkan_alive, - vulkan_focus, + NULL, /* focus */ vulkan_suppress_screensaver, - NULL, /* has_windowed */ + NULL, /* has_windowed */ vulkan_set_shader, vulkan_free, "vulkan", @@ -2580,7 +2574,7 @@ video_driver_t video_vulkan = { vulkan_set_rotation, vulkan_viewport_info, vulkan_read_viewport, - NULL, /* vulkan_read_frame_raw */ + NULL, /* vulkan_read_frame_raw */ #ifdef HAVE_OVERLAY vulkan_get_overlay_interface, @@ -2588,6 +2582,6 @@ video_driver_t video_vulkan = { NULL, #endif vulkan_get_poke_interface, - NULL, /* vulkan_wrap_type_to_enum */ + NULL, /* vulkan_wrap_type_to_enum */ }; diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 3fe0e76170..ceb7880812 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -2481,6 +2481,7 @@ void video_driver_get_window_title(char *buf, unsigned len) } } + void video_driver_get_status(uint64_t *frame_count, bool * is_alive, bool *is_focused) { @@ -2904,12 +2905,21 @@ bool video_context_driver_set_flags(gfx_ctx_flags_t *flags) return true; } +bool video_driver_is_focused(void) +{ + if (current_video->focus) + return current_video->focus(video_driver_data); + else if (video_context_data && current_video_context->has_focus) + return current_video_context->has_focus(video_context_data); + return true; +} + bool video_driver_has_windowed(void) { #if defined(RARCH_CONSOLE) || defined(RARCH_MOBILE) return false; #else - if (current_video->has_windowed && current_video->has_windowed(video_driver_data)) + if (video_driver_data && current_video->has_windowed) return current_video->has_windowed(video_driver_data); else if (video_context_data && current_video_context->has_windowed) return current_video_context->has_windowed(video_context_data); diff --git a/gfx/video_driver.h b/gfx/video_driver.h index b41d539713..ae256f1646 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -519,7 +519,7 @@ extern struct aspect_ratio_elem aspectratio_lut[ASPECT_RATIO_END]; #define video_driver_is_alive() ((current_video) ? current_video->alive(video_driver_data) : true) -#define video_driver_is_focused() (current_video->focus(video_driver_data)) +bool video_driver_is_focused(void); bool video_driver_has_windowed(void); @@ -906,8 +906,6 @@ void video_context_driver_destroy(void); if (current_video_context && current_video_context->swap_buffers) \ current_video_context->swap_buffers(video_context_data, video_info) -#define video_context_driver_focus() ((video_context_data && current_video_context->has_focus && current_video_context->has_focus(video_context_data)) ? true : false) - #define video_context_driver_set_resize(mode_info) \ if (current_video_context && current_video_context->set_resize) \ current_video_context->set_resize(video_context_data, mode_info.width, mode_info.height)