diff --git a/gfx/drivers/d3d.cpp b/gfx/drivers/d3d.cpp index fb0b07babf..9cf41c3cdc 100644 --- a/gfx/drivers/d3d.cpp +++ b/gfx/drivers/d3d.cpp @@ -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; diff --git a/gfx/drivers/gdi_gfx.c b/gfx/drivers/gdi_gfx.c index 34e370052c..2fbd97ec19 100644 --- a/gfx/drivers/gdi_gfx.c +++ b/gfx/drivers/gdi_gfx.c @@ -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; } diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index d0c931f53f..9a9c3b3361 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -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) diff --git a/gfx/drivers/vg.c b/gfx/drivers/vg.c index cb22429821..cecba6ce01 100644 --- a/gfx/drivers/vg.c +++ b/gfx/drivers/vg.c @@ -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; diff --git a/gfx/drivers/vga_gfx.c b/gfx/drivers/vga_gfx.c index 2d3ca4eca2..6113dc75d1 100644 --- a/gfx/drivers/vga_gfx.c +++ b/gfx/drivers/vga_gfx.c @@ -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; } diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index 29b806cbbc..a179ffa997 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -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) diff --git a/gfx/video_driver.c b/gfx/video_driver.c index 2e0c085dd4..7267d03c7c 100644 --- a/gfx/video_driver.c +++ b/gfx/video_driver.c @@ -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 diff --git a/gfx/video_driver.h b/gfx/video_driver.h index e9413e2bd8..3d4838481a 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -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. */