sanders solution is convincing and elegant 69b738c0
Anselm R. Garbe · 2006-09-06 11:54 2 file(s) · +9 −49
client.c +0 −8
99 99
		}
100 100
	}
101 101
	if(c) {
102 -
		if((c->isfloat || arrange == dofloat) && (c != clients)) {
103 -
			detach(c);
104 -
			if(clients) {
105 -
				clients->prev = c;
106 -
				c->next = clients;
107 -
			}
108 -
			clients = c;
109 -
		}
110 102
		grabbuttons(c, True);
111 103
		drawtitle(c);
112 104
		XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
view.c +9 −41
215 215
void
216 216
restack()
217 217
{
218 -
	static unsigned int nwins = 0;
219 -
	static Window *wins = NULL;
220 -
	unsigned int f, fi, m, mi, n;
221 218
	Client *c;
222 219
	XEvent ev;
223 -
224 -
	for(f = 0, m = 0, c = clients; c; c = c->next)
225 -
		if(isvisible(c)) {
226 -
			if(c->isfloat || arrange == dofloat)
227 -
				f++;
228 -
			else
229 -
				m++;
230 -
		}
231 -
	if(!(n = 2 * (f + m))) {
232 -
		drawstatus();
220 +
	
221 +
	if(!sel)
233 222
		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 -
		}
223 +
	if(sel->isfloat || arrange == dofloat) {
224 +
		XRaiseWindow(dpy, sel->win);
225 +
		XRaiseWindow(dpy, sel->twin);
251 226
	}
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 -
			}
227 +
	if(arrange != dofloat) 
228 +
		for(c = nexttiled(clients); c; c = nexttiled(c->next)) {
229 +
			XLowerWindow(dpy, c->twin);
230 +
			XLowerWindow(dpy, c->win);
262 231
		}
263 -
	XRestackWindows(dpy, wins, n);
264 232
	drawall();
265 233
	XSync(dpy, False);
266 234
	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));