Add video context driver update window title callback

to video_frame_info_t
This commit is contained in:
twinaphex 2017-05-18 02:53:12 +02:00
parent 668813cca9
commit 86ee08b7a7
8 changed files with 42 additions and 4 deletions

View File

@ -1461,6 +1461,10 @@ static bool d3d_frame(void *data, const void *frame,
}
#endif
if (video_info->cb_update_window_title)
video_info->cb_update_window_title(
video_info->context_data, video_info);
video_context_driver_swap_buffers(video_info);
return true;

View File

@ -272,6 +272,10 @@ static bool gdi_gfx_frame(void *data, const void *frame,
InvalidateRect(hwnd, NULL, false);
if (video_info->cb_update_window_title)
video_info->cb_update_window_title(
video_info->context_data, video_info);
return true;
}

View File

@ -1272,6 +1272,10 @@ static bool gl_frame(void *data, const void *frame,
gl_render_overlay(gl, video_info);
#endif
if (video_info->cb_update_window_title)
video_info->cb_update_window_title(
video_info->context_data, video_info);
#ifdef HAVE_FBO
/* Reset state which could easily mess up libretro core. */
if (gl->hw_render_fbo_init)

View File

@ -422,6 +422,10 @@ static bool vg_frame(void *data, const void *frame,
vg_draw_message(vg, msg);
#endif
if (video_info->cb_update_window_title)
video_info->cb_update_window_title(
video_info->context_data, video_info);
video_context_driver_swap_buffers(video_info);
return true;

View File

@ -244,6 +244,10 @@ static bool vga_gfx_frame(void *data, const void *frame,
if (msg)
font_driver_render_msg(video_info, NULL, msg, NULL);
if (video_info->cb_update_window_title)
video_info->cb_update_window_title(
video_info->context_data, video_info);
return true;
}

View File

@ -1926,6 +1926,11 @@ static bool vulkan_frame(void *data, const void *frame,
video_context_driver_swap_buffers(video_info);
if (!vk->context->swap_interval_emulation_lock)
if (video_info->cb_update_window_title)
video_info->cb_update_window_title(
video_info->context_data, video_info);
/* Handle spurious swapchain invalidations as soon as we can,
* i.e. right after swap buffers. */
if (vk->should_resize)

View File

@ -2266,9 +2266,6 @@ void video_driver_frame(const void *data, unsigned width,
if (video_info.fps_show)
runloop_msg_queue_push(video_info.fps_text, 1, 1, false);
if (current_video_context && current_video_context->update_window_title)
current_video_context->update_window_title(video_context_data, &video_info);
}
void video_driver_display_type_set(enum rarch_display_type type)
@ -2412,6 +2409,16 @@ void video_driver_build_info(video_frame_info_t *video_info)
video_info->runloop_is_slowmotion = is_slowmotion;
video_info->input_driver_nonblock_state = input_driver_is_nonblock_state();
video_info->context_data = video_context_data;
video_info->cb_update_window_title = NULL;
if (current_video_context)
{
if (current_video_context->update_window_title)
video_info->cb_update_window_title = current_video_context->update_window_title;
}
#ifdef HAVE_THREADS
video_driver_threaded_unlock(is_threaded);
#endif

View File

@ -74,6 +74,10 @@ enum display_flags
typedef void (*gfx_ctx_proc_t)(void);
typedef struct video_frame_info video_frame_info_t;
typedef void (*update_window_title)(void*, video_frame_info_t *video_info);
typedef struct video_info
{
/* Width of window.
@ -199,6 +203,8 @@ typedef struct video_frame_info
float xmb_alpha_factor;
char fps_text[128];
update_window_title cb_update_window_title;
void *context_data;
} video_frame_info_t;
typedef struct gfx_ctx_driver
@ -242,7 +248,7 @@ typedef struct gfx_ctx_driver
float (*translate_aspect)(void*, unsigned, unsigned);
/* Asks driver to update window title (FPS, etc). */
void (*update_window_title)(void*, video_frame_info_t *video_info);
update_window_title update_window_title;
/* Queries for resize and quit events.
* Also processes events. */