Mercurial > dwm-meillo
comparison view.c @ 436:b3659c3c5dab
sanders solution is convincing and elegant
author | Anselm R. Garbe <arg@10kloc.org> |
---|---|
date | Wed, 06 Sep 2006 11:54:16 +0200 |
parents | a6b8994af164 |
children | 433a5c662f73 |
comparison
equal
deleted
inserted
replaced
435:42388f634de0 | 436:b3659c3c5dab |
---|---|
213 } | 213 } |
214 | 214 |
215 void | 215 void |
216 restack() | 216 restack() |
217 { | 217 { |
218 static unsigned int nwins = 0; | |
219 static Window *wins = NULL; | |
220 unsigned int f, fi, m, mi, n; | |
221 Client *c; | 218 Client *c; |
222 XEvent ev; | 219 XEvent ev; |
223 | 220 |
224 for(f = 0, m = 0, c = clients; c; c = c->next) | 221 if(!sel) |
225 if(isvisible(c)) { | 222 return; |
226 if(c->isfloat || arrange == dofloat) | 223 if(sel->isfloat || arrange == dofloat) { |
227 f++; | 224 XRaiseWindow(dpy, sel->win); |
228 else | 225 XRaiseWindow(dpy, sel->twin); |
229 m++; | 226 } |
227 if(arrange != dofloat) | |
228 for(c = nexttiled(clients); c; c = nexttiled(c->next)) { | |
229 XLowerWindow(dpy, c->twin); | |
230 XLowerWindow(dpy, c->win); | |
230 } | 231 } |
231 if(!(n = 2 * (f + m))) { | |
232 drawstatus(); | |
233 return; | |
234 } | |
235 if(nwins < n) { | |
236 nwins = n; | |
237 wins = erealloc(wins, nwins * sizeof(Window)); | |
238 } | |
239 | |
240 fi = 0; | |
241 mi = 2 * f; | |
242 if(sel) { | |
243 if(sel->isfloat || arrange == dofloat) { | |
244 wins[fi++] = sel->twin; | |
245 wins[fi++] = sel->win; | |
246 } | |
247 else { | |
248 wins[mi++] = sel->twin; | |
249 wins[mi++] = sel->win; | |
250 } | |
251 } | |
252 for(c = clients; c; c = c->next) | |
253 if(isvisible(c) && c != sel) { | |
254 if(c->isfloat || arrange == dofloat) { | |
255 wins[fi++] = c->twin; | |
256 wins[fi++] = c->win; | |
257 } | |
258 else { | |
259 wins[mi++] = c->twin; | |
260 wins[mi++] = c->win; | |
261 } | |
262 } | |
263 XRestackWindows(dpy, wins, n); | |
264 drawall(); | 232 drawall(); |
265 XSync(dpy, False); | 233 XSync(dpy, False); |
266 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); | 234 while(XCheckMaskEvent(dpy, EnterWindowMask, &ev)); |
267 } | 235 } |
268 | 236 |