From d4de92e80897abb64dc8ccecb7823cbe291bb52d Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 6 Dec 2011 20:23:54 +0100 Subject: libvo: remove title argument from struct vo_driver.config This affects only the "new" VO API. The config() title argument was barely used, and it's hardcoded to "MPlayer" in vf_vo.c. The X11 and the Cocoa GUI backends, which are the only ones properly supporting window titles, ignored this argument. Remove the title argument. Add the vo_get_window_title function. All GUI VOs are supposed to use it for the window title. --- libmpcodecs/vd.c | 5 ++--- libmpcodecs/vf_vo.c | 2 +- libvo/cocoa_common.h | 3 +-- libvo/cocoa_common.m | 18 ++---------------- libvo/gl_common.c | 18 +++++++----------- libvo/gl_common.h | 2 +- libvo/old_vo_wrapper.c | 5 +++-- libvo/old_vo_wrapper.h | 2 +- libvo/video_out.c | 16 ++++++++++++++-- libvo/video_out.h | 5 +++-- libvo/vo_gl.c | 10 +++++----- libvo/vo_vdpau.c | 4 ++-- libvo/vo_xv.c | 5 ++--- libvo/x11_common.c | 10 +++------- libvo/x11_common.h | 5 +++-- 15 files changed, 50 insertions(+), 60 deletions(-) diff --git a/libmpcodecs/vd.c b/libmpcodecs/vd.c index 21c940b9be..564ad2a911 100644 --- a/libmpcodecs/vd.c +++ b/libmpcodecs/vd.c @@ -321,9 +321,8 @@ int mpcodecs_config_vo2(sh_video_t *sh, int w, int h, // Time to config libvo! mp_msg(MSGT_CPLAYER, MSGL_V, - "VO Config (%dx%d->%dx%d,flags=%d,'%s',0x%X)\n", sh->disp_w, - sh->disp_h, screen_size_x, screen_size_y, vocfg_flags, "MPlayer", - out_fmt); + "VO Config (%dx%d->%dx%d,flags=%d,0x%X)\n", sh->disp_w, + sh->disp_h, screen_size_x, screen_size_y, vocfg_flags, out_fmt); vf->w = sh->disp_w; vf->h = sh->disp_h; diff --git a/libmpcodecs/vf_vo.c b/libmpcodecs/vf_vo.c index 9e2612654c..499184d37f 100644 --- a/libmpcodecs/vf_vo.c +++ b/libmpcodecs/vf_vo.c @@ -79,7 +79,7 @@ static int config(struct vf_instance *vf, vf->default_caps=query_format(vf,outfmt); vf->draw_slice = (vf->default_caps & VOCAP_NOSLICES) ? NULL : draw_slice; - if (vo_config(video_out, width, height, d_width, d_height, flags, "MPlayer", outfmt)) + if (vo_config(video_out, width, height, d_width, d_height, flags, outfmt)) return 0; #ifdef CONFIG_ASS diff --git a/libvo/cocoa_common.h b/libvo/cocoa_common.h index 25027e1417..c5d24e9178 100644 --- a/libvo/cocoa_common.h +++ b/libvo/cocoa_common.h @@ -10,8 +10,7 @@ void vo_cocoa_update_xinerama_info(struct vo *vo); int vo_cocoa_change_attributes(struct MPGLContext *ctx); int vo_cocoa_create_window(struct MPGLContext *ctx, uint32_t d_width, - uint32_t d_height, uint32_t flags, - const char *title); + uint32_t d_height, uint32_t flags); void vo_cocoa_swap_buffers(void); int vo_cocoa_check_events(struct vo *vo); diff --git a/libvo/cocoa_common.m b/libvo/cocoa_common.m index 5e9771bb8c..56749861c2 100644 --- a/libvo/cocoa_common.m +++ b/libvo/cocoa_common.m @@ -64,7 +64,6 @@ struct vo *l_vo; // local function definitions struct vo_cocoa_state *vo_cocoa_init_state(void); void update_screen_info(void); -const char *title_from_vo_and_title(struct vo *vo, const char *title); void resize_window(struct vo *vo); void create_menu(void); @@ -136,19 +135,6 @@ int vo_cocoa_change_attributes(struct MPGLContext *ctx) return SET_WINDOW_OK; } -// this function exists because vf_vo.c calls config with title = "MPlayer" -// and from the vo it will come down to the backend (ignoring --use-filename-title) -const char *title_from_vo_and_title(struct vo *vo, const char *title) -{ - if (vo->opts->vo_wintitle) { - return vo->opts->vo_wintitle; - } else if (title) { - return title; - } else { - return "mplayer2"; - } -} - void resize_window(struct vo *vo) { vo->dwidth = [[s->window contentView] frame].size.width; @@ -157,7 +143,7 @@ void resize_window(struct vo *vo) } int vo_cocoa_create_window(struct MPGLContext *ctx, uint32_t d_width, - uint32_t d_height, uint32_t flags, const char *title) + uint32_t d_height, uint32_t flags) { if (s->current_video_size.width > 0 || s->current_video_size.height > 0) s->previous_video_size = s->current_video_size; @@ -222,7 +208,7 @@ int vo_cocoa_create_window(struct MPGLContext *ctx, uint32_t d_width, if (s->window_title) [s->window_title release]; - s->window_title = [[NSString alloc] initWithUTF8String:title_from_vo_and_title(ctx->vo,title)]; + s->window_title = [[NSString alloc] initWithUTF8String:vo_get_window_title(ctx->vo)]; [s->window setTitle: s->window_title]; return SET_WINDOW_OK; diff --git a/libvo/gl_common.c b/libvo/gl_common.c index d35318bd68..27febc1b36 100644 --- a/libvo/gl_common.c +++ b/libvo/gl_common.c @@ -1613,10 +1613,9 @@ void glDrawTex(GL *gl, GLfloat x, GLfloat y, GLfloat w, GLfloat h, #ifdef CONFIG_GL_COCOA #include "cocoa_common.h" static int create_window_cocoa(struct MPGLContext *ctx, uint32_t d_width, - uint32_t d_height, uint32_t flags, - const char *title) + uint32_t d_height, uint32_t flags) { - return vo_cocoa_create_window(ctx, d_width, d_height, flags, title); + return vo_cocoa_create_window(ctx, d_width, d_height, flags); } static int setGlWindow_cocoa(MPGLContext *ctx) { @@ -1654,8 +1653,7 @@ static void cocoa_fullscreen(struct vo *vo) #include "w32_common.h" static int create_window_w32(struct MPGLContext *ctx, uint32_t d_width, - uint32_t d_height, uint32_t flags, - const char *title) + uint32_t d_height, uint32_t flags) { if (!vo_w32_config(d_width, d_height, flags)) return -1; @@ -1771,8 +1769,7 @@ static void new_w32_update_xinerama_info(struct vo *vo) { w32_update_xinerama_in #include "x11_common.h" static int create_window_x11(struct MPGLContext *ctx, uint32_t d_width, - uint32_t d_height, uint32_t flags, - const char *title) + uint32_t d_height, uint32_t flags) { struct vo *vo = ctx->vo; @@ -1805,7 +1802,7 @@ static int create_window_x11(struct MPGLContext *ctx, uint32_t d_width, Colormap colormap = XCreateColormap(vo->x11->display, vo->x11->rootwin, vinfo->visual, AllocNone); vo_x11_create_vo_window(vo, vinfo, vo->dx, vo->dy, d_width, d_height, - flags, colormap, "gl", title); + flags, colormap, "gl"); return 0; } @@ -1968,10 +1965,9 @@ static void swapGlBuffers_x11(MPGLContext *ctx) #include "sdl_common.h" static int create_window_sdl(struct MPGLContext *ctx, uint32_t d_width, - uint32_t d_height, uint32_t flags, - const char *title) + uint32_t d_height, uint32_t flags) { - SDL_WM_SetCaption(title, NULL); + SDL_WM_SetCaption(vo_get_window_title(ctx->vo), NULL); ctx->vo->dwidth = d_width; ctx->vo->dheight = d_height; return 0; diff --git a/libvo/gl_common.h b/libvo/gl_common.h index 88a2507060..8e3294f441 100644 --- a/libvo/gl_common.h +++ b/libvo/gl_common.h @@ -387,7 +387,7 @@ typedef struct MPGLContext { #endif } context; int (*create_window)(struct MPGLContext *ctx, uint32_t d_width, - uint32_t d_height, uint32_t flags, const char *title); + uint32_t d_height, uint32_t flags); int (*setGlWindow)(struct MPGLContext *); void (*releaseGlContext)(struct MPGLContext *); void (*swapGlBuffers)(struct MPGLContext *); diff --git a/libvo/old_vo_wrapper.c b/libvo/old_vo_wrapper.c index a99511d831..b3053eb57f 100644 --- a/libvo/old_vo_wrapper.c +++ b/libvo/old_vo_wrapper.c @@ -34,10 +34,11 @@ int old_vo_preinit(struct vo *vo, const char *arg) int old_vo_config(struct vo *vo, uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, - uint32_t flags, char *title, uint32_t format) + uint32_t flags, uint32_t format) { return vo->driver->old_functions->config(width, height, d_width, - d_height, flags, title, format); + d_height, flags, "MPlayer", + format); } diff --git a/libvo/old_vo_wrapper.h b/libvo/old_vo_wrapper.h index 250a1187fe..f18ee296f4 100644 --- a/libvo/old_vo_wrapper.h +++ b/libvo/old_vo_wrapper.h @@ -10,7 +10,7 @@ extern struct osd_state *global_osd; int old_vo_preinit(struct vo *vo, const char *); int old_vo_config(struct vo *vo, uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, - uint32_t flags, char *title, uint32_t format); + uint32_t flags, uint32_t format); int old_vo_control(struct vo *vo, uint32_t request, void *data); int old_vo_draw_frame(struct vo *vo, uint8_t *src[]); int old_vo_draw_slice(struct vo *vo, uint8_t *src[], int stride[], diff --git a/libvo/video_out.c b/libvo/video_out.c index e796784b1e..8c2f551e4c 100644 --- a/libvo/video_out.c +++ b/libvo/video_out.c @@ -437,7 +437,7 @@ static int event_fd_callback(void *ctx, int fd) int vo_config(struct vo *vo, uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, - char *title, uint32_t format) + uint32_t format) { struct MPOpts *opts = vo->opts; panscan_init(vo); @@ -458,7 +458,7 @@ int vo_config(struct vo *vo, uint32_t width, uint32_t height, } int ret = vo->driver->config(vo, width, height, d_width, d_height, flags, - title, format); + format); vo->config_ok = (ret == 0); vo->config_count += vo->config_ok; if (vo->registered_fd == -1 && vo->event_fd != -1 && vo->config_ok) { @@ -552,6 +552,18 @@ void calc_src_dst_rects(struct vo *vo, int src_width, int src_height, dst->height = dst->bottom - dst->top; } +// Return the window title the VO should set. Always returns a null terminated +// string. The string is valid until frontend code is invoked again. Copy it if +// you need to keep the string for an extended period of time. +const char *vo_get_window_title(struct vo *vo) +{ + if (vo->opts->vo_wintitle) { + return vo->opts->vo_wintitle; + } else { + return "MPlayer"; + } +} + /** * Generates a mouse movement message if those are enable and sends it * to the "main" MPlayer. diff --git a/libvo/video_out.h b/libvo/video_out.h index bd7b2e8fa5..e5d2f78c8a 100644 --- a/libvo/video_out.h +++ b/libvo/video_out.h @@ -188,7 +188,7 @@ struct vo_driver { */ int (*config)(struct vo *vo, uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t fullscreen, - char *title, uint32_t format); + uint32_t format); /* * Control interface @@ -298,7 +298,7 @@ struct vo *init_best_video_out(struct MPOpts *opts, struct vo_x11_state *x11, struct input_ctx *input_ctx); int vo_config(struct vo *vo, uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, - char *title, uint32_t format); + uint32_t format); void list_video_out(void); int vo_control(struct vo *vo, uint32_t request, void *data); @@ -313,6 +313,7 @@ void vo_check_events(struct vo *vo); void vo_seek_reset(struct vo *vo); void vo_destroy(struct vo *vo); +const char *vo_get_window_title(struct vo *vo); // NULL terminated array of all drivers extern const struct vo_driver *video_out_drivers[]; diff --git a/libvo/vo_gl.c b/libvo/vo_gl.c index b38a8d75e4..dbaef279d8 100644 --- a/libvo/vo_gl.c +++ b/libvo/vo_gl.c @@ -647,19 +647,19 @@ static int initGl(struct vo *vo, uint32_t d_width, uint32_t d_height) } static int create_window(struct vo *vo, uint32_t d_width, uint32_t d_height, - uint32_t flags, const char *title) + uint32_t flags) { struct gl_priv *p = vo->priv; if (p->stereo_mode == GL_3D_QUADBUFFER) flags |= VOFLAG_STEREO; - return p->glctx->create_window(p->glctx, d_width, d_height, flags, title); + return p->glctx->create_window(p->glctx, d_width, d_height, flags); } static int config(struct vo *vo, uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, - char *title, uint32_t format) + uint32_t format) { struct gl_priv *p = vo->priv; @@ -676,7 +676,7 @@ static int config(struct vo *vo, uint32_t width, uint32_t height, p->vo_flipped = !!(flags & VOFLAG_FLIPPING); - if (create_window(vo, d_width, d_height, flags, title) < 0) + if (create_window(vo, d_width, d_height, flags) < 0) return -1; if (vo->config_count) @@ -1384,7 +1384,7 @@ static int preinit_internal(struct vo *vo, const char *arg, int allow_sw, } if (p->use_yuv == -1 || !allow_sw) { - if (create_window(vo, 320, 200, VOFLAG_HIDDEN, NULL) < 0) + if (create_window(vo, 320, 200, VOFLAG_HIDDEN) < 0) goto err_out; if (p->glctx->setGlWindow(p->glctx) == SET_WINDOW_FAILED) goto err_out; diff --git a/libvo/vo_vdpau.c b/libvo/vo_vdpau.c index be4540002b..d58607e135 100644 --- a/libvo/vo_vdpau.c +++ b/libvo/vo_vdpau.c @@ -864,7 +864,7 @@ static int handle_preemption(struct vo *vo) */ static int config(struct vo *vo, uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, - char *title, uint32_t format) + uint32_t format) { struct vdpctx *vc = vo->priv; struct vo_x11_state *x11 = vo->x11; @@ -912,7 +912,7 @@ static int config(struct vo *vo, uint32_t width, uint32_t height, xswamask = CWBorderPixel; vo_x11_create_vo_window(vo, &vinfo, vo->dx, vo->dy, d_width, d_height, - flags, CopyFromParent, "vdpau", title); + flags, CopyFromParent, "vdpau"); XChangeWindowAttributes(x11->display, x11->window, xswamask, &xswa); #ifdef CONFIG_XF86VM diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c index 694dbc048a..deda443594 100644 --- a/libvo/vo_xv.c +++ b/libvo/vo_xv.c @@ -200,7 +200,7 @@ static void resize(struct vo *vo) */ static int config(struct vo *vo, uint32_t width, uint32_t height, uint32_t d_width, uint32_t d_height, uint32_t flags, - char *title, uint32_t format) + uint32_t format) { struct vo_x11_state *x11 = vo->x11; XVisualInfo vinfo; @@ -265,8 +265,7 @@ static int config(struct vo *vo, uint32_t width, uint32_t height, } vo_x11_create_vo_window(vo, &vinfo, vo->dx, vo->dy, vo->dwidth, - vo->dheight, flags, CopyFromParent, "xv", - title); + vo->dheight, flags, CopyFromParent, "xv"); XChangeWindowAttributes(x11->display, x11->window, xswamask, &xswa); #ifdef CONFIG_XF86VM diff --git a/libvo/x11_common.c b/libvo/x11_common.c index 1b7636bba8..a9397bd199 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -1032,15 +1032,13 @@ static Window vo_x11_create_smooth_window(struct vo_x11_state *x11, Window mRoot * Only VOFLAG_FULLSCREEN is supported so far. * \param col_map Colourmap for window or CopyFromParent if a specific colormap isn't needed * \param classname name to use for the classhint - * \param title title for the window * * This also does the grunt-work like setting Window Manager hints etc. * If vo_window is already set it just moves and resizes it. */ void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y, unsigned int width, unsigned int height, int flags, - Colormap col_map, - const char *classname, const char *title) + Colormap col_map, const char *classname) { struct MPOpts *opts = vo->opts; struct vo_x11_state *x11 = vo->x11; @@ -1083,7 +1081,6 @@ void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y, XSizeHints hint; x11->window_state &= ~VOFLAG_HIDDEN; vo_x11_classhint(vo, x11->window, classname); - XStoreName(mDisplay, x11->window, title); vo_hidecursor(mDisplay, x11->window); XSelectInput(mDisplay, x11->window, StructureNotifyMask); hint.x = x; hint.y = y; @@ -1091,6 +1088,7 @@ void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y, hint.flags = PSize; if (geometry_xy_changed) hint.flags |= PPosition; + const char *title = "MPlayer"; XSetStandardProperties(mDisplay, x11->window, title, title, None, NULL, 0, &hint); if (!vo_border) vo_x11_decoration(vo, 0); // map window @@ -1305,7 +1303,6 @@ static int vo_x11_get_fs_type(int supported) */ int vo_x11_update_geometry(struct vo *vo, bool update_pos) { - struct MPOpts *opts = vo->opts; struct vo_x11_state *x11 = vo->x11; unsigned depth, w, h; int dummy_int; @@ -1319,8 +1316,7 @@ int vo_x11_update_geometry(struct vo *vo, bool update_pos) if (update_pos) XTranslateCoordinates(x11->display, x11->window, x11->rootwin, 0, 0, &vo->dx, &vo->dy, &dummy_win); - if (opts->vo_wintitle) - XStoreName(x11->display, x11->window, opts->vo_wintitle); + XStoreName(x11->display, x11->window, vo_get_window_title(vo)); return depth <= INT_MAX ? depth : 0; } diff --git a/libvo/x11_common.h b/libvo/x11_common.h index ab5188159c..a4e5c56a8e 100644 --- a/libvo/x11_common.h +++ b/libvo/x11_common.h @@ -135,7 +135,7 @@ uint32_t vo_x11_get_equalizer(const char *name, int *value); void fstype_help(void); void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y, unsigned int width, unsigned int height, int flags, - Colormap col_map, const char *classname, const char *title); + Colormap col_map, const char *classname); void vo_x11_clearwindow_part(struct vo *vo, Window vo_window, int img_width, int img_height); void vo_x11_clearwindow(struct vo *vo, Window vo_window); @@ -184,7 +184,8 @@ void xscreensaver_heartbeat(struct vo_x11_state *x11); // Old VOs use incompatible function calls, translate them to new // prototypes #ifdef IS_OLD_VO -#define vo_x11_create_vo_window(...) vo_x11_create_vo_window(global_vo, __VA_ARGS__) +#define vo_x11_create_vo_window(vis, x, y, width, height, flags, col_map, classname, title) \ + vo_x11_create_vo_window(global_vo, vis, x, y, width, height, flags, col_map, classname) #define vo_x11_fullscreen() vo_x11_fullscreen(global_vo) #define vo_x11_update_geometry() vo_x11_update_geometry(global_vo, 1) #define vo_x11_ontop() vo_x11_ontop(global_vo) -- cgit v1.2.3 From 3df6dc718acc762df8f9fc5c44735aec795b7020 Mon Sep 17 00:00:00 2001 From: wm4 Date: Tue, 6 Dec 2011 18:48:31 +0100 Subject: x11: set window titles as UTF-8 Always set the X11 window title properties as UTF-8. This is a bit tricky for X11 window properties which are not specified to use UTF-8, such as WM_NAME. We also properly set WM_ICON_NAME, which means the window caption and the text used in the task bar (of the WM has one) will be the same on most window managers. Before this commit, WM_ICON_NAME was always hardcoded to "MPlayer", even if --title or --use-filename-title was used. Also update the window title only on reconfigure, like it is done in mplayer-svn commit 34380. --- libvo/x11_common.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++--- libvo/x11_common.h | 3 +++ 2 files changed, 58 insertions(+), 3 deletions(-) diff --git a/libvo/x11_common.c b/libvo/x11_common.c index a9397bd199..2c7572e8b1 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -327,11 +327,14 @@ static void init_atoms(struct vo_x11_state *x11) XA_INIT(_NET_WM_STATE_STAYS_ON_TOP); XA_INIT(_NET_WM_STATE_BELOW); XA_INIT(_NET_WM_PID); + XA_INIT(_NET_WM_NAME); + XA_INIT(_NET_WM_ICON_NAME); XA_INIT(_WIN_PROTOCOLS); XA_INIT(_WIN_LAYER); XA_INIT(_WIN_HINTS); XA_INIT(WM_PROTOCOLS); XA_INIT(WM_DELETE_WINDOW); + XA_INIT(UTF8_STRING); } void update_xinerama_info(struct vo *vo) { @@ -990,6 +993,56 @@ static int vo_x11_get_gnome_layer(struct vo_x11_state *x11, Window win) return WIN_LAYER_NORMAL; } +// set a X text property that expects a STRING type +static void vo_x11_set_property_string(struct vo *vo, Atom name, const char *t) +{ + struct vo_x11_state *x11 = vo->x11; + XTextProperty prop = {0}; + int success; + + success = Xutf8TextListToTextProperty(x11->display, (char **)&t, 1, + XStringStyle, &prop); + + // The call can fail if the string uses characters not in the STRING + // encoding (which is latin-1 as far as I can tell). Try COMPOUND_TEXT + // instead. (It is possible that COMPOUND_TEXT always works, but since the + // difference in the type used for the property is visible to the Window + // manager and the ICCCM seems to specify STRING, we're trying to be careful + // and try STRING first.) + // GTK seems to follow about the same fallback mechanism. + if (success != Success) { + XFree(prop.value); + prop.value = NULL; + success = Xutf8TextListToTextProperty(x11->display, (char **)&t, 1, + XCompoundTextStyle, &prop); + } + + if (success == Success) + XSetTextProperty(x11->display, x11->window, &prop, name); + + XFree(prop.value); +} + +// set a X text property that expects a UTF8_STRING type +static void vo_x11_set_property_utf8(struct vo *vo, Atom name, const char *t) +{ + struct vo_x11_state *x11 = vo->x11; + + XChangeProperty(x11->display, x11->window, name, x11->XAUTF8_STRING, 8, + PropModeReplace, t, strlen(t)); +} + +static void vo_x11_update_window_title(struct vo *vo) +{ + struct vo_x11_state *x11 = vo->x11; + + const char *title = vo_get_window_title(vo); + vo_x11_set_property_string(vo, XA_WM_NAME, title); + vo_x11_set_property_string(vo, XA_WM_ICON_NAME, title); + vo_x11_set_property_utf8(vo, x11->XA_NET_WM_NAME, title); + vo_x11_set_property_utf8(vo, x11->XA_NET_WM_ICON_NAME, title); +} + // static Window vo_x11_create_smooth_window(struct vo_x11_state *x11, Window mRoot, Visual * vis, int x, int y, @@ -1088,8 +1141,7 @@ void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y, hint.flags = PSize; if (geometry_xy_changed) hint.flags |= PPosition; - const char *title = "MPlayer"; - XSetStandardProperties(mDisplay, x11->window, title, title, None, NULL, 0, &hint); + XSetWMNormalHints(mDisplay, x11->window, &hint); if (!vo_border) vo_x11_decoration(vo, 0); // map window XSelectInput(mDisplay, x11->window, NoEventMask); @@ -1099,6 +1151,7 @@ void vo_x11_create_vo_window(struct vo *vo, XVisualInfo *vis, int x, int y, XMapWindow(mDisplay, x11->window); vo_x11_clearwindow(vo, x11->window); } + vo_x11_update_window_title(vo); if (opts->vo_ontop) vo_x11_setlayer(vo, x11->window, opts->vo_ontop); vo_x11_update_geometry(vo, !geometry_xy_changed); vo_x11_nofs_sizepos(vo, vo->dx, vo->dy, width, height); @@ -1316,7 +1369,6 @@ int vo_x11_update_geometry(struct vo *vo, bool update_pos) if (update_pos) XTranslateCoordinates(x11->display, x11->window, x11->rootwin, 0, 0, &vo->dx, &vo->dy, &dummy_win); - XStoreName(x11->display, x11->window, vo_get_window_title(vo)); return depth <= INT_MAX ? depth : 0; } diff --git a/libvo/x11_common.h b/libvo/x11_common.h index a4e5c56a8e..a8b13cc690 100644 --- a/libvo/x11_common.h +++ b/libvo/x11_common.h @@ -85,11 +85,14 @@ struct vo_x11_state { Atom XA_NET_WM_STATE_STAYS_ON_TOP; Atom XA_NET_WM_STATE_BELOW; Atom XA_NET_WM_PID; + Atom XA_NET_WM_NAME; + Atom XA_NET_WM_ICON_NAME; Atom XA_WIN_PROTOCOLS; Atom XA_WIN_LAYER; Atom XA_WIN_HINTS; Atom XAWM_PROTOCOLS; Atom XAWM_DELETE_WINDOW; + Atom XAUTF8_STRING; }; #if defined(CONFIG_GL) || defined(CONFIG_X11) || defined(CONFIG_XV) -- cgit v1.2.3 From 82118dc35edfbf9b6714e1e4e6b1823fc3205ff7 Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 5 Dec 2011 23:17:34 +0100 Subject: libvo: change default window title to "mplayer2" Also change the WM_CLASS "application class" string from "MPlayer" to "mplayer2". This string is visible as application name in Gnome 3. --- libvo/video_out.c | 2 +- libvo/x11_common.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/libvo/video_out.c b/libvo/video_out.c index 8c2f551e4c..2333afcb80 100644 --- a/libvo/video_out.c +++ b/libvo/video_out.c @@ -560,7 +560,7 @@ const char *vo_get_window_title(struct vo *vo) if (vo->opts->vo_wintitle) { return vo->opts->vo_wintitle; } else { - return "MPlayer"; + return "mplayer2"; } } diff --git a/libvo/x11_common.c b/libvo/x11_common.c index 2c7572e8b1..cdbbc213b5 100644 --- a/libvo/x11_common.c +++ b/libvo/x11_common.c @@ -715,7 +715,7 @@ void vo_x11_classhint(struct vo *vo, Window window, const char *name) pid_t pid = getpid(); wmClass.res_name = opts->vo_winname ? opts->vo_winname : (char *)name; - wmClass.res_class = "MPlayer"; + wmClass.res_class = "mplayer2"; XSetClassHint(x11->display, window, &wmClass); XChangeProperty(x11->display, window, x11->XA_NET_WM_PID, XA_CARDINAL, 32, PropModeReplace, (unsigned char *) &pid, 1); -- cgit v1.2.3