diff options
| author | Anselm R. Garbe <arg@suckless.org> | 2007-05-29 11:35:20 +0200 |
|---|---|---|
| committer | Anselm R. Garbe <arg@suckless.org> | 2007-05-29 11:35:20 +0200 |
| commit | 199a6016114875656102d11e79a80939bfaff3b3 (patch) | |
| tree | 2ad54798ecf25479959e50e611eb2163247745ec | |
| parent | applied Sanders patch (diff) | |
| download | dwm-199a6016114875656102d11e79a80939bfaff3b3.tar.gz dwm-199a6016114875656102d11e79a80939bfaff3b3.zip | |
applied anydot's 3 minor patches, thank you anydot
| -rw-r--r-- | client.c | 17 | ||||
| -rw-r--r-- | dwm.h | 3 | ||||
| -rw-r--r-- | event.c | 4 | ||||
| -rw-r--r-- | layout.c | 41 |
4 files changed, 31 insertions, 34 deletions
| @@ -129,8 +129,8 @@ detach(Client *c) { | |||
| 129 | 129 | ||
| 130 | void | 130 | void |
| 131 | focus(Client *c) { | 131 | focus(Client *c) { |
| 132 | if(c && !isvisible(c)) | 132 | if( !c && selscreen || c && !isvisible(c)) |
| 133 | return; | 133 | for(c = stack; c && !isvisible(c); c = c->snext); |
| 134 | if(sel && sel != c) { | 134 | if(sel && sel != c) { |
| 135 | grabbuttons(sel, False); | 135 | grabbuttons(sel, False); |
| 136 | XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]); | 136 | XSetWindowBorder(dpy, sel->win, dc.norm[ColBorder]); |
| @@ -153,14 +153,6 @@ 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 | ||
| 164 | killclient(const char *arg) { | 156 | killclient(const char *arg) { |
| 165 | XEvent ev; | 157 | XEvent ev; |
| 166 | 158 | ||
| @@ -230,8 +222,7 @@ manage(Window w, XWindowAttributes *wa) { | |||
| 230 | XMoveWindow(dpy, w, c->x + 2 * sw, c->y); | 222 | XMoveWindow(dpy, w, c->x + 2 * sw, c->y); |
| 231 | XMapWindow(dpy, w); | 223 | XMapWindow(dpy, w); |
| 232 | setclientstate(c, NormalState); | 224 | setclientstate(c, NormalState); |
| 233 | if(isvisible(c)) | 225 | focus(c); |
| 234 | focus(c); | ||
| 235 | lt->arrange(); | 226 | lt->arrange(); |
| 236 | } | 227 | } |
| 237 | 228 | ||
| @@ -401,7 +392,7 @@ unmanage(Client *c) { | |||
| 401 | detach(c); | 392 | detach(c); |
| 402 | detachstack(c); | 393 | detachstack(c); |
| 403 | if(sel == c) | 394 | if(sel == c) |
| 404 | focustopvisible(); | 395 | focus(NULL); |
| 405 | XUngrabButton(dpy, AnyButton, AnyModifier, c->win); | 396 | XUngrabButton(dpy, AnyButton, AnyModifier, c->win); |
| 406 | setclientstate(c, WithdrawnState); | 397 | setclientstate(c, WithdrawnState); |
| 407 | free(c->tags); | 398 | free(c->tags); |
| @@ -100,8 +100,7 @@ Window root, barwin; | |||
| 100 | void attach(Client *c); /* attaches c to global client list */ | 100 | void attach(Client *c); /* attaches c to global client list */ |
| 101 | void configure(Client *c); /* send synthetic configure event */ | 101 | void configure(Client *c); /* send synthetic configure event */ |
| 102 | void detach(Client *c); /* detaches c from global client list */ | 102 | void detach(Client *c); /* detaches c from global client list */ |
| 103 | void focus(Client *c); /* focus c, c may be NULL */ | 103 | void focus(Client *c); /* focus c if visible && !NULL, or focus top visible */ |
| 104 | void focustopvisible(void); /* focus top visible window on stack */ | ||
| 105 | void killclient(const char *arg); /* kill sel nicely */ | 104 | void killclient(const char *arg); /* kill sel nicely */ |
| 106 | void manage(Window w, XWindowAttributes *wa); /* manage new client */ | 105 | void manage(Window w, XWindowAttributes *wa); /* manage new client */ |
| 107 | void resize(Client *c, int x, int y, | 106 | void resize(Client *c, int x, int y, |
| @@ -242,11 +242,11 @@ enternotify(XEvent *e) { | |||
| 242 | 242 | ||
| 243 | if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) | 243 | if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) |
| 244 | return; | 244 | return; |
| 245 | if((c = getclient(ev->window)) && isvisible(c)) | 245 | if(c = getclient(ev->window)) |
| 246 | focus(c); | 246 | focus(c); |
| 247 | else if(ev->window == root) { | 247 | else if(ev->window == root) { |
| 248 | selscreen = True; | 248 | selscreen = True; |
| 249 | focustopvisible(); | 249 | focus(NULL); |
| 250 | } | 250 | } |
| 251 | } | 251 | } |
| 252 | 252 | ||
| @@ -14,6 +14,22 @@ static unsigned int masterw = MASTERWIDTH; | |||
| 14 | static unsigned int nmaster = NMASTER; | 14 | static unsigned int nmaster = NMASTER; |
| 15 | 15 | ||
| 16 | static void | 16 | static void |
| 17 | ban(Client *c) { | ||
| 18 | if (c->isbanned) | ||
| 19 | return; | ||
| 20 | XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); | ||
| 21 | c->isbanned = True; | ||
| 22 | } | ||
| 23 | |||
| 24 | static void | ||
| 25 | unban(Client *c) { | ||
| 26 | if (!c->isbanned) | ||
| 27 | return; | ||
| 28 | XMoveWindow(dpy, c->win, c->x, c->y); | ||
| 29 | c->isbanned = False; | ||
| 30 | } | ||
| 31 | |||
| 32 | static void | ||
| 17 | tile(void) { | 33 | tile(void) { |
| 18 | unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th; | 34 | unsigned int i, n, nx, ny, nw, nh, mw, mh, tw, th; |
| 19 | Client *c; | 35 | Client *c; |
| @@ -28,9 +44,7 @@ tile(void) { | |||
| 28 | 44 | ||
| 29 | for(i = 0, c = clients; c; c = c->next) | 45 | for(i = 0, c = clients; c; c = c->next) |
| 30 | if(isvisible(c)) { | 46 | if(isvisible(c)) { |
| 31 | if(c->isbanned) | 47 | unban(c); |
| 32 | XMoveWindow(dpy, c->win, c->x, c->y); | ||
| 33 | c->isbanned = False; | ||
| 34 | if(c->isfloating) | 48 | if(c->isfloating) |
| 35 | continue; | 49 | continue; |
| 36 | c->ismax = False; | 50 | c->ismax = False; |
| @@ -60,12 +74,9 @@ tile(void) { | |||
| 60 | resize(c, nx, ny, nw, nh, False); | 74 | resize(c, nx, ny, nw, nh, False); |
| 61 | i++; | 75 | i++; |
| 62 | } | 76 | } |
| 63 | else { | 77 | else |
| 64 | c->isbanned = True; | 78 | ban(c); |
| 65 | XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); | 79 | focus(NULL); |
| 66 | } | ||
| 67 | if(!sel || !isvisible(sel)) | ||
| 68 | focustopvisible(); | ||
| 69 | restack(); | 80 | restack(); |
| 70 | } | 81 | } |
| 71 | 82 | ||
| @@ -77,20 +88,16 @@ void | |||
| 77 | floating(void) { | 88 | floating(void) { |
| 78 | Client *c; | 89 | Client *c; |
| 79 | 90 | ||
| 80 | for(c = clients; c; c = c->next) { | 91 | for(c = clients; c; c = c->next) |
| 81 | if(isvisible(c)) { | 92 | if(isvisible(c)) { |
| 82 | if(c->isbanned) | 93 | if(c->isbanned) |
| 83 | XMoveWindow(dpy, c->win, c->x, c->y); | 94 | XMoveWindow(dpy, c->win, c->x, c->y); |
| 84 | c->isbanned = False; | 95 | c->isbanned = False; |
| 85 | resize(c, c->x, c->y, c->w, c->h, True); | 96 | resize(c, c->x, c->y, c->w, c->h, True); |
| 86 | } | 97 | } |
| 87 | else { | 98 | else |
| 88 | c->isbanned = True; | 99 | ban(c); |
| 89 | XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); | 100 | focus(NULL); |
| 90 | } | ||
| 91 | } | ||
| 92 | if(!sel || !isvisible(sel)) | ||
| 93 | focustopvisible(); | ||
| 94 | restack(); | 101 | restack(); |
| 95 | } | 102 | } |
| 96 | 103 | ||
