diff --git a/src/client.c b/src/client.c index f83a04b..960997d 100644 --- a/src/client.c +++ b/src/client.c @@ -125,21 +125,16 @@ client_focus(Client *c) { grabbuttons(sel, False); XSetWindowBorder(dpy, sel->win, conf.client.bordernormal); - if(conf.titlebar.exist) - XSetWindowBorder(dpy, sel->tbar->win, conf.client.bordernormal); } if(c) grabbuttons(c, True); - sel = c; - selbytag[seltag] = sel; + selbytag[seltag] = sel = c; if(c) { XSetWindowBorder(dpy, c->win, conf.client.borderfocus); - if(conf.titlebar.exist) - XSetWindowBorder(dpy, sel->tbar->win, conf.client.borderfocus); if(conf.raisefocus) client_raise(c); XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime); @@ -219,13 +214,14 @@ client_map(Client *c) if(!c) return; - XMapWindow(dpy, c->win); if(conf.titlebar.exist) { XMapWindow(dpy, c->tbar->win); bar_refresh(c->tbar); } + XMapWindow(dpy, c->win); + return; } @@ -265,14 +261,12 @@ client_manage(Window w, XWindowAttributes *wa) c->tag = t->tag; if(!c->free) c->free = (rettrans == Success) || c->hint; - 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); + client_raise(c); setwinstate(c->win, NormalState); client_focus(c); arrange(); @@ -430,13 +424,12 @@ client_raise(Client *c) if(!c || c->tile || c->max) return; - XRaiseWindow(dpy, c->win); - if(conf.titlebar.exist) { XRaiseWindow(dpy, c->tbar->win); titlebar_update(c); } + XRaiseWindow(dpy, c->win); return; } @@ -463,19 +456,23 @@ client_unhide(Client *c) void client_unmanage(Client *c) { + int i; + Client *cc; + XGrabServer(dpy); XSetErrorHandler(errorhandlerdummy); if(sel == c) client_focus(NULL); + for(i = 0, cc = clients; cc; cc = cc->next, ++i) + if(selbytag[i] == c) + selbytag[i] = NULL; client_detach(c); XUngrabButton(dpy, AnyButton, AnyModifier, c->win); setwinstate(c->win, WithdrawnState); - XSync(dpy, False); XUngrabServer(dpy); - if(conf.titlebar.exist) - bar_delete(c->tbar); + titlebar_delete(c); efree(c); XSetErrorHandler(errorhandler); arrange(); diff --git a/src/draw.c b/src/draw.c index 85ab9c8..69428c5 100644 --- a/src/draw.c +++ b/src/draw.c @@ -92,10 +92,10 @@ draw_taglist(Drawable dr) void draw_layout(void) { - draw_text(bar->dr, taglen[conf.ntag] + BPAD/2, fonth, + draw_text(bar->dr, taglen[conf.ntag] + 1, fonth, conf.colors.layout_fg, conf.colors.layout_bg, - BPAD, tags[seltag].layout.symbol); + 2, tags[seltag].layout.symbol); return; } diff --git a/src/event.c b/src/event.c index eb90284..ceb8b2f 100644 --- a/src/event.c +++ b/src/event.c @@ -396,10 +396,7 @@ unmapnotify(XEvent ev) Client *c; if((c = client_get(ev.xunmap.window))) - if(ev.xunmap.send_event - && ev.xunmap.event == RootWindow(ev.xany.display, screen) - && getwinstate(c->win) == NormalState) - client_unmanage(c); + client_unmanage(c); return; } diff --git a/src/layout.c b/src/layout.c index 516d500..436d7ac 100644 --- a/src/layout.c +++ b/src/layout.c @@ -45,9 +45,10 @@ arrange(void) tags[seltag].layout.func(); - if(selbytag[seltag] && selbytag[seltag]->win) + if(selbytag[seltag] != NULL + && selbytag[seltag]->tbar != NULL) client_focus(selbytag[seltag]); - else + else client_focus(NULL); updatebar(); @@ -71,8 +72,8 @@ freelayout(void) geo.y = c->ogeo.y; geo.width = c->ogeo.width; geo.height = c->ogeo.height; - client_moveresize(c, geo, True); c->tile = c->lmax = False; + client_moveresize(c, geo, True); } } } diff --git a/src/structs.h b/src/structs.h index 6c10b84..940d16c 100644 --- a/src/structs.h +++ b/src/structs.h @@ -89,7 +89,7 @@ struct Client int border; /* Client Layout Information */ Bool max, tile, free; - Bool hint, lmax; + Bool hint, lmax, havetbar; /* Struct in chains */ Client *next; Client *prev; diff --git a/src/titlebar.c b/src/titlebar.c index 9ae5d8b..d24ce4d 100644 --- a/src/titlebar.c +++ b/src/titlebar.c @@ -38,18 +38,31 @@ titlebar_create(Client *c) int y; /* Set titlebar position : Top/Bottom */ - if(conf.titlebar.pos) + switch(conf.titlebar.pos) + { + case Bottom: y = c->geo.y + c->geo.height + conf.client.borderheight; - else + break; + default: + case Top: y = c->geo.y - (conf.titlebar.height + conf.client.borderheight); + break; + } - c->tbar = bar_create(c->geo.x, - y, - c->geo.width, + c->tbar = bar_create(c->geo.x, y, c->geo.width, conf.titlebar.height - conf.client.borderheight, conf.client.borderheight, conf.titlebar.bg, True); - XSetWindowBorder(dpy, c->tbar->win, conf.client.bordernormal); + XSetWindowBorder(dpy, c->tbar->win, conf.titlebar.bg); + + return; +} + +void +titlebar_delete(Client *c) +{ + bar_delete(c->tbar); + c->tbar = NULL; return; } diff --git a/src/wmfs.c b/src/wmfs.c index 8e72b0d..675dd53 100644 --- a/src/wmfs.c +++ b/src/wmfs.c @@ -102,6 +102,7 @@ quit(void) efree(keys); efree(conf.titlebar.mouse); efree(conf.client.mouse); + efree(conf.root.mouse); XSync(dpy, False); return; diff --git a/src/wmfs.h b/src/wmfs.h index 954daf0..603f346 100644 --- a/src/wmfs.h +++ b/src/wmfs.h @@ -60,7 +60,6 @@ #define ITOA(p ,n) sprintf(p, "%i", n) #define debug(p) fprintf(stderr, "debug: %i\n", p) #define PAD 8 -#define BPAD 2 /* bar.c */ BarWindow *bar_create(int x, int y, uint w, uint h, int bord, uint color, Bool entermask); @@ -138,6 +137,7 @@ void uicb_tagtransfert(uicb_t); /* titlebar.c */ void titlebar_create(Client *c); +void titlebar_delete(Client *c); Client* titlebar_get(Window w); void titlebar_update_position(Client *c); void titlebar_update(Client *c);