summaryrefslogtreecommitdiffstats
path: root/video/out/vo_sdl.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-12-06 18:39:09 +0100
committerwm4 <wm4@nowhere>2015-12-06 18:41:31 +0100
commit9db50c6760758089a013983f0fbf93ebde53dbc7 (patch)
treeb37322cdb821fdfea5e3efe190fd25b593cfdbd1 /video/out/vo_sdl.c
parent970606e49198594c243edf4a85c426693676f6a3 (diff)
downloadmpv-9db50c6760758089a013983f0fbf93ebde53dbc7.tar.bz2
mpv-9db50c6760758089a013983f0fbf93ebde53dbc7.tar.xz
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.
Diffstat (limited to 'video/out/vo_sdl.c')
-rw-r--r--video/out/vo_sdl.c12
1 files changed, 8 insertions, 4 deletions
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;