removed swap(), implemented pop for everything 7ac0de83
Anselm R. Garbe · 2007-01-05 21:55 1 file(s) · +8 −61
view.c +8 −61
11 11
	return c;
12 12
}
13 13
14 -
static Bool
15 -
ismaster(Client *c) {
16 -
	Client *cl;
17 -
	unsigned int i;
18 -
19 -
	for(cl = nexttiled(clients), i = 0; cl && cl != c; cl = nexttiled(cl->next), i++);
20 -
	return i < nmaster;
21 -
}
22 -
23 -
static void
24 -
pop(Client *c) {
25 -
	detach(c);
26 -
	if(clients)
27 -
		clients->prev = c;
28 -
	c->next = clients;
29 -
	clients = c;
30 -
}
31 -
32 -
static void
33 -
swap(Client *c1, Client *c2) {
34 -
	Client tmp = *c1;
35 -
	Client *c1p = c1->prev;
36 -
	Client *c1n = c1->next;
37 -
	Client *c1s = c1->snext;
38 -
	Client *c2p = c2->prev;
39 -
	Client *c2n = c2->next;
40 -
	Client *c2s = c2->snext;
41 -
42 -
	*c1 = *c2;
43 -
	*c2 = tmp;
44 -
	c1->prev = c1p;
45 -
	c1->next = c1n;
46 -
	c1->snext = c1s;
47 -
	c2->prev = c2p;
48 -
	c2->next = c2n;
49 -
	c2->snext = c2s;
50 -
}
51 -
52 14
static void
53 15
togglemax(Client *c) {
54 16
	XEvent ev;
70 32
	}
71 33
	resize(c, True, TopLeft);
72 34
	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
73 -
}
74 -
75 -
static Client *
76 -
topofstack() {
77 -
	Client *c;
78 -
	unsigned int i;
79 -
80 -
	for(c = nexttiled(clients), i = 0; c && i < nmaster; c = nexttiled(c->next), i++);
81 -
	return (i < nmaster) ? NULL : c;
82 35
}
83 36
84 37
/* extern */
308 261
		n++;
309 262
310 263
	c = sel;
311 -
	if(arrange == dofloat)
312 -
		return;
313 -
	else if(n <= nmaster)
314 -
		pop(c);
315 -
	else if(ismaster(sel)) {
316 -
		if(!(c = topofstack()))
317 -
			return;
318 -
		swap(c, sel);
319 -
		c = sel;
264 +
	if(arrange != dofloat) {
265 +
		detach(c);
266 +
		if(clients)
267 +
			clients->prev = c;
268 +
		c->next = clients;
269 +
		clients = c;
270 +
		focus(c);
271 +
		arrange();
320 272
	}
321 -
	else
322 -
		pop(c);
323 -
324 -
	focus(c);
325 -
	arrange();
326 273
}