diff --git a/driver.h b/driver.h index b8bab0f898..ca575f3555 100644 --- a/driver.h +++ b/driver.h @@ -234,6 +234,7 @@ typedef struct video_poke_interface void (*set_filtering)(void *data, unsigned index, bool smooth); void (*set_fbo_state)(void *data, unsigned state); void (*set_aspect_ratio)(void *data, unsigned aspectratio_index); + void (*apply_state_changes)(void *data); // Set to NULL if RGUI texture is not supposed to be rendered. void (*set_rgui_texture)(void *data, const void *frame); diff --git a/gfx/gl.c b/gfx/gl.c index 9be3389d69..b30ac028ce 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -2294,11 +2294,18 @@ static void gl_set_rgui_texture(void *data, const void *frame) } #endif +static void gl_apply_state_changes(void *data) +{ + gl_t *gl = (gl_t*)data; + gl->should_resize = true; +} + static const video_poke_interface_t gl_poke_interface = { gl_set_blend, gl_set_filtering, gl_set_fbo_state, gl_set_aspect_ratio, + gl_apply_state_changes, #ifdef HAVE_RGUI gl_set_rgui_texture, #endif diff --git a/gfx/thread_wrapper.c b/gfx/thread_wrapper.c index 56f7095d36..1b594f46c5 100644 --- a/gfx/thread_wrapper.c +++ b/gfx/thread_wrapper.c @@ -71,6 +71,7 @@ typedef struct thread_video #ifdef HAVE_RGUI const void *rgui_texture; #endif + bool apply_state_changes; bool alive; bool focus; @@ -300,6 +301,11 @@ static void thread_loop(void *data) #ifdef HAVE_RGUI thr->poke->set_rgui_texture(thr->driver_data, thr->rgui_texture); #endif + if (thr->apply_state_changes) + { + thr->poke->apply_state_changes(thr->driver_data); + thr->apply_state_changes = false; + } bool ret = thr->driver->frame(thr->driver_data, thr->frame.buffer, thr->frame.width, thr->frame.height, @@ -638,11 +644,20 @@ static void thread_set_rgui_texture(void *data, const void *frame) } #endif +static void thread_apply_state_changes(void *data) +{ + thread_video_t *thr = (thread_video_t*)data; + slock_lock(thr->frame.lock); + thr->apply_state_changes = true; + slock_unlock(thr->frame.lock); +} + static const video_poke_interface_t thread_poke = { thread_set_blend, thread_set_filtering, thread_set_fbo_state, thread_set_aspect_ratio, + thread_apply_state_changes, #ifdef HAVE_RGUI thread_set_rgui_texture, #endif diff --git a/gx/gx_video.c b/gx/gx_video.c index b5fa122db2..a2aa49dc37 100644 --- a/gx/gx_video.c +++ b/gx/gx_video.c @@ -1031,11 +1031,18 @@ static void gx_set_rgui_texture(void *data, const void *frame) gx->menu_data = (uint32_t*)frame; } +static void gx_apply_state_changes(void *data) +{ + gx_video_t *gx = (gx_video_t*)data; + gx->should_resize = true; +} + static const video_poke_interface_t gx_poke_interface = { NULL, NULL, NULL, gx_set_aspect_ratio, + gx_apply_state_changes, gx_set_rgui_texture, };