From 3fbfbc08c3a3327593ab25d890598dad8e9597ec Mon Sep 17 00:00:00 2001 From: Martin Duquesnoy Date: Sun, 26 Oct 2008 17:03:36 +0100 Subject: [PATCH] client: Add client_get_title and improve client_raise --- src/client.c | 15 ++++++++++++++- src/event.c | 2 +- src/titlebar.c | 4 +--- src/wmfs.h | 1 + 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/client.c b/src/client.c index 0b895bc..4ad4c51 100644 --- a/src/client.c +++ b/src/client.c @@ -164,6 +164,16 @@ client_get(Window w) return c; } +void +client_get_title(Client *c) +{ + XFetchName(dpy, c->win, &(c->title)); + if(!c->title) + c->title = strdup("WMFS"); + + return; +} + void client_hide(Client *c) { @@ -258,6 +268,8 @@ client_manage(Window w, XWindowAttributes *wa) else client_raise(c); + efree(t); + client_attach(c); XMoveResizeWindow(dpy, c->win, c->geo.x, c->geo.y, c->geo.width, c->geo.height); client_map(c); @@ -415,8 +427,9 @@ client_size_hints(Client *c) void client_raise(Client *c) { - if(!c) + if(!c || !c->free) return; + XRaiseWindow(dpy, c->win); if(conf.titlebar.exist) diff --git a/src/event.c b/src/event.c index 71f296d..c357462 100644 --- a/src/event.c +++ b/src/event.c @@ -385,7 +385,7 @@ propertynotify(XEvent ev) } if(ev.xproperty.atom == XA_WM_NAME || ev.xproperty.atom == net_atom[NetWMName]) - titlebar_update(c); + client_get_title(c); } return; diff --git a/src/titlebar.c b/src/titlebar.c index 10f6c37..9ae5d8b 100644 --- a/src/titlebar.c +++ b/src/titlebar.c @@ -96,9 +96,7 @@ titlebar_update(Client *c) { int pos_y, pos_x; - XFetchName(dpy, c->win, &(c->title)); - if(!c->title) - c->title = strdup("WMFS"); + client_get_title(c); if(!conf.titlebar.exist) return; diff --git a/src/wmfs.h b/src/wmfs.h index 67b0fb8..954daf0 100644 --- a/src/wmfs.h +++ b/src/wmfs.h @@ -84,6 +84,7 @@ void client_attach(Client *c); void client_detach(Client *c); void client_focus(Client *c); Client *client_get(Window w); +void client_get_title(Client *c); void client_hide(Client *c); Bool ishide(Client *c); void client_map(Client *c);