client: use atom name to update title
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
63b0457fc4
commit
1d64f8231c
16
client.c
16
client.c
|
@ -147,16 +147,17 @@ 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.
|
||||
*/
|
||||
void
|
||||
client_updatetitle(client_t *c)
|
||||
bool
|
||||
client_updatetitle(client_t *c, xcb_atom_t atom)
|
||||
{
|
||||
char *name;
|
||||
ssize_t 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;
|
||||
if(!xutil_gettextprop(globalconf.connection, c->win, atom, &name, &len))
|
||||
return false;
|
||||
|
||||
p_delete(&c->name);
|
||||
a_iso2utf8(&c->name, name, len);
|
||||
|
@ -166,6 +167,8 @@ client_updatetitle(client_t *c)
|
|||
luaA_dofunction(globalconf.L, globalconf.hooks.titleupdate, 1);
|
||||
|
||||
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/** Unfocus a client.
|
||||
|
@ -421,7 +424,8 @@ client_manage(xcb_window_t w, xcb_get_geometry_reply_t *wgeom, int screen)
|
|||
client_raise(c);
|
||||
|
||||
/* update window title */
|
||||
client_updatetitle(c);
|
||||
if(!client_updatetitle(c, _NET_WM_NAME))
|
||||
client_updatetitle(c, WM_NAME);
|
||||
|
||||
ewmh_update_net_client_list(c->phys_screen);
|
||||
widget_invalidate_cache(c->screen, WIDGET_CACHE_CLIENTS);
|
||||
|
|
2
client.h
2
client.h
|
@ -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 *);
|
||||
void client_updatetitle(client_t *);
|
||||
bool client_updatetitle(client_t *, xcb_atom_t);
|
||||
void client_saveprops(client_t *);
|
||||
void client_kill(client_t *);
|
||||
void client_setfloating(client_t *, bool);
|
||||
|
|
5
event.c
5
event.c
|
@ -530,9 +530,8 @@ event_handle_propertynotify(void *data __attribute__ ((unused)),
|
|||
client_updatesizehints(c);
|
||||
else if (ev->atom == WM_HINTS)
|
||||
client_updatewmhints(c);
|
||||
|
||||
if(ev->atom == WM_NAME || ev->atom == _NET_WM_NAME)
|
||||
client_updatetitle(c);
|
||||
else if(ev->atom == WM_NAME || ev->atom == _NET_WM_NAME)
|
||||
client_updatetitle(c, ev->atom);
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue