diff options
Diffstat (limited to 'tag.c')
| -rw-r--r-- | tag.c | 64 |
1 files changed, 54 insertions, 10 deletions
| @@ -58,18 +58,17 @@ dofloat(Arg *arg) | |||
| 58 | ban(c); | 58 | ban(c); |
| 59 | } | 59 | } |
| 60 | if((sel = getnext(clients))) { | 60 | if((sel = getnext(clients))) { |
| 61 | higher(sel); | ||
| 62 | focus(sel); | 61 | focus(sel); |
| 62 | restack(); | ||
| 63 | } | 63 | } |
| 64 | else | 64 | else |
| 65 | XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); | 65 | XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); |
| 66 | drawall(); | ||
| 67 | } | 66 | } |
| 68 | 67 | ||
| 69 | void | 68 | void |
| 70 | dotile(Arg *arg) | 69 | dotile(Arg *arg) |
| 71 | { | 70 | { |
| 72 | int n, i, w, h; | 71 | int h, i, n, w; |
| 73 | Client *c; | 72 | Client *c; |
| 74 | 73 | ||
| 75 | w = sw - mw; | 74 | w = sw - mw; |
| @@ -86,7 +85,6 @@ dotile(Arg *arg) | |||
| 86 | c->ismax = False; | 85 | c->ismax = False; |
| 87 | if(isvisible(c)) { | 86 | if(isvisible(c)) { |
| 88 | if(c->isfloat) { | 87 | if(c->isfloat) { |
| 89 | higher(c); | ||
| 90 | resize(c, True, TopLeft); | 88 | resize(c, True, TopLeft); |
| 91 | continue; | 89 | continue; |
| 92 | } | 90 | } |
| @@ -123,13 +121,11 @@ dotile(Arg *arg) | |||
| 123 | else | 121 | else |
| 124 | ban(c); | 122 | ban(c); |
| 125 | } | 123 | } |
| 126 | if((sel = getnext(clients))) { | 124 | if((sel = getnext(clients))) |
| 127 | higher(sel); | ||
| 128 | focus(sel); | 125 | focus(sel); |
| 129 | } | ||
| 130 | else | 126 | else |
| 131 | XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); | 127 | XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); |
| 132 | drawall(); | 128 | restack(); |
| 133 | } | 129 | } |
| 134 | 130 | ||
| 135 | Client * | 131 | Client * |
| @@ -200,6 +196,56 @@ replacetag(Arg *arg) | |||
| 200 | } | 196 | } |
| 201 | 197 | ||
| 202 | void | 198 | void |
| 199 | restack() | ||
| 200 | { | ||
| 201 | static unsigned int nwins = 0; | ||
| 202 | static Window *wins = NULL; | ||
| 203 | unsigned int f, fi, m, mi, n; | ||
| 204 | Client *c; | ||
| 205 | XEvent ev; | ||
| 206 | |||
| 207 | for(f = 0, m = 0, c = clients; c; c = c->next) | ||
| 208 | if(isvisible(c)) { | ||
| 209 | if(c->isfloat || arrange == dofloat) | ||
| 210 | f++; | ||
| 211 | else | ||
| 212 | m++; | ||
| 213 | } | ||
| 214 | |||
| 215 | n = 2 * (f + m); | ||
| 216 | if(nwins < n) { | ||
| 217 | nwins = n; | ||
| 218 | wins = erealloc(wins, nwins * sizeof(Window)); | ||
| 219 | } | ||
| 220 | |||
| 221 | fi = 0; | ||
| 222 | mi = 2 * f; | ||
| 223 | if(sel->isfloat || arrange == dofloat) { | ||
| 224 | wins[fi++] = sel->title; | ||
| 225 | wins[fi++] = sel->win; | ||
| 226 | } | ||
| 227 | else { | ||
| 228 | wins[mi++] = sel->title; | ||
| 229 | wins[mi++] = sel->win; | ||
| 230 | } | ||
| 231 | for(c = clients; c; c = c->next) | ||
| 232 | if(isvisible(c) && c != sel) { | ||
| 233 | if(c->isfloat || arrange == dofloat) { | ||
| 234 | wins[fi++] = c->title; | ||
| 235 | wins[fi++] = c->win; | ||
| 236 | } | ||
| 237 | else { | ||
| 238 | wins[mi++] = c->title; | ||
| 239 | wins[mi++] = c->win; | ||
| 240 | } | ||
| 241 | } | ||
| 242 | XRestackWindows(dpy, wins, n); | ||
| 243 | drawall(); | ||
| 244 | XSync(dpy, False); | ||
| 245 | while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); | ||
| 246 | } | ||
| 247 | |||
| 248 | void | ||
| 203 | settags(Client *c) | 249 | settags(Client *c) |
| 204 | { | 250 | { |
| 205 | char classinst[256]; | 251 | char classinst[256]; |
| @@ -248,7 +294,6 @@ view(Arg *arg) | |||
| 248 | seltag[i] = False; | 294 | seltag[i] = False; |
| 249 | seltag[arg->i] = True; | 295 | seltag[arg->i] = True; |
| 250 | arrange(NULL); | 296 | arrange(NULL); |
| 251 | drawall(); | ||
| 252 | } | 297 | } |
| 253 | 298 | ||
| 254 | void | 299 | void |
| @@ -261,5 +306,4 @@ toggleview(Arg *arg) | |||
| 261 | if(i == ntags) | 306 | if(i == ntags) |
| 262 | seltag[arg->i] = True; /* cannot toggle last view */ | 307 | seltag[arg->i] = True; /* cannot toggle last view */ |
| 263 | arrange(NULL); | 308 | arrange(NULL); |
| 264 | drawall(); | ||
| 265 | } | 309 | } |
