# HG changeset patch # User meillo@marmaro.de # Date 1228488283 -3600 # Node ID 59ce221b9a374299dd57557a0af245a5a5c8738e # Parent 014c4cb1ae4a829b502726168d059abd4376fe1b removed global float (dofloat); number of tags is fixed (2) diff -r 014c4cb1ae4a -r 59ce221b9a37 aewl.c --- a/aewl.c Fri May 30 22:36:38 2008 +0200 +++ b/aewl.c Fri Dec 05 15:44:43 2008 +0100 @@ -27,7 +27,7 @@ * file. These arrays are kept static in event.o and tag.o respectively, * because no other part of dwm needs access to them. The current mode is * represented by the arrange() function pointer, which wether points to - * dofloat() or dotile(). + * domax() or dotile(). * * To understand everything else, start reading main.c:main(). */ @@ -117,17 +117,16 @@ -const char *tags[]; /* all tags */ char stext[256]; /* status text */ int bh, bmw; /* bar height, bar mode label width */ int screen, sx, sy, sw, sh; /* screen geometry */ int wax, way, wah, waw; /* windowarea geometry */ unsigned int nmaster; /* number of master clients */ -unsigned int ntags, numlockmask; /* number of tags, dynamic lock mask */ +unsigned int numlockmask; /* dynamic lock mask */ void (*handler[LASTEvent])(XEvent *); /* event handler */ void (*arrange)(void); /* arrange function, indicates mode */ Atom wmatom[WMLast], netatom[NetLast]; -Bool running, selscreen, seltag; /* seltag is array of Bool */ +Bool running, selscreen, seltag; Client *clients, *sel, *stack; /* global client list and stack */ Cursor cursor[CurLast]; DC dc; /* global draw context */ @@ -147,7 +146,6 @@ static unsigned int len = 0; -TAGS RULES @@ -187,7 +185,6 @@ /* view.c */ void detach(Client *c); /* detaches c from global client list */ -void dofloat(void); /* arranges all windows floating */ void dotile(void); /* arranges all windows tiled */ void domax(void); /* arranges all windows fullscreen */ Bool isvisible(Client *c); /* returns True if client is visible */ @@ -199,7 +196,7 @@ void zoom(void); /* zooms the focused client to master area */ void killclient(void); /* kill c nicely */ void quit(void); /* quit dwm nicely */ -void togglemode(void); /* toggles global arrange function (dotile/dofloat) */ +void togglemode(void); /* toggles global arrange function (dotile/domax) */ void togglefloat(void); /* toggles focusesd client between floating/non-floating state */ void incnmaster(void); /* increments nmaster */ void decnmaster(void); /* decrements nmaster */ @@ -263,24 +260,6 @@ } void -dofloat(void) { - Client *c; - - for(c = clients; c; c = c->next) { - if(isvisible(c)) { - resize(c, True); - } - else - XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); - } - if(!sel || !isvisible(sel)) { - for(c = stack; c && !isvisible(c); c = c->snext); - focus(c); - } - restack(); -} - -void dotile(void) { unsigned int i, n, mw, mh, tw, th; Client *c; @@ -387,7 +366,7 @@ void incnmaster() { - if((arrange == dofloat) || (wah / (nmaster + 1) <= 2 * BORDERPX)) + if(wah / (nmaster + 1) <= 2 * BORDERPX) return; nmaster++; if(sel) @@ -398,7 +377,7 @@ void decnmaster() { - if((arrange == dofloat) || (nmaster <= 1)) + if(nmaster <= 1) return; nmaster--; if(sel) @@ -409,7 +388,7 @@ Bool isvisible(Client *c) { - if((c->tag && seltag) || (!c->tag && !seltag)) { + if(c->tag == seltag) { return True; } return False; @@ -423,7 +402,7 @@ drawstatus(); if(!sel) return; - if(sel->isfloat || arrange == dofloat) + if(sel->isfloat) XRaiseWindow(dpy, sel->win); /* begin code by mitch */ @@ -450,7 +429,7 @@ void togglefloat() { - if (!sel || arrange == dofloat) + if (!sel) return; sel->isfloat = !sel->isfloat; arrange(); @@ -479,7 +458,7 @@ if(!sel) return; - if(sel->isfloat || (arrange == dofloat)) { + if(sel->isfloat) { togglemax(sel); return; } @@ -765,10 +744,10 @@ focus(c); if(CLEANMASK(ev->state) != MODKEY) return; - if(ev->button == Button1 && (arrange == dofloat || c->isfloat)) { + if(ev->button == Button1 && c->isfloat) { restack(); movemouse(c); - } else if(ev->button == Button3 && (arrange == dofloat || c->isfloat) && !c->isfixed) { + } else if(ev->button == Button3 && c->isfloat && !c->isfixed) { restack(); resizemouse(c); } @@ -1072,14 +1051,14 @@ void drawstatus(void) { int x; - unsigned int i; dc.x = dc.y = 0; - for(i = 0; i < ntags; i++) { - dc.w = textw(tags[i]); - drawtext(tags[i], ( ((i == 0 && seltag) || (i == 1 && !seltag)) ? dc.sel : dc.norm)); - dc.x += dc.w + 1; - } + dc.w = textw(NAMESEL); + drawtext(NAMESEL, ( seltag ? dc.sel : dc.norm )); + dc.x += dc.w + 1; + dc.w = textw(NAMENSEL); + drawtext(NAMENSEL, ( seltag ? dc.norm : dc.sel )); + dc.x += dc.w + 1; dc.w = bmw; drawtext("", dc.norm); x = dc.x + dc.w; @@ -1611,7 +1590,6 @@ XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa); grabkeys(); initrregs(); - ntags = 2; seltag = True; /* style */ dc.norm[ColBorder] = getcolor(NORMBORDERCOLOR);