diff options
Diffstat (limited to 'video/out/cocoa_common.m')
-rw-r--r-- | video/out/cocoa_common.m | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/video/out/cocoa_common.m b/video/out/cocoa_common.m index c316a09a04..ab2f666c3e 100644 --- a/video/out/cocoa_common.m +++ b/video/out/cocoa_common.m @@ -106,6 +106,8 @@ struct vo_cocoa_state { int frame_w, frame_h; // dimensions of the frame rendered NSCursor *blankCursor; + + char *window_title; }; static void run_on_main_thread(struct vo *vo, void(^block)(void)) @@ -504,14 +506,15 @@ static void create_ui(struct vo *vo, struct mp_rect *win, int geo_flags) } } -static int cocoa_set_window_title(struct vo *vo, const char *title) +static int cocoa_set_window_title(struct vo *vo) { struct vo_cocoa_state *s = vo->cocoa; if (s->embedded) return VO_NOTIMPL; void *talloc_ctx = talloc_new(NULL); - struct bstr btitle = bstr_sanitize_utf8_latin1(talloc_ctx, bstr0(title)); + struct bstr btitle = + bstr_sanitize_utf8_latin1(talloc_ctx, bstr0(s->window_title)); NSString *nstitle = [NSString stringWithUTF8String:btitle.start]; if (nstitle) { [s->window setTitle: nstitle]; @@ -584,7 +587,7 @@ int vo_cocoa_config_window(struct vo *vo) queue_new_video_size(vo, width, height); vo_cocoa_fullscreen(vo); cocoa_add_fs_screen_profile_observer(vo); - cocoa_set_window_title(vo, vo_get_window_title(vo)); + cocoa_set_window_title(vo); vo_set_level(vo, vo->opts->ontop); } @@ -763,8 +766,12 @@ static int vo_cocoa_control_on_main_thread(struct vo *vo, int request, void *arg } case VOCTRL_SET_CURSOR_VISIBILITY: return vo_cocoa_set_cursor_visibility(vo, arg); - case VOCTRL_UPDATE_WINDOW_TITLE: - return cocoa_set_window_title(vo, (const char *) arg); + case VOCTRL_UPDATE_WINDOW_TITLE: { + struct vo_cocoa_state *s = vo->cocoa; + talloc_free(s->window_title); + s->window_title = talloc_strdup(s, (char *) arg); + return cocoa_set_window_title(vo); + } case VOCTRL_RESTORE_SCREENSAVER: enable_power_management(vo->cocoa); return VO_TRUE; |