From 9db50c6760758089a013983f0fbf93ebde53dbc7 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 6 Dec 2015 18:39:09 +0100 Subject: vo: get rid of vo_get_window_title() It always was a weird artifact - VOCTRLs are meant _not_ to require special handling in the code that passes them through (like in vo.c). Removing it is also interesting to further reduce the dependency of backends on struct vo. Just get rid of it. Removing it is somewhat inconvenient, because in many situations the UI window is created after the first VOCTRL_UPDATE_WINDOW_TITLE. This means these backends have to store it in a new field in their own context. --- video/out/vo_sdl.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'video/out/vo_sdl.c') diff --git a/video/out/vo_sdl.c b/video/out/vo_sdl.c index d1bad6877b..5ee6cb273a 100644 --- a/video/out/vo_sdl.c +++ b/video/out/vo_sdl.c @@ -190,6 +190,7 @@ struct priv { double osd_pts; int mouse_hidden; int brightness, contrast; + char *window_title; Uint32 wakeup_event; // options @@ -353,6 +354,9 @@ static bool try_create_renderer(struct vo *vo, int i, const char *driver, vc->renderer_index = i; } + if (vc->window_title) + SDL_SetWindowTitle(vc->window, vc->window_title); + return true; } @@ -519,8 +523,6 @@ static int reconfig(struct vo *vo, struct mp_image_params *params) set_fullscreen(vo); - SDL_SetWindowTitle(vc->window, vo_get_window_title(vo)); - SDL_ShowWindow(vc->window); check_resize(vo); @@ -1012,8 +1014,10 @@ static int control(struct vo *vo, uint32_t request, void *data) SDL_ShowCursor(*(bool *)data); return true; case VOCTRL_UPDATE_WINDOW_TITLE: - if (vc->window) - SDL_SetWindowTitle(vc->window, vo_get_window_title(vo)); + talloc_free(vc->window_title); + vc->window_title = talloc_strdup(vc, (char *)data); + if (vc->window && vc->window_title) + SDL_SetWindowTitle(vc->window, vc->window_title); return true; } return VO_NOTIMPL; -- cgit v1.2.3