Mercurial > aewl
comparison dwm.c @ 756:bff1012527b3
removed unnecessary Arg* parametersadded decnmaster
author | meillo@marmaro.de |
---|---|
date | Fri, 30 May 2008 00:30:57 +0200 |
parents | cdd895c163bd |
children | bc512840e5a5 |
comparison
equal
deleted
inserted
replaced
755:cdd895c163bd | 756:bff1012527b3 |
---|---|
158 /* client.c */ | 158 /* client.c */ |
159 void configure(Client *c); /* send synthetic configure event */ | 159 void configure(Client *c); /* send synthetic configure event */ |
160 void focus(Client *c); /* focus c, c may be NULL */ | 160 void focus(Client *c); /* focus c, c may be NULL */ |
161 Client *getclient(Window w); /* return client of w */ | 161 Client *getclient(Window w); /* return client of w */ |
162 Bool isprotodel(Client *c); /* returns True if c->win supports wmatom[WMDelete] */ | 162 Bool isprotodel(Client *c); /* returns True if c->win supports wmatom[WMDelete] */ |
163 void killclient(Arg *arg); /* kill c nicely */ | 163 void killclient(); /* kill c nicely */ |
164 void manage(Window w, XWindowAttributes *wa); /* manage new client */ | 164 void manage(Window w, XWindowAttributes *wa); /* manage new client */ |
165 void resize(Client *c, Bool sizehints); /* resize c*/ | 165 void resize(Client *c, Bool sizehints); /* resize c*/ |
166 void updatesizehints(Client *c); /* update the size hint variables of c */ | 166 void updatesizehints(Client *c); /* update the size hint variables of c */ |
167 void updatetitle(Client *c); /* update the name of c */ | 167 void updatetitle(Client *c); /* update the name of c */ |
168 void unmanage(Client *c); /* destroy c */ | 168 void unmanage(Client *c); /* destroy c */ |
176 /* event.c */ | 176 /* event.c */ |
177 void grabkeys(void); /* grab all keys defined in config.h */ | 177 void grabkeys(void); /* grab all keys defined in config.h */ |
178 void procevent(void); /* process pending X events */ | 178 void procevent(void); /* process pending X events */ |
179 | 179 |
180 /* main.c */ | 180 /* main.c */ |
181 void quit(Arg *arg); /* quit dwm nicely */ | 181 void quit(); /* quit dwm nicely */ |
182 void sendevent(Window w, Atom a, long value); /* send synthetic event to w */ | 182 void sendevent(Window w, Atom a, long value); /* send synthetic event to w */ |
183 int xerror(Display *dsply, XErrorEvent *ee); /* dwm's X error handler */ | 183 int xerror(Display *dsply, XErrorEvent *ee); /* dwm's X error handler */ |
184 | 184 |
185 /* tag.c */ | 185 /* tag.c */ |
186 void initrregs(void); /* initialize regexps of rules defined in config.h */ | 186 void initrregs(void); /* initialize regexps of rules defined in config.h */ |
187 Client *getnext(Client *c); /* returns next visible client */ | 187 Client *getnext(Client *c); /* returns next visible client */ |
188 void settags(Client *c, Client *trans); /* sets tags of c */ | 188 void settags(Client *c, Client *trans); /* sets tags of c */ |
189 void toggletag(Arg *arg); /* toggles c tags with arg's index */ | 189 void toggletag(); /* toggles c tags with arg's index */ |
190 | 190 |
191 /* util.c */ | 191 /* util.c */ |
192 void *emallocz(unsigned int size); /* allocates zero-initialized memory, exits on error */ | 192 void *emallocz(unsigned int size); /* allocates zero-initialized memory, exits on error */ |
193 void eprint(const char *errstr, ...); /* prints errstr and exits with 1 */ | 193 void eprint(const char *errstr, ...); /* prints errstr and exits with 1 */ |
194 void spawn(Arg *arg); /* forks a new subprocess with to arg's cmd */ | 194 void spawn(Arg *arg); /* forks a new subprocess with to arg's cmd */ |
196 /* view.c */ | 196 /* view.c */ |
197 void detach(Client *c); /* detaches c from global client list */ | 197 void detach(Client *c); /* detaches c from global client list */ |
198 void dofloat(void); /* arranges all windows floating */ | 198 void dofloat(void); /* arranges all windows floating */ |
199 void dotile(void); /* arranges all windows tiled */ | 199 void dotile(void); /* arranges all windows tiled */ |
200 void domax(void); /* arranges all windows fullscreen */ | 200 void domax(void); /* arranges all windows fullscreen */ |
201 void focusnext(Arg *arg); /* focuses next visible client, arg is ignored */ | 201 void focusnext(); /* focuses next visible client, arg is ignored */ |
202 void incnmaster(Arg *arg); /* increments nmaster with arg's index value */ | 202 void incnmaster(); /* increments nmaster */ |
203 void decnmaster(); /* decrements nmaster */ | |
203 Bool isvisible(Client *c); /* returns True if client is visible */ | 204 Bool isvisible(Client *c); /* returns True if client is visible */ |
204 void restack(void); /* restores z layers of all clients */ | 205 void restack(void); /* restores z layers of all clients */ |
205 void togglefloat(Arg *arg); /* toggles focusesd client between floating/non-floating state */ | 206 void togglefloat(); /* toggles focusesd client between floating/non-floating state */ |
206 void togglemode(Arg *arg); /* toggles global arrange function (dotile/dofloat) */ | 207 void togglemode(); /* toggles global arrange function (dotile/dofloat) */ |
207 void toggleview(); /* views the tag with arg's index */ | 208 void toggleview(); /* views the tag with arg's index */ |
208 void zoom(Arg *arg); /* zooms the focused client to master area, arg is ignored */ | 209 void zoom(); /* zooms the focused client to master area, arg is ignored */ |
209 | 210 |
210 | 211 |
211 | 212 |
212 | 213 |
213 | 214 |
371 restack(); | 372 restack(); |
372 } | 373 } |
373 /* end code by mitch */ | 374 /* end code by mitch */ |
374 | 375 |
375 void | 376 void |
376 focusnext(Arg *arg) { | 377 focusnext() { |
377 Client *c; | 378 Client *c; |
378 | 379 |
379 if(!sel) | 380 if(!sel) |
380 return; | 381 return; |
381 if(!(c = getnext(sel->next))) | 382 if(!(c = getnext(sel->next))) |
385 restack(); | 386 restack(); |
386 } | 387 } |
387 } | 388 } |
388 | 389 |
389 void | 390 void |
390 incnmaster(Arg *arg) { | 391 incnmaster() { |
391 if((arrange == dofloat) || (nmaster + arg->i < 1) | 392 if((arrange == dofloat) || (wah / (nmaster + 1) <= 2 * BORDERPX)) |
392 || (wah / (nmaster + arg->i) <= 2 * BORDERPX)) | 393 return; |
393 return; | 394 nmaster++; |
394 nmaster += arg->i; | 395 if(sel) |
396 arrange(); | |
397 else | |
398 drawstatus(); | |
399 } | |
400 | |
401 void | |
402 decnmaster() { | |
403 if((arrange == dofloat) || (nmaster <= 1)) | |
404 return; | |
405 nmaster--; | |
395 if(sel) | 406 if(sel) |
396 arrange(); | 407 arrange(); |
397 else | 408 else |
398 drawstatus(); | 409 drawstatus(); |
399 } | 410 } |
438 XSync(dpy, False); | 449 XSync(dpy, False); |
439 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); | 450 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); |
440 } | 451 } |
441 | 452 |
442 void | 453 void |
443 togglefloat(Arg *arg) { | 454 togglefloat() { |
444 if (!sel || arrange == dofloat) | 455 if (!sel || arrange == dofloat) |
445 return; | 456 return; |
446 sel->isfloat = !sel->isfloat; | 457 sel->isfloat = !sel->isfloat; |
447 arrange(); | 458 arrange(); |
448 } | 459 } |
449 | 460 |
450 void | 461 void |
451 togglemode(Arg *arg) { | 462 togglemode() { |
452 /* only toggle between tile and max - float is just available through togglefloat */ | 463 /* only toggle between tile and max - float is just available through togglefloat */ |
453 arrange = (arrange == dotile) ? domax : dotile; | 464 arrange = (arrange == dotile) ? domax : dotile; |
454 if(sel) | 465 if(sel) |
455 arrange(); | 466 arrange(); |
456 else | 467 else |
462 seltag = !seltag; | 473 seltag = !seltag; |
463 arrange(); | 474 arrange(); |
464 } | 475 } |
465 | 476 |
466 void | 477 void |
467 zoom(Arg *arg) { | 478 zoom() { |
468 unsigned int n; | 479 unsigned int n; |
469 Client *c; | 480 Client *c; |
470 | 481 |
471 if(!sel) | 482 if(!sel) |
472 return; | 483 return; |
593 } | 604 } |
594 | 605 |
595 void | 606 void |
596 settags(Client *c, Client *trans) { | 607 settags(Client *c, Client *trans) { |
597 char prop[512]; | 608 char prop[512]; |
598 unsigned int i, j; | 609 unsigned int i; |
599 regmatch_t tmp; | 610 regmatch_t tmp; |
600 Bool matched = trans != NULL; | 611 Bool matched = trans != NULL; |
601 XClassHint ch = { 0 }; | 612 XClassHint ch = { 0 }; |
602 | 613 |
603 if(matched) { | 614 if(matched) { |
629 c->tag = seltag; | 640 c->tag = seltag; |
630 } | 641 } |
631 } | 642 } |
632 | 643 |
633 void | 644 void |
634 toggletag(Arg *arg) { | 645 toggletag() { |
635 if(!sel) | 646 if(!sel) |
636 return; | 647 return; |
637 sel->tag = !sel->tag; | 648 sel->tag = !sel->tag; |
638 toggleview(); | 649 toggleview(); |
639 } | 650 } |
875 KeySym keysym; | 886 KeySym keysym; |
876 XKeyEvent *ev = &e->xkey; | 887 XKeyEvent *ev = &e->xkey; |
877 | 888 |
878 keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); | 889 keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); |
879 for(i = 0; i < len; i++) { | 890 for(i = 0; i < len; i++) { |
880 if(keysym == key[i].keysym | 891 if(keysym == key[i].keysym && CLEANMASK(key[i].mod) == CLEANMASK(ev->state)) { |
881 && CLEANMASK(key[i].mod) == CLEANMASK(ev->state)) | |
882 { | |
883 if(key[i].func) | 892 if(key[i].func) |
884 key[i].func(&key[i].arg); | 893 key[i].func(&key[i].arg); |
885 } | 894 } |
886 } | 895 } |
887 } | 896 } |
1080 | 1089 |
1081 | 1090 |
1082 | 1091 |
1083 void | 1092 void |
1084 drawstatus(void) { | 1093 drawstatus(void) { |
1085 int i, x; | 1094 int x; |
1095 unsigned int i; | |
1086 | 1096 |
1087 dc.x = dc.y = 0; | 1097 dc.x = dc.y = 0; |
1088 for(i = 0; i < ntags; i++) { | 1098 for(i = 0; i < ntags; i++) { |
1089 dc.w = textw(tags[i]); | 1099 dc.w = textw(tags[i]); |
1090 drawtext(tags[i], ( (i == 0 && seltag || i == 1 && !seltag) ? dc.sel : dc.norm)); | 1100 drawtext(tags[i], ( ((i == 0 && seltag) || (i == 1 && !seltag)) ? dc.sel : dc.norm)); |
1091 dc.x += dc.w + 1; | 1101 dc.x += dc.w + 1; |
1092 } | 1102 } |
1093 dc.w = bmw; | 1103 dc.w = bmw; |
1094 drawtext("", dc.norm); | 1104 drawtext("", dc.norm); |
1095 x = dc.x + dc.w; | 1105 x = dc.x + dc.w; |
1303 } | 1313 } |
1304 return ret; | 1314 return ret; |
1305 } | 1315 } |
1306 | 1316 |
1307 void | 1317 void |
1308 killclient(Arg *arg) { | 1318 killclient() { |
1309 if(!sel) | 1319 if(!sel) |
1310 return; | 1320 return; |
1311 if(isprotodel(sel)) | 1321 if(isprotodel(sel)) |
1312 sendevent(sel->win, wmatom[WMProtocols], wmatom[WMDelete]); | 1322 sendevent(sel->win, wmatom[WMProtocols], wmatom[WMDelete]); |
1313 else | 1323 else |
1686 XSendEvent(dpy, w, False, NoEventMask, &e); | 1696 XSendEvent(dpy, w, False, NoEventMask, &e); |
1687 XSync(dpy, False); | 1697 XSync(dpy, False); |
1688 } | 1698 } |
1689 | 1699 |
1690 void | 1700 void |
1691 quit(Arg *arg) { | 1701 quit() { |
1692 readin = running = False; | 1702 readin = running = False; |
1693 } | 1703 } |
1694 | 1704 |
1695 /* There's no way to check accesses to destroyed windows, thus those cases are | 1705 /* There's no way to check accesses to destroyed windows, thus those cases are |
1696 * ignored (especially on UnmapNotify's). Other types of errors call Xlibs | 1706 * ignored (especially on UnmapNotify's). Other types of errors call Xlibs |