Refactor 'focus' function callback

This commit is contained in:
twinaphex 2020-07-27 13:46:55 +02:00
parent 74345f08d6
commit d6465a1348
6 changed files with 40 additions and 6 deletions

View File

@ -4573,12 +4573,20 @@ static bool gl2_has_windowed(void *data)
return false;
}
static bool gl2_focus(void *data)
{
gl_t *gl = (gl_t*)data;
if (gl && gl->ctx_driver && gl->ctx_driver->has_focus)
return gl->ctx_driver->has_focus(gl->ctx_data);
return true;
}
video_driver_t video_gl2 = {
gl2_init,
gl2_frame,
gl2_set_nonblock_state,
gl2_alive,
NULL, /* focus */
gl2_focus,
gl2_suppress_screensaver,
gl2_has_windowed,

View File

@ -968,7 +968,9 @@ static bool gl1_gfx_alive(void *data)
static bool gl1_gfx_focus(void *data)
{
(void)data;
gl1_t *gl = (gl1_t*)data;
if (gl && gl->ctx_driver && gl->ctx_driver->has_focus)
return gl->ctx_driver->has_focus(gl->ctx_data);
return true;
}

View File

@ -2304,12 +2304,20 @@ static bool gl_core_has_windowed(void *data)
return false;
}
static bool gl_core_focus(void *data)
{
gl_core_t *gl = (gl_core_t*)data;
if (gl && gl->ctx_driver && gl->ctx_driver->has_focus)
return gl->ctx_driver->has_focus(gl->ctx_data);
return true;
}
video_driver_t video_gl_core = {
gl_core_init,
gl_core_frame,
gl_core_set_nonblock_state,
gl_core_alive,
NULL, /* focus */
gl_core_focus,
gl_core_suppress_screensaver,
gl_core_has_windowed,

View File

@ -490,12 +490,20 @@ static bool vg_has_windowed(void *data)
return false;
}
static bool vg_focus(void *data)
{
vg_t *vg = (vg_t*)data;
if (vg && vg->ctx_driver && vg->ctx_driver->has_focus)
return vg->ctx_driver->has_focus(vg->ctx_data);
return true;
}
video_driver_t video_vg = {
vg_init,
vg_frame,
vg_set_nonblock_state,
vg_alive,
NULL, /* focused */
vg_focus,
vg_suppress_screensaver,
vg_has_windowed,
vg_set_shader,

View File

@ -2953,12 +2953,20 @@ static bool vulkan_has_windowed(void *data)
return false;
}
static bool vulkan_focus(void *data)
{
vk_t *vk = (vk_t*)data;
if (vk && vk->ctx_driver && vk->ctx_driver->has_focus)
return vk->ctx_driver->has_focus(vk->ctx_data);
return true;
}
video_driver_t video_vulkan = {
vulkan_init,
vulkan_frame,
vulkan_set_nonblock_state,
vulkan_alive,
NULL, /* focus */
vulkan_focus,
vulkan_suppress_screensaver,
vulkan_has_windowed,
vulkan_set_shader,

View File

@ -1276,7 +1276,7 @@ static const camera_driver_t *camera_drivers[] = {
#define INPUT_CONFIG_BIND_MAP_GET(i) ((const struct input_bind_map*)&input_config_bind_map[(i)])
#define VIDEO_HAS_FOCUS() (p_rarch->current_video_context.has_focus ? p_rarch->current_video_context.has_focus(p_rarch->video_context_data) : p_rarch->current_video->focus ? (p_rarch->current_video && p_rarch->current_video->focus && p_rarch->current_video->focus(p_rarch->video_driver_data)) : true)
#define VIDEO_HAS_FOCUS() (p_rarch->current_video->focus ? (p_rarch->current_video->focus(p_rarch->video_driver_data)) : true)
#if HAVE_DYNAMIC
#define RUNAHEAD_RUN_SECONDARY() \