summaryrefslogtreecommitdiffstats
path: root/dwm.c
diff options
context:
space:
mode:
authorAnselm R Garbe <garbeam@gmail.com>2008-03-17 16:26:06 +0000
committerAnselm R Garbe <garbeam@gmail.com>2008-03-17 16:26:06 +0000
commitfe6b0c0fc17d70e1c0f002e397bd2d3ac152ede0 (patch)
treebc4ee93735e52004e2922a058aee4c310ac32572 /dwm.c
parentremoved the string-based setgeom approach, introduced a new Geom type instead... (diff)
downloaddwm-fe6b0c0fc17d70e1c0f002e397bd2d3ac152ede0.tar.gz
dwm-fe6b0c0fc17d70e1c0f002e397bd2d3ac152ede0.zip
geoms are now drawed in the status bar
Diffstat (limited to '')
-rw-r--r--dwm.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/dwm.c b/dwm.c
index f83e800..6b46911 100644
--- a/dwm.c
+++ b/dwm.c
@@ -210,7 +210,7 @@ void zoom(const char *arg);
210char stext[256], buf[256]; 210char stext[256], buf[256];
211int screen, sx, sy, sw, sh; 211int screen, sx, sy, sw, sh;
212int (*xerrorxlib)(Display *, XErrorEvent *); 212int (*xerrorxlib)(Display *, XErrorEvent *);
213int bx, by, bw, bh, blw, mx, my, mw, mh, mox, moy, mow, moh, tx, ty, tw, th, wx, wy, ww, wh; 213int bx, by, bw, bh, blw, bgw, mx, my, mw, mh, mox, moy, mow, moh, tx, ty, tw, th, wx, wy, ww, wh;
214unsigned int numlockmask = 0; 214unsigned int numlockmask = 0;
215void (*handler[LASTEvent]) (XEvent *) = { 215void (*handler[LASTEvent]) (XEvent *) = {
216 [ButtonPress] = buttonpress, 216 [ButtonPress] = buttonpress,
@@ -322,10 +322,10 @@ buttonpress(XEvent *e) {
322 XButtonPressedEvent *ev = &e->xbutton; 322 XButtonPressedEvent *ev = &e->xbutton;
323 323
324 if(ev->window == barwin) { 324 if(ev->window == barwin) {
325 x = 0; 325 x = bgw;
326 for(i = 0; i < LENGTH(tags); i++) { 326 for(i = 0; i < LENGTH(tags); i++) {
327 x += textw(tags[i]); 327 x += textw(tags[i]);
328 if(ev->x < x) { 328 if(ev->x > bgw && ev->x < x) {
329 if(ev->button == Button1) { 329 if(ev->button == Button1) {
330 if(ev->state & MODKEY) 330 if(ev->state & MODKEY)
331 tag(tags[i]); 331 tag(tags[i]);
@@ -514,6 +514,9 @@ drawbar(void) {
514 Client *c; 514 Client *c;
515 515
516 dc.x = 0; 516 dc.x = 0;
517 dc.w = bgw;
518 drawtext(geom->symbol, dc.norm, False);
519 dc.x += bgw;
517 for(c = stack; c && !isvisible(c); c = c->snext); 520 for(c = stack; c && !isvisible(c); c = c->snext);
518 for(i = 0; i < LENGTH(tags); i++) { 521 for(i = 0; i < LENGTH(tags); i++) {
519 dc.w = textw(tags[i]); 522 dc.w = textw(tags[i]);
@@ -854,7 +857,7 @@ unsigned int
854idxoftag(const char *t) { 857idxoftag(const char *t) {
855 unsigned int i; 858 unsigned int i;
856 859
857 for(i = 0; (i < LENGTH(tags)) && (tags[i] != t); i++); 860 for(i = 0; (i < LENGTH(tags)) && strcmp(tags[i], t); i++);
858 return (i < LENGTH(tags)) ? i : 0; 861 return (i < LENGTH(tags)) ? i : 0;
859} 862}
860 863
@@ -1501,6 +1504,11 @@ setup(void) {
1501 if(i > blw) 1504 if(i > blw)
1502 blw = i; 1505 blw = i;
1503 } 1506 }
1507 for(bgw = i = 0; i < LENGTH(geoms); i++) {
1508 i = textw(geoms[i].symbol);
1509 if(i > bgw)
1510 bgw = i;
1511 }
1504 1512
1505 wa.override_redirect = 1; 1513 wa.override_redirect = 1;
1506 wa.background_pixmap = ParentRelative; 1514 wa.background_pixmap = ParentRelative;