aewl

diff aewl.c @ 761:59ce221b9a37

removed global float (dofloat); number of tags is fixed (2)
author meillo@marmaro.de
date Fri, 05 Dec 2008 15:44:43 +0100
parents 014c4cb1ae4a
children 3f0b245732fc
line diff
     1.1 --- a/aewl.c	Fri May 30 22:36:38 2008 +0200
     1.2 +++ b/aewl.c	Fri Dec 05 15:44:43 2008 +0100
     1.3 @@ -27,7 +27,7 @@
     1.4   * file. These arrays are kept static in event.o and tag.o respectively,
     1.5   * because no other part of dwm needs access to them.  The current mode is
     1.6   * represented by the arrange() function pointer, which wether points to
     1.7 - * dofloat() or dotile().
     1.8 + * domax() or dotile().
     1.9   *
    1.10   * To understand everything else, start reading main.c:main().
    1.11   */
    1.12 @@ -117,17 +117,16 @@
    1.13  
    1.14  
    1.15  
    1.16 -const char *tags[];			/* all tags */
    1.17  char stext[256];				/* status text */
    1.18  int bh, bmw;				/* bar height, bar mode label width */
    1.19  int screen, sx, sy, sw, sh;		/* screen geometry */
    1.20  int wax, way, wah, waw;			/* windowarea geometry */
    1.21  unsigned int nmaster;		/* number of master clients */
    1.22 -unsigned int ntags, numlockmask;		/* number of tags, dynamic lock mask */
    1.23 +unsigned int numlockmask;		/* dynamic lock mask */
    1.24  void (*handler[LASTEvent])(XEvent *);	/* event handler */
    1.25  void (*arrange)(void);			/* arrange function, indicates mode  */
    1.26  Atom wmatom[WMLast], netatom[NetLast];
    1.27 -Bool running, selscreen, seltag;	/* seltag is array of Bool */
    1.28 +Bool running, selscreen, seltag;
    1.29  Client *clients, *sel, *stack;		/* global client list and stack */
    1.30  Cursor cursor[CurLast];
    1.31  DC dc;					/* global draw context */
    1.32 @@ -147,7 +146,6 @@
    1.33  static unsigned int len = 0;
    1.34  
    1.35  
    1.36 -TAGS
    1.37  RULES
    1.38  
    1.39  
    1.40 @@ -187,7 +185,6 @@
    1.41  
    1.42  /* view.c */
    1.43  void detach(Client *c);			/* detaches c from global client list */
    1.44 -void dofloat(void);			/* arranges all windows floating */
    1.45  void dotile(void);			/* arranges all windows tiled */
    1.46  void domax(void);            /* arranges all windows fullscreen */
    1.47  Bool isvisible(Client *c);		/* returns True if client is visible */
    1.48 @@ -199,7 +196,7 @@
    1.49  void zoom(void);			/* zooms the focused client to master area */
    1.50  void killclient(void);		/* kill c nicely */
    1.51  void quit(void);			/* quit dwm nicely */
    1.52 -void togglemode(void);		/* toggles global arrange function (dotile/dofloat) */
    1.53 +void togglemode(void);		/* toggles global arrange function (dotile/domax) */
    1.54  void togglefloat(void);		/* toggles focusesd client between floating/non-floating state */
    1.55  void incnmaster(void);		/* increments nmaster */
    1.56  void decnmaster(void);		/* decrements nmaster */
    1.57 @@ -263,24 +260,6 @@
    1.58  }
    1.59  
    1.60  void
    1.61 -dofloat(void) {
    1.62 -	Client *c;
    1.63 -
    1.64 -	for(c = clients; c; c = c->next) {
    1.65 -		if(isvisible(c)) {
    1.66 -			resize(c, True);
    1.67 -		}
    1.68 -		else
    1.69 -			XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
    1.70 -	}
    1.71 -	if(!sel || !isvisible(sel)) {
    1.72 -		for(c = stack; c && !isvisible(c); c = c->snext);
    1.73 -		focus(c);
    1.74 -	}
    1.75 -	restack();
    1.76 -}
    1.77 -
    1.78 -void
    1.79  dotile(void) {
    1.80  	unsigned int i, n, mw, mh, tw, th;
    1.81  	Client *c;
    1.82 @@ -387,7 +366,7 @@
    1.83  
    1.84  void
    1.85  incnmaster() {
    1.86 -	if((arrange == dofloat) || (wah / (nmaster + 1) <= 2 * BORDERPX))
    1.87 +	if(wah / (nmaster + 1) <= 2 * BORDERPX)
    1.88  		return;
    1.89  	nmaster++;
    1.90  	if(sel)
    1.91 @@ -398,7 +377,7 @@
    1.92  
    1.93  void
    1.94  decnmaster() {
    1.95 -	if((arrange == dofloat) || (nmaster <= 1))
    1.96 +	if(nmaster <= 1)
    1.97  		return;
    1.98  	nmaster--;
    1.99  	if(sel)
   1.100 @@ -409,7 +388,7 @@
   1.101  
   1.102  Bool
   1.103  isvisible(Client *c) {
   1.104 -	if((c->tag && seltag) || (!c->tag && !seltag)) {
   1.105 +	if(c->tag == seltag) {
   1.106  		return True;
   1.107  	}
   1.108  	return False;
   1.109 @@ -423,7 +402,7 @@
   1.110  	drawstatus();
   1.111  	if(!sel)
   1.112  		return;
   1.113 -	if(sel->isfloat || arrange == dofloat)
   1.114 +	if(sel->isfloat)
   1.115  		XRaiseWindow(dpy, sel->win);
   1.116  
   1.117    /* begin code by mitch */
   1.118 @@ -450,7 +429,7 @@
   1.119  
   1.120  void
   1.121  togglefloat() {
   1.122 -	if (!sel || arrange == dofloat)
   1.123 +	if (!sel)
   1.124  		return;
   1.125  	sel->isfloat = !sel->isfloat;
   1.126  	arrange();
   1.127 @@ -479,7 +458,7 @@
   1.128  
   1.129  	if(!sel)
   1.130  		return;
   1.131 -	if(sel->isfloat || (arrange == dofloat)) {
   1.132 +	if(sel->isfloat) {
   1.133  		togglemax(sel);
   1.134  		return;
   1.135  	}
   1.136 @@ -765,10 +744,10 @@
   1.137  		focus(c);
   1.138  		if(CLEANMASK(ev->state) != MODKEY)
   1.139  			return;
   1.140 -		if(ev->button == Button1 && (arrange == dofloat || c->isfloat)) {
   1.141 +		if(ev->button == Button1 && c->isfloat) {
   1.142  			restack();
   1.143  			movemouse(c);
   1.144 -		} else if(ev->button == Button3 && (arrange == dofloat || c->isfloat) && !c->isfixed) {
   1.145 +		} else if(ev->button == Button3 && c->isfloat && !c->isfixed) {
   1.146  			restack();
   1.147  			resizemouse(c);
   1.148  		}
   1.149 @@ -1072,14 +1051,14 @@
   1.150  void
   1.151  drawstatus(void) {
   1.152  	int x;
   1.153 -	unsigned int i;
   1.154  
   1.155  	dc.x = dc.y = 0;
   1.156 -	for(i = 0; i < ntags; i++) {
   1.157 -		dc.w = textw(tags[i]);
   1.158 -		drawtext(tags[i], ( ((i == 0 && seltag) || (i == 1 && !seltag)) ? dc.sel : dc.norm));
   1.159 -		dc.x += dc.w + 1;
   1.160 -	}
   1.161 +	dc.w = textw(NAMESEL);
   1.162 +	drawtext(NAMESEL, ( seltag ? dc.sel : dc.norm ));
   1.163 +	dc.x += dc.w + 1;
   1.164 +	dc.w = textw(NAMENSEL);
   1.165 +	drawtext(NAMENSEL, ( seltag ? dc.norm : dc.sel ));
   1.166 +	dc.x += dc.w + 1;
   1.167  	dc.w = bmw;
   1.168  	drawtext("", dc.norm);
   1.169  	x = dc.x + dc.w;
   1.170 @@ -1611,7 +1590,6 @@
   1.171  	XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa);
   1.172  	grabkeys();
   1.173  	initrregs();
   1.174 -	ntags = 2;
   1.175  	seltag = True;
   1.176  	/* style */
   1.177  	dc.norm[ColBorder] = getcolor(NORMBORDERCOLOR);