JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
merged tag.c, view.c and tile.c to manage.c
[dwm.git] / client.c
index bc26997..e7a3864 100644 (file)
--- a/client.c
+++ b/client.c
 /* static */
 
 static void
-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);
 
@@ -68,14 +61,6 @@ xerrordummy(Display *dsply, XErrorEvent *ee) {
 /* extern */
 
 void
-ban(Client *c) {
-       if(!c || c->isbanned)
-               return;
-       c->isbanned = True;
-       XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
-}
-
-void
 configure(Client *c) {
        XConfigureEvent ce;
 
@@ -103,8 +88,7 @@ focus(Client *c) {
        }
        if(c) {
                detachstack(c);
-               c->snext = stack;
-               stack = c;
+               attachstack(c);
                grabbuttons(c, True);
        }
        sel = c;
@@ -119,16 +103,6 @@ focus(Client *c) {
                XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
 }
 
-Client *
-getclient(Window w) {
-       Client *c;
-
-       for(c = clients; c; c = c->next)
-               if(c->win == w)
-                       return c;
-       return NULL;
-}
-
 Bool
 isprotodel(Client *c) {
        int i, n;
@@ -197,11 +171,8 @@ manage(Window w, XWindowAttributes *wa) {
        settags(c, t);
        if(!c->isfloat)
                c->isfloat = (t != 0) || c->isfixed;
-       if(clients)
-               clients->prev = c;
-       c->next = clients;
-       c->snext = stack;
-       stack = clients = c;
+       attach(c);
+       attachstack(c);
        c->isbanned = True;
        XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
        XMapWindow(dpy, c->win);