Mercurial > aewl
comparison 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 |
comparison
equal
deleted
inserted
replaced
123:61490330e90a | 124:75576e44c1d8 |
---|---|
68 Client *c; | 68 Client *c; |
69 | 69 |
70 if(!sel) | 70 if(!sel) |
71 return; | 71 return; |
72 | 72 |
73 if(sel->ismax) | |
74 togglemax(NULL); | |
75 | |
73 if(!(c = getnext(sel->next, tsel))) | 76 if(!(c = getnext(sel->next, tsel))) |
74 c = getnext(clients, tsel); | 77 c = getnext(clients, tsel); |
75 if(c) { | 78 if(c) { |
76 higher(c); | 79 higher(c); |
77 c->revert = sel; | 80 c->revert = sel; |
84 { | 87 { |
85 Client *c; | 88 Client *c; |
86 | 89 |
87 if(!sel) | 90 if(!sel) |
88 return; | 91 return; |
92 | |
93 if(sel->ismax) | |
94 togglemax(NULL); | |
89 | 95 |
90 if((c = sel->revert && sel->revert->tags[tsel] ? sel->revert : NULL)) { | 96 if((c = sel->revert && sel->revert->tags[tsel] ? sel->revert : NULL)) { |
91 higher(c); | 97 higher(c); |
92 focus(c); | 98 focus(c); |
93 } | 99 } |
232 settags(c); | 238 settags(c); |
233 | 239 |
234 c->next = clients; | 240 c->next = clients; |
235 clients = c; | 241 clients = c; |
236 | 242 |
237 XGrabButton(dpy, Button1, ControlMask, c->win, False, ButtonPressMask, | |
238 GrabModeAsync, GrabModeSync, None, None); | |
239 XGrabButton(dpy, Button1, MODKEY, c->win, False, ButtonPressMask, | 243 XGrabButton(dpy, Button1, MODKEY, c->win, False, ButtonPressMask, |
240 GrabModeAsync, GrabModeSync, None, None); | 244 GrabModeAsync, GrabModeSync, None, None); |
241 XGrabButton(dpy, Button2, MODKEY, c->win, False, ButtonPressMask, | 245 XGrabButton(dpy, Button2, MODKEY, c->win, False, ButtonPressMask, |
242 GrabModeAsync, GrabModeSync, None, None); | 246 GrabModeAsync, GrabModeSync, None, None); |
243 XGrabButton(dpy, Button3, MODKEY, c->win, False, ButtonPressMask, | 247 XGrabButton(dpy, Button3, MODKEY, c->win, False, ButtonPressMask, |
259 } | 263 } |
260 else { | 264 else { |
261 XMapRaised(dpy, c->win); | 265 XMapRaised(dpy, c->win); |
262 XMapRaised(dpy, c->title); | 266 XMapRaised(dpy, c->title); |
263 } | 267 } |
264 } | |
265 | |
266 void | |
267 maximize(Arg *arg) | |
268 { | |
269 if(!sel) | |
270 return; | |
271 sel->x = sx; | |
272 sel->y = sy + bh; | |
273 sel->w = sw - 2 * sel->border; | |
274 sel->h = sh - 2 * sel->border - bh; | |
275 higher(sel); | |
276 resize(sel, False, TopLeft); | |
277 } | 268 } |
278 | 269 |
279 void | 270 void |
280 pop(Client *c) | 271 pop(Client *c) |
281 { | 272 { |
403 XFree(name.value); | 394 XFree(name.value); |
404 resizetitle(c); | 395 resizetitle(c); |
405 } | 396 } |
406 | 397 |
407 void | 398 void |
399 togglemax(Arg *arg) | |
400 { | |
401 int ox, oy, ow, oh; | |
402 XEvent ev; | |
403 | |
404 if(!sel) | |
405 return; | |
406 | |
407 if((sel->ismax = !sel->ismax)) { | |
408 ox = sel->x; | |
409 oy = sel->y; | |
410 ow = sel->w; | |
411 oh = sel->h; | |
412 sel->x = sx; | |
413 sel->y = sy + bh; | |
414 sel->w = sw - 2 * sel->border; | |
415 sel->h = sh - 2 * sel->border - bh; | |
416 | |
417 higher(sel); | |
418 resize(sel, False, TopLeft); | |
419 | |
420 sel->x = ox; | |
421 sel->y = oy; | |
422 sel->w = ow; | |
423 sel->h = oh; | |
424 } | |
425 else | |
426 resize(sel, False, TopLeft); | |
427 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); | |
428 } | |
429 | |
430 void | |
408 unmanage(Client *c) | 431 unmanage(Client *c) |
409 { | 432 { |
410 Client **l; | 433 Client **l; |
411 | 434 |
412 XGrabServer(dpy); | 435 XGrabServer(dpy); |