new stuff, fixed several issues
b1701adf
6 file(s) · +13 −12
| 44 | 44 | else |
|
| 45 | 45 | cols = rows; |
|
| 46 | 46 | ||
| 47 | - | gw = (sw - 2 * c->border) / cols; |
|
| 48 | - | gh = (sh - bh - 2 * c->border) / rows; |
|
| 47 | + | gw = (sw - 2) / cols; |
|
| 48 | + | gh = (sh - bh - 2) / rows; |
|
| 49 | 49 | ||
| 50 | 50 | for(i = j = 0, c = clients; c; c = c->next) { |
|
| 51 | 51 | c->x = i * gw; |
| 14 | 14 | LIBS = -L${PREFIX}/lib -L/usr/lib -lc -lm -L${X11LIB} -lX11 |
|
| 15 | 15 | ||
| 16 | 16 | # Linux/BSD |
|
| 17 | - | CFLAGS = -g -Wall -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \ |
|
| 17 | + | CFLAGS = -g -Wall -O2 -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \ |
|
| 18 | 18 | -DVERSION=\"${VERSION}\" |
|
| 19 | 19 | LDFLAGS = -g ${LIBS} |
|
| 20 | 20 |
| 39 | 39 | XSetForeground(dpy, b->gc, b->bg); |
|
| 40 | 40 | XFillRectangles(dpy, b->drawable, b->gc, &r, 1); |
|
| 41 | 41 | ||
| 42 | + | w = 0; |
|
| 42 | 43 | if(border) |
|
| 43 | 44 | drawborder(dpy, b); |
|
| 44 | 45 |
| 186 | 186 | if(ev->state == PropertyDelete) |
|
| 187 | 187 | return; /* ignore */ |
|
| 188 | 188 | ||
| 189 | - | if(ev->atom == wm_atom[WMProtocols]) { |
|
| 190 | - | c->proto = win_proto(c->win); |
|
| 191 | - | return; |
|
| 192 | - | } |
|
| 193 | 189 | if((c = getclient(ev->window))) { |
|
| 190 | + | if(ev->atom == wm_atom[WMProtocols]) { |
|
| 191 | + | c->proto = win_proto(c->win); |
|
| 192 | + | return; |
|
| 193 | + | } |
|
| 194 | 194 | switch (ev->atom) { |
|
| 195 | 195 | default: break; |
|
| 196 | 196 | case XA_WM_TRANSIENT_FOR: |
| 126 | 126 | perror(" failed"); |
|
| 127 | 127 | } |
|
| 128 | 128 | else { |
|
| 129 | - | n = 0; |
|
| 129 | + | l = n = 0; |
|
| 130 | 130 | close(pfd[1]); |
|
| 131 | - | while(l > n) { |
|
| 131 | + | while(n < len) { |
|
| 132 | 132 | if((l = read(pfd[0], buf + n, len - n)) < 1) |
|
| 133 | 133 | break; |
|
| 134 | 134 | n += l; |
|
| 135 | 135 | } |
|
| 136 | + | while(l > n); |
|
| 136 | 137 | close(pfd[0]); |
|
| 137 | 138 | buf[n < len ? n : len - 1] = 0; |
|
| 138 | 139 | } |
| 95 | 95 | int |
|
| 96 | 96 | win_proto(Window w) |
|
| 97 | 97 | { |
|
| 98 | - | Atom *protocols; |
|
| 98 | + | unsigned char *protocols; |
|
| 99 | 99 | long res; |
|
| 100 | 100 | int protos = 0; |
|
| 101 | 101 | int i; |
|
| 102 | 102 | ||
| 103 | - | res = win_property(w, wm_atom[WMProtocols], XA_ATOM, 20L, |
|
| 104 | - | ((unsigned char **) &protocols)); |
|
| 103 | + | res = win_property(w, wm_atom[WMProtocols], XA_ATOM, 20L, &protocols); |
|
| 105 | 104 | if(res <= 0) { |
|
| 106 | 105 | return protos; |
|
| 107 | 106 | } |