From 38dfecf837466bc27f9173f09276b3ab6e0ebe6f Mon Sep 17 00:00:00 2001 From: Martin Duquesnoy Date: Tue, 28 Oct 2008 19:16:18 +0100 Subject: [PATCH] all,layout: Add layout right separation and surface structure --- src/bar.c | 7 ------- src/draw.c | 10 ++++++++-- src/structs.h | 20 ++++++++++---------- src/wmfs.c | 6 ------ 4 files changed, 18 insertions(+), 25 deletions(-) diff --git a/src/bar.c b/src/bar.c index 426f48b..0e4d7f1 100644 --- a/src/bar.c +++ b/src/bar.c @@ -141,8 +141,6 @@ updatebar(void) void uicb_togglebarpos(uicb_t cmd) { - int i; - conf.bartop = !conf.bartop; if(conf.bartop) sgeo.y = conf.titlebar.pos ? barheight : barheight + conf.titlebar.height; @@ -155,11 +153,6 @@ uicb_togglebarpos(uicb_t cmd) bary = mh - barheight; bar_moveresize(bar, 0, bary, mw, barheight); updatebar(); - for(i = 0; i < conf.nbutton; ++i) - XUnmapWindow(dpy, conf.barbutton[i].bw->win); - for(i = 0; i < conf.nbutton; ++i) - XMapWindow(dpy, conf.barbutton[i].bw->win); - arrange(); return; diff --git a/src/draw.c b/src/draw.c index 69428c5..be39067 100644 --- a/src/draw.c +++ b/src/draw.c @@ -78,7 +78,7 @@ draw_taglist(Drawable dr) ((i+1 == seltag) ? conf.colors.tagselfg : conf.colors.text), ((i+1 == seltag) ? conf.colors.tagselbg : conf.colors.bar), PAD, buf[i]); - /* Draw the tag border */ + /* Draw the tag separation */ draw_rectangle(dr, taglen[i] + textw(buf[i]) + PAD/2, 0, conf.tagbordwidth, barheight, conf.colors.tagbord); @@ -92,11 +92,17 @@ draw_taglist(Drawable dr) void draw_layout(void) { - draw_text(bar->dr, taglen[conf.ntag] + 1, fonth, + /* Draw layout name / symbol */ + draw_text(bar->dr, taglen[conf.ntag], fonth, conf.colors.layout_fg, conf.colors.layout_bg, 2, tags[seltag].layout.symbol); + /* Draw right separation */ + draw_rectangle(bar->dr, + taglen[conf.ntag] + textw(tags[seltag].layout.symbol) + PAD/2, + 0, conf.tagbordwidth, barheight, conf.colors.tagbord); + return; } diff --git a/src/structs.h b/src/structs.h index 940d16c..7f41c55 100644 --- a/src/structs.h +++ b/src/structs.h @@ -112,17 +112,18 @@ typedef struct uicb_t cmd; } MouseBinding; -/* Bar Button */ +/* Surface \o/ */ typedef struct { - char *content; - BarWindow *bw; - char *fg_color; - int bg_color; - uint x; - int nmousesec; - MouseBinding mouse[NBUTTON]; -} BarButton; + char *text; + Drawable dr; + Window win; + XRectangle geo; + MouseBinding mousebind[10]; + int nmouse; + char *fg; + uint bg; +} Surface; /* Layout Structure */ typedef struct @@ -191,7 +192,6 @@ typedef struct } titlebar; Tag tag[MAXTAG]; Layout layout[MAXLAYOUT]; - BarButton *barbutton; int ntag; int nkeybind; int nbutton; diff --git a/src/wmfs.c b/src/wmfs.c index 675dd53..ad2504e 100644 --- a/src/wmfs.c +++ b/src/wmfs.c @@ -87,18 +87,12 @@ errorhandlerstart(Display *d, XErrorEvent *event) void quit(void) { - int i; - /* Exiting WMFS :'( */ XftFontClose(dpy, xftfont); XFreeCursor(dpy, cursor[CurNormal]); XFreeCursor(dpy, cursor[CurMove]); XFreeCursor(dpy, cursor[CurResize]); bar_delete(bar); - if(conf.nbutton) - for(i = 0; i < conf.nbutton; ++i) - bar_delete(conf.barbutton[i].bw); - efree(conf.barbutton); efree(keys); efree(conf.titlebar.mouse); efree(conf.client.mouse);