summaryrefslogtreecommitdiffstats
path: root/client.c
diff options
context:
space:
mode:
authorarg@10ksloc.org <unknown>2006-07-20 15:07:35 +0200
committerarg@10ksloc.org <unknown>2006-07-20 15:07:35 +0200
commit4688ad181da14be36e034918580ec0ce5968ffdb (patch)
treee919b8e6e89400a8b5dac01fa611090f139d5b5f /client.c
parentcleaned up code (diff)
downloaddwm-4688ad181da14be36e034918580ec0ce5968ffdb.tar.gz
dwm-4688ad181da14be36e034918580ec0ce5968ffdb.zip
made status bar drawing more robust, implemented togglemax and togglemode, works quite well
Diffstat (limited to 'client.c')
-rw-r--r--client.c53
1 files changed, 38 insertions, 15 deletions
diff --git a/client.c b/client.c
index 889daa5..1bdebd2 100644
--- a/client.c
+++ b/client.c
@@ -70,6 +70,9 @@ focusnext(Arg *arg)
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) {
@@ -87,6 +90,9 @@ focusprev(Arg *arg)
87 if(!sel) 90 if(!sel)
88 return; 91 return;
89 92
93 if(sel->ismax)
94 togglemax(NULL);
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);
@@ -234,8 +240,6 @@ manage(Window w, XWindowAttributes *wa)
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,
@@ -264,19 +268,6 @@ manage(Window w, XWindowAttributes *wa)
264} 268}
265 269
266void 270void
267maximize(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}
278
279void
280pop(Client *c) 271pop(Client *c)
281{ 272{
282 Client **l; 273 Client **l;
@@ -405,6 +396,38 @@ settitle(Client *c)
405} 396}
406 397
407void 398void
399togglemax(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
430void
408unmanage(Client *c) 431unmanage(Client *c)
409{ 432{
410 Client **l; 433 Client **l;