863 } |
863 } |
864 |
864 |
865 void |
865 void |
866 manage(Window w, XWindowAttributes *wa) { |
866 manage(Window w, XWindowAttributes *wa) { |
867 Client *c, *t = NULL; |
867 Client *c, *t = NULL; |
868 Status rettrans; |
|
869 Window trans; |
868 Window trans; |
870 XWindowChanges wc; |
869 XWindowChanges wc; |
871 |
870 |
872 if(!(c = calloc(1, sizeof(Client)))) |
871 if(!(c = calloc(1, sizeof(Client)))) |
873 die("fatal: could not calloc() %u bytes\n", sizeof(Client)); |
872 die("fatal: could not calloc() %u bytes\n", sizeof(Client)); |
901 configure(c); /* propagates border_width, if size doesn't change */ |
900 configure(c); /* propagates border_width, if size doesn't change */ |
902 updatesizehints(c); |
901 updatesizehints(c); |
903 XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); |
902 XSelectInput(dpy, w, EnterWindowMask|FocusChangeMask|PropertyChangeMask|StructureNotifyMask); |
904 grabbuttons(c, False); |
903 grabbuttons(c, False); |
905 updatetitle(c); |
904 updatetitle(c); |
906 if((rettrans = XGetTransientForHint(dpy, w, &trans)) == Success) |
905 if(XGetTransientForHint(dpy, w, &trans)) |
907 t = getclient(trans); |
906 t = getclient(trans); |
908 if(t) |
907 if(t) |
909 c->tags = t->tags; |
908 c->tags = t->tags; |
910 else |
909 else |
911 applyrules(c); |
910 applyrules(c); |
912 if(!c->isfloating) |
911 if(!c->isfloating) |
913 c->isfloating = (rettrans == Success) || c->isfixed; |
912 c->isfloating = trans || c->isfixed; |
914 if(c->isfloating) |
913 if(c->isfloating) |
915 XRaiseWindow(dpy, c->win); |
914 XRaiseWindow(dpy, c->win); |
916 attach(c); |
915 attach(c); |
917 attachstack(c); |
916 attachstack(c); |
918 XMoveResizeWindow(dpy, c->win, c->x + 2 * sw, c->y, c->w, c->h); /* some windows require this */ |
917 XMoveResizeWindow(dpy, c->win, c->x + 2 * sw, c->y, c->w, c->h); /* some windows require this */ |