summaryrefslogtreecommitdiffstats
path: root/tag.c
diff options
context:
space:
mode:
authorAnselm R.Garbe <arg@10ksloc.org>2006-08-14 10:18:24 +0200
committerAnselm R.Garbe <arg@10ksloc.org>2006-08-14 10:18:24 +0200
commitd4b7a9a3735deeab639f28b5bb2f568e0dc49616 (patch)
tree9cff17d7a5d4fa2fe94b39d0d18d8d72c8429736 /tag.c
parentfixed string cutting in draw.c (diff)
downloaddwm-d4b7a9a3735deeab639f28b5bb2f568e0dc49616.tar.gz
dwm-d4b7a9a3735deeab639f28b5bb2f568e0dc49616.zip
implemented restack behavior (floats are on top in tiled mode)
Diffstat (limited to 'tag.c')
-rw-r--r--tag.c64
1 files changed, 54 insertions, 10 deletions
diff --git a/tag.c b/tag.c
index d27d91a..01979d5 100644
--- a/tag.c
+++ b/tag.c
@@ -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
69void 68void
70dotile(Arg *arg) 69dotile(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
135Client * 131Client *
@@ -200,6 +196,56 @@ replacetag(Arg *arg)
200} 196}
201 197
202void 198void
199restack()
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
248void
203settags(Client *c) 249settags(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
254void 299void
@@ -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}