diff options
| author | Anselm R. Garbe <arg@suckless.org> | 2007-05-14 11:54:30 +0200 |
|---|---|---|
| committer | Anselm R. Garbe <arg@suckless.org> | 2007-05-14 11:54:30 +0200 |
| commit | ab3d6a7dfe76d9857f2fc621034359a2a0bf09df (patch) | |
| tree | 9738e466d2ea2b0e1107084b159f8a1b93f271af | |
| parent | small fix of fix (diff) | |
| download | dwm-ab3d6a7dfe76d9857f2fc621034359a2a0bf09df.tar.gz dwm-ab3d6a7dfe76d9857f2fc621034359a2a0bf09df.zip | |
applied dfenze cleanups, fixed some comments in dwm.h
Diffstat (limited to '')
| -rw-r--r-- | client.c | 14 | ||||
| -rw-r--r-- | dwm.h | 9 | ||||
| -rw-r--r-- | event.c | 3 | ||||
| -rw-r--r-- | layout.c | 15 |
4 files changed, 20 insertions, 21 deletions
| @@ -153,6 +153,14 @@ focus(Client *c) { | |||
| 153 | } | 153 | } |
| 154 | 154 | ||
| 155 | void | 155 | void |
| 156 | focustopvisible(void) { | ||
| 157 | Client *c; | ||
| 158 | |||
| 159 | for(c = stack; c && !isvisible(c); c = c->snext); | ||
| 160 | focus(c); | ||
| 161 | } | ||
| 162 | |||
| 163 | void | ||
| 156 | killclient(const char *arg) { | 164 | killclient(const char *arg) { |
| 157 | XEvent ev; | 165 | XEvent ev; |
| 158 | 166 | ||
| @@ -391,10 +399,8 @@ unmanage(Client *c) { | |||
| 391 | XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */ | 399 | XConfigureWindow(dpy, c->win, CWBorderWidth, &wc); /* restore border */ |
| 392 | detach(c); | 400 | detach(c); |
| 393 | detachstack(c); | 401 | detachstack(c); |
| 394 | if(sel == c) { | 402 | if(sel == c) |
| 395 | for(nc = stack; nc && !isvisible(nc); nc = nc->snext); | 403 | focustopvisible(); |
| 396 | focus(nc); | ||
| 397 | } | ||
| 398 | XUngrabButton(dpy, AnyButton, AnyModifier, c->win); | 404 | XUngrabButton(dpy, AnyButton, AnyModifier, c->win); |
| 399 | setclientstate(c, WithdrawnState); | 405 | setclientstate(c, WithdrawnState); |
| 400 | free(c->tags); | 406 | free(c->tags); |
| @@ -100,11 +100,12 @@ void attach(Client *c); /* attaches c to global client list */ | |||
| 100 | void configure(Client *c); /* send synthetic configure event */ | 100 | void configure(Client *c); /* send synthetic configure event */ |
| 101 | void detach(Client *c); /* detaches c from global client list */ | 101 | void detach(Client *c); /* detaches c from global client list */ |
| 102 | void focus(Client *c); /* focus c, c may be NULL */ | 102 | void focus(Client *c); /* focus c, c may be NULL */ |
| 103 | void killclient(const char *arg); /* kill c nicely */ | 103 | void focustopvisible(void); /* focus top visible window on stack */ |
| 104 | void killclient(const char *arg); /* kill sel nicely */ | ||
| 104 | void manage(Window w, XWindowAttributes *wa); /* manage new client */ | 105 | void manage(Window w, XWindowAttributes *wa); /* manage new client */ |
| 105 | void resize(Client *c, int x, int y, | 106 | void resize(Client *c, int x, int y, |
| 106 | int w, int h, Bool sizehints); /* resize with given coordinates c*/ | 107 | int w, int h, Bool sizehints); /* resize with given coordinates c*/ |
| 107 | void togglefloating(const char *arg); /* toggles focused client between floating/tiled state */ | 108 | void togglefloating(const char *arg); /* toggles sel between floating/tiled state */ |
| 108 | void updatesizehints(Client *c); /* update the size hint variables of c */ | 109 | void updatesizehints(Client *c); /* update the size hint variables of c */ |
| 109 | void updatetitle(Client *c); /* update the name of c */ | 110 | void updatetitle(Client *c); /* update the name of c */ |
| 110 | void unmanage(Client *c); /* destroy c */ | 111 | void unmanage(Client *c); /* destroy c */ |
| @@ -137,8 +138,8 @@ int xerror(Display *dsply, XErrorEvent *ee); /* dwm's X error handler */ | |||
| 137 | void compileregs(void); /* initialize regexps of rules defined in config.h */ | 138 | void compileregs(void); /* initialize regexps of rules defined in config.h */ |
| 138 | Bool isvisible(Client *c); /* returns True if client is visible */ | 139 | Bool isvisible(Client *c); /* returns True if client is visible */ |
| 139 | void settags(Client *c, Client *trans); /* sets tags of c */ | 140 | void settags(Client *c, Client *trans); /* sets tags of c */ |
| 140 | void tag(const char *arg); /* tags c with arg's index */ | 141 | void tag(const char *arg); /* tags sel with arg's index */ |
| 141 | void toggletag(const char *arg); /* toggles c tags with arg's index */ | 142 | void toggletag(const char *arg); /* toggles sel tags with arg's index */ |
| 142 | void toggleview(const char *arg); /* toggles the tag with arg's index (in)visible */ | 143 | void toggleview(const char *arg); /* toggles the tag with arg's index (in)visible */ |
| 143 | void view(const char *arg); /* views the tag with arg's index */ | 144 | void view(const char *arg); /* views the tag with arg's index */ |
| 144 | 145 | ||
| @@ -247,8 +247,7 @@ enternotify(XEvent *e) { | |||
| 247 | focus(c); | 247 | focus(c); |
| 248 | else if(ev->window == root) { | 248 | else if(ev->window == root) { |
| 249 | selscreen = True; | 249 | selscreen = True; |
| 250 | for(c = stack; c && !isvisible(c); c = c->snext); | 250 | focustopvisible(); |
| 251 | focus(c); | ||
| 252 | } | 251 | } |
| 253 | } | 252 | } |
| 254 | 253 | ||
| @@ -61,10 +61,8 @@ tile(void) { | |||
| 61 | c->isbanned = True; | 61 | c->isbanned = True; |
| 62 | XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); | 62 | XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); |
| 63 | } | 63 | } |
| 64 | if(!sel || !isvisible(sel)) { | 64 | if(!sel || !isvisible(sel)) |
| 65 | for(c = stack; c && !isvisible(c); c = c->snext); | 65 | focustopvisible(); |
| 66 | focus(c); | ||
| 67 | } | ||
| 68 | restack(); | 66 | restack(); |
| 69 | } | 67 | } |
| 70 | 68 | ||
| @@ -88,10 +86,8 @@ floating(void) { | |||
| 88 | XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); | 86 | XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); |
| 89 | } | 87 | } |
| 90 | } | 88 | } |
| 91 | if(!sel || !isvisible(sel)) { | 89 | if(!sel || !isvisible(sel)) |
| 92 | for(c = stack; c && !isvisible(c); c = c->snext); | 90 | focustopvisible(); |
| 93 | focus(c); | ||
| 94 | } | ||
| 95 | restack(); | 91 | restack(); |
| 96 | } | 92 | } |
| 97 | 93 | ||
| @@ -241,13 +237,10 @@ togglemax(const char *arg) { | |||
| 241 | 237 | ||
| 242 | void | 238 | void |
| 243 | zoom(const char *arg) { | 239 | zoom(const char *arg) { |
| 244 | unsigned int n; | ||
| 245 | Client *c; | 240 | Client *c; |
| 246 | 241 | ||
| 247 | if(!sel || lt->arrange != tile || sel->isfloating) | 242 | if(!sel || lt->arrange != tile || sel->isfloating) |
| 248 | return; | 243 | return; |
| 249 | for(n = 0, c = nexttiled(clients); c; c = nexttiled(c->next)) | ||
| 250 | n++; | ||
| 251 | if((c = sel) == nexttiled(clients)) | 244 | if((c = sel) == nexttiled(clients)) |
| 252 | if(!(c = nexttiled(c->next))) | 245 | if(!(c = nexttiled(c->next))) |
| 253 | return; | 246 | return; |
