comparison tag.c @ 270:dacd3f3c5823

implemented restack behavior (floats are on top in tiled mode)
author Anselm R.Garbe <arg@10ksloc.org>
date Mon, 14 Aug 2006 10:18:24 +0200
parents 8a8ea74e1b87
children be40a56df248
comparison
equal deleted inserted replaced
269:bf6792e3e700 270:dacd3f3c5823
56 } 56 }
57 else 57 else
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
69 void 68 void
70 dotile(Arg *arg) 69 dotile(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;
76 for(n = 0, c = clients; c; c = c->next) 75 for(n = 0, c = clients; c; c = c->next)
77 if(isvisible(c) && !c->isfloat) 76 if(isvisible(c) && !c->isfloat)
84 83
85 for(i = 0, c = clients; c; c = c->next) { 84 for(i = 0, c = clients; c; c = c->next) {
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 }
93 if(n == 1) { 91 if(n == 1) {
94 c->x = sx; 92 c->x = sx;
121 i++; 119 i++;
122 } 120 }
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
135 Client * 131 Client *
136 getnext(Client *c) 132 getnext(Client *c)
137 { 133 {
195 return; 191 return;
196 192
197 for(i = 0; i < ntags; i++) 193 for(i = 0; i < ntags; i++)
198 sel->tags[i] = False; 194 sel->tags[i] = False;
199 appendtag(arg); 195 appendtag(arg);
196 }
197
198 void
199 restack()
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));
200 } 246 }
201 247
202 void 248 void
203 settags(Client *c) 249 settags(Client *c)
204 { 250 {
246 292
247 for(i = 0; i < ntags; i++) 293 for(i = 0; i < ntags; i++)
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
254 void 299 void
255 toggleview(Arg *arg) 300 toggleview(Arg *arg)
256 { 301 {
259 seltag[arg->i] = !seltag[arg->i]; 304 seltag[arg->i] = !seltag[arg->i];
260 for(i = 0; !seltag[i] && i < ntags; i++); 305 for(i = 0; !seltag[i] && i < ntags; i++);
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(); 309 }
265 }