-grabbuttons(Client *c, Bool focus)
-{
+detachstack(Client *c) {
+ Client **tc;
+ for(tc=&stack; *tc && *tc != c; tc=&(*tc)->snext);
+ *tc = c->snext;
+}
+
+static void
+grabbuttons(Client *c, Bool focused) {
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
XGrabButton(dpy, Button1, MODKEY, c->win, False, BUTTONMASK,
GrabModeAsync, GrabModeSync, None, None);
XGrabButton(dpy, Button1, MODKEY | LockMask, c->win, False, BUTTONMASK,
XGrabButton(dpy, Button1, MODKEY, c->win, False, BUTTONMASK,
GrabModeAsync, GrabModeSync, None, None);
XGrabButton(dpy, Button1, MODKEY | LockMask, c->win, False, BUTTONMASK,
else
XGrabButton(dpy, AnyButton, AnyModifier, c->win, False, BUTTONMASK,
GrabModeAsync, GrabModeSync, None, None);
else
XGrabButton(dpy, AnyButton, AnyModifier, c->win, False, BUTTONMASK,
GrabModeAsync, GrabModeSync, None, None);
XMoveResizeWindow(dpy, c->twin, c->tx, c->ty, c->tw, c->th);
else
XMoveResizeWindow(dpy, c->twin, c->tx + 2 * sw, c->ty, c->tw, c->th);
XMoveResizeWindow(dpy, c->twin, c->tx, c->ty, c->tw, c->th);
else
XMoveResizeWindow(dpy, c->twin, c->tx + 2 * sw, c->ty, c->tw, c->th);
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
XMoveWindow(dpy, c->twin, c->tx + 2 * sw, c->ty);
}
void
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
XMoveWindow(dpy, c->twin, c->tx + 2 * sw, c->ty);
}
void
- grabbuttons(old, False);
- drawtitle(old);
+ if(old) {
+ grabbuttons(old, False);
+ drawtitle(old);
+ }
+ }
+ if(c) {
+ detachstack(c);
+ c->snext = stack;
+ stack = c;
+ grabbuttons(c, True);
+ drawtitle(c);
+ XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
- grabbuttons(c, True);
- drawtitle(c);
- XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
+ else
+ XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
DefaultVisual(dpy, screen),
CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
DefaultVisual(dpy, screen),
CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
-
- if((tc = getclient(trans))) /* inherit tags */
- for(i = 0; i < ntags; i++)
- c->tags[i] = tc->tags[i];
- else
- settags(c);
+ settags(c, getclient(trans));
- XConfigureWindow(dpy, c->win, CWX|CWY|CWWidth|CWHeight|CWBorderWidth, &wc);
+ XConfigureWindow(dpy, c->win, CWX | CWY | CWWidth | CWHeight | CWBorderWidth, &wc);
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
XDestroyWindow(dpy, c->twin);
XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
XDestroyWindow(dpy, c->twin);