summaryrefslogtreecommitdiffstats
path: root/view.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--view.c44
1 files changed, 24 insertions, 20 deletions
diff --git a/view.c b/view.c
index 3270160..5de34c0 100644
--- a/view.c
+++ b/view.c
@@ -3,31 +3,39 @@
3 * See LICENSE file for license details. 3 * See LICENSE file for license details.
4 */ 4 */
5#include "dwm.h" 5#include "dwm.h"
6#include <stdio.h>
6 7
7/* static */ 8/* static */
8 9
10static Client *
11minclient()
12{
13 Client *c, *min;
14
15 for(min = c = clients; c; c = c->next)
16 if(c->weight < min->weight)
17 min = c;
18 return min;
19}
20
21
9static void 22static void
10reorder() 23reorder()
11{ 24{
12 Client *c, *orig, *p; 25 Client *c, *newclients, *tail;
13 26
14 orig = clients; 27 newclients = tail = NULL;
15 clients = NULL; 28 while((c = minclient())) {
16
17 while((c = orig)) {
18 orig = orig->next;
19 detach(c); 29 detach(c);
20 30 if(tail) {
21 for(p = clients; p && p->next && p->weight <= c->weight; p = p->next); 31 c->prev = tail;
22 c->prev = p; 32 tail->next = c;
23 if(p) { 33 tail = c;
24 if((c->next = p->next))
25 c->next->prev = c;
26 p->next = c;
27 } 34 }
28 else 35 else
29 clients = c; 36 tail = newclients = c;
30 } 37 }
38 clients = newclients;
31} 39}
32 40
33/* extern */ 41/* extern */
@@ -59,9 +67,7 @@ dofloat(Arg *arg)
59 else 67 else
60 ban(c); 68 ban(c);
61 } 69 }
62 if(!sel || !isvisible(sel)) 70 if((sel = getnext(clients)))
63 sel = getnext(clients);
64 if(sel)
65 focus(sel); 71 focus(sel);
66 else 72 else
67 XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); 73 XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
@@ -124,9 +130,7 @@ dotile(Arg *arg)
124 else 130 else
125 ban(c); 131 ban(c);
126 } 132 }
127 if(!sel || !isvisible(sel)) 133 if((sel = getnext(clients)))
128 sel = getnext(clients);
129 if(sel)
130 focus(sel); 134 focus(sel);
131 else 135 else
132 XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime); 136 XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);