JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
using EXIT_stuff in exit() now
[dwm.git] / client.c
index 92b26a2..69189de 100644 (file)
--- a/client.c
+++ b/client.c
@@ -49,13 +49,12 @@ focus(Client *c)
        Client *old = sel;
        XEvent ev;
 
-       XFlush(dpy);
        sel = c;
        if(old && old != c)
                drawtitle(old);
        drawtitle(c);
        XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
-       XFlush(dpy);
+       XSync(dpy, False);
        while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
 }
 
@@ -193,7 +192,7 @@ lower(Client *c)
 void
 manage(Window w, XWindowAttributes *wa)
 {
-       Client *c, **l;
+       Client *c;
        XSetWindowAttributes twa;
        Window trans;
 
@@ -224,10 +223,11 @@ manage(Window w, XWindowAttributes *wa)
        settitle(c);
        settags(c);
 
-       for(l = &clients; *l; l = &(*l)->next);
-       c->next = *l; /* *l == nil */
-       *l = c;
+       c->next = clients;
+       clients = c;
 
+       XGrabButton(dpy, Button1, ControlMask, c->win, False, ButtonPressMask,
+                       GrabModeAsync, GrabModeSync, None, None);
        XGrabButton(dpy, Button1, Mod1Mask, c->win, False, ButtonPressMask,
                        GrabModeAsync, GrabModeSync, None, None);
        XGrabButton(dpy, Button2, Mod1Mask, c->win, False, ButtonPressMask,
@@ -235,8 +235,8 @@ manage(Window w, XWindowAttributes *wa)
        XGrabButton(dpy, Button3, Mod1Mask, c->win, False, ButtonPressMask,
                        GrabModeAsync, GrabModeSync, None, None);
 
-       if(!c->dofloat)
-               c->dofloat = trans
+       if(!c->isfloat)
+               c->isfloat = trans
                        || ((c->maxw == c->minw) && (c->maxh == c->minh));
 
        arrange(NULL);
@@ -250,6 +250,7 @@ manage(Window w, XWindowAttributes *wa)
                ban(c);
                XMapRaised(dpy, c->win);
                XMapRaised(dpy, c->title);
+               XSync(dpy, False);
        }
 }
 
@@ -303,7 +304,7 @@ resize(Client *c, Bool inc)
        e.above = None;
        e.override_redirect = False;
        XSendEvent(dpy, c->win, False, StructureNotifyMask, (XEvent *)&e);
-       XFlush(dpy);
+       XSync(dpy, False);
 }
 
 void
@@ -393,7 +394,7 @@ unmanage(Client *c)
 
        free(c);
 
-       XFlush(dpy);
+       XSync(dpy, False);
        XSetErrorHandler(xerror);
        XUngrabServer(dpy);
        arrange(NULL);