comparison client.c @ 378:83576f5f0a90

added attach/detach functions which don't attach at the begin of list, but at the slot of a first match of the tags of a client
author Anselm R. Garbe <arg@10kloc.org>
date Tue, 29 Aug 2006 09:23:44 +0200
parents b1159a638d0a
children b00cc483d13b
comparison
equal deleted inserted replaced
377:b1159a638d0a 378:83576f5f0a90
228 c->twin = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th, 228 c->twin = XCreateWindow(dpy, root, c->tx, c->ty, c->tw, c->th,
229 0, DefaultDepth(dpy, screen), CopyFromParent, 229 0, DefaultDepth(dpy, screen), CopyFromParent,
230 DefaultVisual(dpy, screen), 230 DefaultVisual(dpy, screen),
231 CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa); 231 CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
232 232
233 if(clients)
234 clients->prev = c;
235 c->next = clients;
236 clients = c;
237
238 grabbuttons(c, False); 233 grabbuttons(c, False);
239
240 if((tc = getclient(trans))) /* inherit tags */ 234 if((tc = getclient(trans))) /* inherit tags */
241 for(i = 0; i < ntags; i++) 235 for(i = 0; i < ntags; i++)
242 c->tags[i] = tc->tags[i]; 236 c->tags[i] = tc->tags[i];
243 else 237 else
244 settags(c); 238 settags(c);
245 if(!c->isfloat) 239 if(!c->isfloat)
246 c->isfloat = trans 240 c->isfloat = trans
247 || (c->maxw && c->minw && 241 || (c->maxw && c->minw &&
248 c->maxw == c->minw && c->maxh == c->minh); 242 c->maxw == c->minw && c->maxh == c->minh);
243
244 attach(c);
245
249 settitle(c); 246 settitle(c);
250 if(isvisible(c)) 247 if(isvisible(c))
251 sel = c; 248 sel = c;
252 arrange(NULL); 249 arrange(NULL);
253 XMapWindow(dpy, c->win); 250 XMapWindow(dpy, c->win);
405 XGetTransientForHint(dpy, c->win, &trans); 402 XGetTransientForHint(dpy, c->win, &trans);
406 403
407 XUngrabButton(dpy, AnyButton, AnyModifier, c->win); 404 XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
408 XDestroyWindow(dpy, c->twin); 405 XDestroyWindow(dpy, c->twin);
409 406
410 if(c->prev) 407 detach(c);
411 c->prev->next = c->next;
412 if(c->next)
413 c->next->prev = c->prev;
414 if(c == clients)
415 clients = c->next;
416 if(sel == c) { 408 if(sel == c) {
417 if(trans && (tc = getclient(trans)) && isvisible(tc)) 409 if(trans && (tc = getclient(trans)) && isvisible(tc))
418 sel = tc; 410 sel = tc;
419 else 411 else
420 sel = getnext(clients); 412 sel = getnext(clients);