Create function out of video_driver_is_focused - no longer

call video_driver_context_focus from video driver
This commit is contained in:
twinaphex 2017-05-13 19:19:49 +02:00
parent d4756f83e5
commit 17a15273ba
6 changed files with 25 additions and 38 deletions

View File

@ -906,11 +906,6 @@ static bool d3d_alive(void *data)
return ret; return ret;
} }
static bool d3d_focus(void *data)
{
return video_context_driver_focus();
}
static bool d3d_suppress_screensaver(void *data, bool enable) static bool d3d_suppress_screensaver(void *data, bool enable)
{ {
bool enabled = enable; bool enabled = enable;
@ -1714,9 +1709,9 @@ video_driver_t video_d3d = {
d3d_frame, d3d_frame,
d3d_set_nonblock_state, d3d_set_nonblock_state,
d3d_alive, d3d_alive,
d3d_focus, NULL, /* focus */
d3d_suppress_screensaver, d3d_suppress_screensaver,
NULL, /* has_windowed */ NULL, /* has_windowed */
d3d_set_shader, d3d_set_shader,
d3d_free, d3d_free,
"d3d", "d3d",
@ -1724,7 +1719,7 @@ video_driver_t video_d3d = {
d3d_set_rotation, d3d_set_rotation,
d3d_viewport_info, d3d_viewport_info,
d3d_read_viewport, d3d_read_viewport,
NULL, /* read_frame_raw */ NULL, /* read_frame_raw */
#ifdef HAVE_OVERLAY #ifdef HAVE_OVERLAY
d3d_get_overlay_interface, d3d_get_overlay_interface,
#endif #endif

View File

@ -2130,11 +2130,6 @@ static bool gl_alive(void *data)
return ret; return ret;
} }
static bool gl_focus(void *data)
{
return video_context_driver_focus();
}
static bool gl_suppress_screensaver(void *data, bool enable) static bool gl_suppress_screensaver(void *data, bool enable)
{ {
bool enabled = enable; bool enabled = enable;
@ -2709,7 +2704,7 @@ video_driver_t video_gl = {
gl_frame, gl_frame,
gl_set_nonblock_state, gl_set_nonblock_state,
gl_alive, gl_alive,
gl_focus, NULL, /* focus */
gl_suppress_screensaver, gl_suppress_screensaver,
NULL, /* has_windowed */ NULL, /* has_windowed */

View File

@ -448,11 +448,6 @@ static bool vg_alive(void *data)
return !quit; return !quit;
} }
static bool vg_focus(void *data)
{
return video_context_driver_focus();
}
static bool vg_suppress_screensaver(void *data, bool enable) static bool vg_suppress_screensaver(void *data, bool enable)
{ {
bool enabled = enable; bool enabled = enable;
@ -502,19 +497,19 @@ video_driver_t video_vg = {
vg_frame, vg_frame,
vg_set_nonblock_state, vg_set_nonblock_state,
vg_alive, vg_alive,
vg_focus, NULL, /* focused */
vg_suppress_screensaver, vg_suppress_screensaver,
NULL, /* has_windowed */ NULL, /* has_windowed */
vg_set_shader, vg_set_shader,
vg_free, vg_free,
"vg", "vg",
NULL, /* set_viewport */ NULL, /* set_viewport */
vg_set_rotation, vg_set_rotation,
vg_viewport_info, vg_viewport_info,
vg_read_viewport, vg_read_viewport,
NULL, /* read_frame_raw */ NULL, /* read_frame_raw */
#ifdef HAVE_OVERLAY #ifdef HAVE_OVERLAY
NULL, /* overlay_interface */ NULL, /* overlay_interface */
#endif #endif
vg_get_poke_interface vg_get_poke_interface
}; };

View File

@ -1258,12 +1258,6 @@ static bool vulkan_alive(void *data)
return ret; return ret;
} }
static bool vulkan_focus(void *data)
{
(void)data;
return video_context_driver_focus();
}
static bool vulkan_suppress_screensaver(void *data, bool enable) static bool vulkan_suppress_screensaver(void *data, bool enable)
{ {
(void)data; (void)data;
@ -2570,9 +2564,9 @@ video_driver_t video_vulkan = {
vulkan_frame, vulkan_frame,
vulkan_set_nonblock_state, vulkan_set_nonblock_state,
vulkan_alive, vulkan_alive,
vulkan_focus, NULL, /* focus */
vulkan_suppress_screensaver, vulkan_suppress_screensaver,
NULL, /* has_windowed */ NULL, /* has_windowed */
vulkan_set_shader, vulkan_set_shader,
vulkan_free, vulkan_free,
"vulkan", "vulkan",
@ -2580,7 +2574,7 @@ video_driver_t video_vulkan = {
vulkan_set_rotation, vulkan_set_rotation,
vulkan_viewport_info, vulkan_viewport_info,
vulkan_read_viewport, vulkan_read_viewport,
NULL, /* vulkan_read_frame_raw */ NULL, /* vulkan_read_frame_raw */
#ifdef HAVE_OVERLAY #ifdef HAVE_OVERLAY
vulkan_get_overlay_interface, vulkan_get_overlay_interface,
@ -2588,6 +2582,6 @@ video_driver_t video_vulkan = {
NULL, NULL,
#endif #endif
vulkan_get_poke_interface, vulkan_get_poke_interface,
NULL, /* vulkan_wrap_type_to_enum */ NULL, /* vulkan_wrap_type_to_enum */
}; };

View File

@ -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, void video_driver_get_status(uint64_t *frame_count, bool * is_alive,
bool *is_focused) bool *is_focused)
{ {
@ -2904,12 +2905,21 @@ bool video_context_driver_set_flags(gfx_ctx_flags_t *flags)
return true; 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) bool video_driver_has_windowed(void)
{ {
#if defined(RARCH_CONSOLE) || defined(RARCH_MOBILE) #if defined(RARCH_CONSOLE) || defined(RARCH_MOBILE)
return false; return false;
#else #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); return current_video->has_windowed(video_driver_data);
else if (video_context_data && current_video_context->has_windowed) else if (video_context_data && current_video_context->has_windowed)
return current_video_context->has_windowed(video_context_data); return current_video_context->has_windowed(video_context_data);

View File

@ -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_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); 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) \ if (current_video_context && current_video_context->swap_buffers) \
current_video_context->swap_buffers(video_context_data, video_info) 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) \ #define video_context_driver_set_resize(mode_info) \
if (current_video_context && current_video_context->set_resize) \ if (current_video_context && current_video_context->set_resize) \
current_video_context->set_resize(video_context_data, mode_info.width, mode_info.height) current_video_context->set_resize(video_context_data, mode_info.width, mode_info.height)