JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
new stuff, fixed several issues
authorAnselm R. Garbe <garbeam@wmii.de>
Wed, 12 Jul 2006 15:50:31 +0000 (17:50 +0200)
committerAnselm R. Garbe <garbeam@wmii.de>
Wed, 12 Jul 2006 15:50:31 +0000 (17:50 +0200)
client.c
config.mk
draw.c
event.c
util.c
wm.c

index e9b83fe..95ec3a6 100644 (file)
--- a/client.c
+++ b/client.c
@@ -44,8 +44,8 @@ arrange(void *aux)
        else
                cols = rows;
 
        else
                cols = rows;
 
-       gw = (sw - 2 * c->border)  / cols;
-       gh = (sh - bh - 2 * c->border) / rows;
+       gw = (sw - 2)  / cols;
+       gh = (sh - bh - 2) / rows;
 
        for(i = j = 0, c = clients; c; c = c->next) {
                c->x = i * gw;
 
        for(i = j = 0, c = clients; c; c = c->next) {
                c->x = i * gw;
index 0e5d372..41cb070 100644 (file)
--- a/config.mk
+++ b/config.mk
@@ -14,7 +14,7 @@ VERSION = 0.0
 LIBS = -L${PREFIX}/lib -L/usr/lib -lc -lm -L${X11LIB} -lX11
 
 # Linux/BSD
 LIBS = -L${PREFIX}/lib -L/usr/lib -lc -lm -L${X11LIB} -lX11
 
 # Linux/BSD
-CFLAGS = -g -Wall -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \
+CFLAGS = -g -Wall -O2 -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \
        -DVERSION=\"${VERSION}\"
 LDFLAGS = -g ${LIBS}
 
        -DVERSION=\"${VERSION}\"
 LDFLAGS = -g ${LIBS}
 
diff --git a/draw.c b/draw.c
index c148362..68ece01 100644 (file)
--- a/draw.c
+++ b/draw.c
@@ -39,6 +39,7 @@ draw(Display *dpy, Brush *b, Bool border, const char *text)
        XSetForeground(dpy, b->gc, b->bg);
        XFillRectangles(dpy, b->drawable, b->gc, &r, 1);
 
        XSetForeground(dpy, b->gc, b->bg);
        XFillRectangles(dpy, b->drawable, b->gc, &r, 1);
 
+       w = 0;
        if(border)
                drawborder(dpy, b);
 
        if(border)
                drawborder(dpy, b);
 
diff --git a/event.c b/event.c
index 93007df..37196d1 100644 (file)
--- a/event.c
+++ b/event.c
@@ -186,11 +186,11 @@ propertynotify(XEvent *e)
        if(ev->state == PropertyDelete)
                return; /* ignore */
 
        if(ev->state == PropertyDelete)
                return; /* ignore */
 
-       if(ev->atom == wm_atom[WMProtocols]) {
-               c->proto = win_proto(c->win);
-               return;
-       }
        if((c = getclient(ev->window))) {
        if((c = getclient(ev->window))) {
+               if(ev->atom == wm_atom[WMProtocols]) {
+                       c->proto = win_proto(c->win);
+                       return;
+               }
                switch (ev->atom) {
                        default: break;
                        case XA_WM_TRANSIENT_FOR:
                switch (ev->atom) {
                        default: break;
                        case XA_WM_TRANSIENT_FOR:
diff --git a/util.c b/util.c
index 9da8f52..3f41b3c 100644 (file)
--- a/util.c
+++ b/util.c
@@ -126,13 +126,14 @@ pipe_spawn(char *buf, unsigned int len, Display *dpy, char *argv[])
                perror(" failed");
        }
        else {
                perror(" failed");
        }
        else {
-               n = 0;
+               l = n = 0;
                close(pfd[1]);
                close(pfd[1]);
-               while(l > n) {
+               while(n < len) {
                        if((l = read(pfd[0], buf + n, len - n)) < 1)
                                break;
                        n += l;
                }
                        if((l = read(pfd[0], buf + n, len - n)) < 1)
                                break;
                        n += l;
                }
+               while(l > n);
                close(pfd[0]);
                buf[n < len ? n : len - 1] = 0;
        }
                close(pfd[0]);
                buf[n < len ? n : len - 1] = 0;
        }
diff --git a/wm.c b/wm.c
index 02b9a68..ed40a8b 100644 (file)
--- a/wm.c
+++ b/wm.c
@@ -95,13 +95,12 @@ win_property(Window w, Atom a, Atom t, long l, unsigned char **prop)
 int
 win_proto(Window w)
 {
 int
 win_proto(Window w)
 {
-       Atom *protocols;
+       unsigned char *protocols;
        long res;
        int protos = 0;
        int i;
 
        long res;
        int protos = 0;
        int i;
 
-       res = win_property(w, wm_atom[WMProtocols], XA_ATOM, 20L,
-                       ((unsigned char **) &protocols));
+       res = win_property(w, wm_atom[WMProtocols], XA_ATOM, 20L, &protocols);
        if(res <= 0) {
                return protos;
        }
        if(res <= 0) {
                return protos;
        }