client: fix title update

Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
Julien Danjou 2008-07-08 18:04:08 +02:00
parent 6f1a4609c3
commit 00e9af11b8
3 changed files with 9 additions and 8 deletions

View File

@ -147,21 +147,23 @@ client_getbywin(xcb_window_t w)
/** Update client name attribute with its new title.
* \param c The client.
* \param atom The atom to use to get the name.
* \param Return true if it has been updated.
*/
bool
client_updatetitle(client_t *c, xcb_atom_t atom)
client_updatetitle(client_t *c)
{
char *name;
ssize_t len;
if(!xutil_gettextprop(globalconf.connection, c->win, atom, &name, &len))
if(!xutil_gettextprop(globalconf.connection, c->win, _NET_WM_NAME, &name, &len))
if(!xutil_gettextprop(globalconf.connection, c->win, WM_NAME, &name, &len))
return false;
p_delete(&c->name);
a_iso2utf8(&c->name, name, len);
c->name = name;
/* call hook */
luaA_client_userdata_new(globalconf.L, c);
luaA_dofunction(globalconf.L, globalconf.hooks.titleupdate, 1);
@ -424,8 +426,7 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int screen)
client_raise(c);
/* update window title */
if(!client_updatetitle(c, _NET_WM_NAME))
client_updatetitle(c, WM_NAME);
client_updatetitle(c);
ewmh_update_net_client_list(c->phys_screen);
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);

View File

@ -39,7 +39,7 @@ bool client_resize(client_t *, area_t, bool);
void client_unmanage(client_t *);
void client_updatewmhints(client_t *);
xcb_size_hints_t *client_updatesizehints(client_t *);
bool client_updatetitle(client_t *, xcb_atom_t);
bool client_updatetitle(client_t *);
void client_saveprops(client_t *);
void client_kill(client_t *);
void client_setfloating(client_t *, bool);

View File

@ -531,7 +531,7 @@ event_handle_propertynotify(void *data __attribute__ ((unused)),
else if (ev->atom == WM_HINTS)
client_updatewmhints(c);
else if(ev->atom == WM_NAME || ev->atom == _NET_WM_NAME)
client_updatetitle(c, ev->atom);
client_updatetitle(c);
}
return 0;