comparison client.c @ 473:2d8af0d7920d

implemented the maximization as I described on the mailinglist, this feels better to me.
author arg@mmvi
date Fri, 22 Sep 2006 07:37:56 +0200
parents 298be2d65d2e
children de69a7b0c8fa
comparison
equal deleted inserted replaced
472:298be2d65d2e 473:2d8af0d7920d
87 if(!issel || (c && !isvisible(c))) 87 if(!issel || (c && !isvisible(c)))
88 return; 88 return;
89 if(!sel) 89 if(!sel)
90 sel = c; 90 sel = c;
91 else if(sel != c) { 91 else if(sel != c) {
92 if(maximized)
93 togglemax(NULL);
94 old = sel; 92 old = sel;
95 sel = c; 93 sel = c;
96 if(old) { 94 if(old) {
97 grabbuttons(old, False); 95 grabbuttons(old, False);
98 drawtitle(old); 96 drawtitle(old);
206 c->x = c->tx = wa->x; 204 c->x = c->tx = wa->x;
207 c->y = c->ty = wa->y; 205 c->y = c->ty = wa->y;
208 c->w = c->tw = wa->width; 206 c->w = c->tw = wa->width;
209 c->h = wa->height; 207 c->h = wa->height;
210 c->th = bh; 208 c->th = bh;
209 c->rx = sx;
210 c->ry = bh;
211 c->rw = sw;
212 c->rh = sh - bh;
211 213
212 c->border = 0; 214 c->border = 0;
213 updatesize(c); 215 updatesize(c);
214 216
215 if(c->x + c->w + 2 > sw) 217 if(c->x + c->w + 2 > sw)
368 XFree(name.value); 370 XFree(name.value);
369 resizetitle(c); 371 resizetitle(c);
370 } 372 }
371 373
372 void 374 void
373 togglemax(Arg *arg) {
374 int ox, oy, ow, oh;
375 Client *c;
376 XEvent ev;
377
378 if(!sel)
379 return;
380
381 if((maximized = !maximized)) {
382 ox = sel->x;
383 oy = sel->y;
384 ow = sel->w;
385 oh = sel->h;
386 sel->x = sx;
387 sel->y = sy + bh;
388 sel->w = sw - 2;
389 sel->h = sh - 2 - bh;
390
391 restack();
392 for(c = getnext(clients); c; c = getnext(c->next))
393 if(c != sel)
394 ban(c);
395 resize(sel, arrange == dofloat, TopLeft);
396
397 sel->x = ox;
398 sel->y = oy;
399 sel->w = ow;
400 sel->h = oh;
401 }
402 else
403 arrange(NULL);
404 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
405 }
406
407 void
408 unmanage(Client *c) { 375 unmanage(Client *c) {
409 Client *nc; 376 Client *nc;
410 377
411 /* The server grab construct avoids race conditions. */ 378 /* The server grab construct avoids race conditions. */
412 XGrabServer(dpy); 379 XGrabServer(dpy);