aewl

diff client.c @ 124:75576e44c1d8

made status bar drawing more robust, implemented togglemax and togglemode, works quite well
author arg@10ksloc.org
date Thu, 20 Jul 2006 15:07:35 +0200
parents 61490330e90a
children 1480e19f6377
line diff
     1.1 --- a/client.c	Thu Jul 20 12:18:06 2006 +0200
     1.2 +++ b/client.c	Thu Jul 20 15:07:35 2006 +0200
     1.3 @@ -70,6 +70,9 @@
     1.4  	if(!sel)
     1.5  		return;
     1.6  
     1.7 +	if(sel->ismax)
     1.8 +		togglemax(NULL);
     1.9 +
    1.10  	if(!(c = getnext(sel->next, tsel)))
    1.11  		c = getnext(clients, tsel);
    1.12  	if(c) {
    1.13 @@ -87,6 +90,9 @@
    1.14  	if(!sel)
    1.15  		return;
    1.16  
    1.17 +	if(sel->ismax)
    1.18 +		togglemax(NULL);
    1.19 +
    1.20  	if((c = sel->revert && sel->revert->tags[tsel] ? sel->revert : NULL)) {
    1.21  		higher(c);
    1.22  		focus(c);
    1.23 @@ -234,8 +240,6 @@
    1.24  	c->next = clients;
    1.25  	clients = c;
    1.26  
    1.27 -	XGrabButton(dpy, Button1, ControlMask, c->win, False, ButtonPressMask,
    1.28 -			GrabModeAsync, GrabModeSync, None, None);
    1.29  	XGrabButton(dpy, Button1, MODKEY, c->win, False, ButtonPressMask,
    1.30  			GrabModeAsync, GrabModeSync, None, None);
    1.31  	XGrabButton(dpy, Button2, MODKEY, c->win, False, ButtonPressMask,
    1.32 @@ -264,19 +268,6 @@
    1.33  }
    1.34  
    1.35  void
    1.36 -maximize(Arg *arg)
    1.37 -{
    1.38 -	if(!sel)
    1.39 -		return;
    1.40 -	sel->x = sx;
    1.41 -	sel->y = sy + bh;
    1.42 -	sel->w = sw - 2 * sel->border;
    1.43 -	sel->h = sh - 2 * sel->border - bh;
    1.44 -	higher(sel);
    1.45 -	resize(sel, False, TopLeft);
    1.46 -}
    1.47 -
    1.48 -void
    1.49  pop(Client *c)
    1.50  {
    1.51  	Client **l;
    1.52 @@ -405,6 +396,38 @@
    1.53  }
    1.54  
    1.55  void
    1.56 +togglemax(Arg *arg)
    1.57 +{
    1.58 +	int ox, oy, ow, oh;
    1.59 +	XEvent ev;
    1.60 +
    1.61 +	if(!sel)
    1.62 +		return;
    1.63 +
    1.64 +	if((sel->ismax = !sel->ismax)) {
    1.65 +		ox = sel->x;
    1.66 +		oy = sel->y;
    1.67 +		ow = sel->w;
    1.68 +		oh = sel->h;
    1.69 +		sel->x = sx;
    1.70 +		sel->y = sy + bh;
    1.71 +		sel->w = sw - 2 * sel->border;
    1.72 +		sel->h = sh - 2 * sel->border - bh;
    1.73 +
    1.74 +		higher(sel);
    1.75 +		resize(sel, False, TopLeft);
    1.76 +
    1.77 +		sel->x = ox;
    1.78 +		sel->y = oy;
    1.79 +		sel->w = ow;
    1.80 +		sel->h = oh;
    1.81 +	}
    1.82 +	else
    1.83 +		resize(sel, False, TopLeft);
    1.84 +	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
    1.85 +}
    1.86 +
    1.87 +void
    1.88  unmanage(Client *c)
    1.89  {
    1.90  	Client **l;