diff options
Diffstat (limited to '')
| -rw-r--r-- | client.c | 16 | ||||
| -rw-r--r-- | config.mk | 2 | ||||
| -rw-r--r-- | draw.c | 6 | ||||
| -rw-r--r-- | dwm.1 | 2 | ||||
| -rw-r--r-- | event.c | 82 | ||||
| -rw-r--r-- | main.c | 43 | ||||
| -rw-r--r-- | tag.c | 9 | ||||
| -rw-r--r-- | util.c | 3 |
8 files changed, 78 insertions, 85 deletions
| @@ -97,6 +97,7 @@ Client * | |||
| 97 | getclient(Window w) | 97 | getclient(Window w) |
| 98 | { | 98 | { |
| 99 | Client *c; | 99 | Client *c; |
| 100 | |||
| 100 | for(c = clients; c; c = c->next) | 101 | for(c = clients; c; c = c->next) |
| 101 | if(c->win == w) | 102 | if(c->win == w) |
| 102 | return c; | 103 | return c; |
| @@ -107,6 +108,7 @@ Client * | |||
| 107 | getctitle(Window w) | 108 | getctitle(Window w) |
| 108 | { | 109 | { |
| 109 | Client *c; | 110 | Client *c; |
| 111 | |||
| 110 | for(c = clients; c; c = c->next) | 112 | for(c = clients; c; c = c->next) |
| 111 | if(c->title == w) | 113 | if(c->title == w) |
| 112 | return c; | 114 | return c; |
| @@ -198,8 +200,8 @@ manage(Window w, XWindowAttributes *wa) | |||
| 198 | { | 200 | { |
| 199 | int diff; | 201 | int diff; |
| 200 | Client *c; | 202 | Client *c; |
| 201 | XSetWindowAttributes twa; | ||
| 202 | Window trans; | 203 | Window trans; |
| 204 | XSetWindowAttributes twa; | ||
| 203 | 205 | ||
| 204 | c = emallocz(sizeof(Client)); | 206 | c = emallocz(sizeof(Client)); |
| 205 | c->win = w; | 207 | c->win = w; |
| @@ -278,6 +280,7 @@ void | |||
| 278 | pop(Client *c) | 280 | pop(Client *c) |
| 279 | { | 281 | { |
| 280 | Client **l; | 282 | Client **l; |
| 283 | |||
| 281 | for(l = &clients; *l && *l != c; l = &(*l)->next); | 284 | for(l = &clients; *l && *l != c; l = &(*l)->next); |
| 282 | *l = c->next; | 285 | *l = c->next; |
| 283 | 286 | ||
| @@ -289,9 +292,9 @@ pop(Client *c) | |||
| 289 | void | 292 | void |
| 290 | resize(Client *c, Bool inc, Corner sticky) | 293 | resize(Client *c, Bool inc, Corner sticky) |
| 291 | { | 294 | { |
| 292 | XConfigureEvent e; | ||
| 293 | int right = c->x + c->w; | ||
| 294 | int bottom = c->y + c->h; | 295 | int bottom = c->y + c->h; |
| 296 | int right = c->x + c->w; | ||
| 297 | XConfigureEvent e; | ||
| 295 | 298 | ||
| 296 | if(inc) { | 299 | if(inc) { |
| 297 | if(c->incw) | 300 | if(c->incw) |
| @@ -337,8 +340,9 @@ resize(Client *c, Bool inc, Corner sticky) | |||
| 337 | void | 340 | void |
| 338 | setsize(Client *c) | 341 | setsize(Client *c) |
| 339 | { | 342 | { |
| 340 | XSizeHints size; | ||
| 341 | long msize; | 343 | long msize; |
| 344 | XSizeHints size; | ||
| 345 | |||
| 342 | if(!XGetWMNormalHints(dpy, c->win, &size, &msize) || !size.flags) | 346 | if(!XGetWMNormalHints(dpy, c->win, &size, &msize) || !size.flags) |
| 343 | size.flags = PSize; | 347 | size.flags = PSize; |
| 344 | c->flags = size.flags; | 348 | c->flags = size.flags; |
| @@ -375,9 +379,9 @@ setsize(Client *c) | |||
| 375 | void | 379 | void |
| 376 | settitle(Client *c) | 380 | settitle(Client *c) |
| 377 | { | 381 | { |
| 378 | XTextProperty name; | ||
| 379 | int n; | ||
| 380 | char **list = NULL; | 382 | char **list = NULL; |
| 383 | int n; | ||
| 384 | XTextProperty name; | ||
| 381 | 385 | ||
| 382 | name.nitems = 0; | 386 | name.nitems = 0; |
| 383 | c->name[0] = 0; | 387 | c->name[0] = 0; |
| @@ -7,7 +7,7 @@ MANPREFIX = ${PREFIX}/share/man | |||
| 7 | X11INC = /usr/X11R6/include | 7 | X11INC = /usr/X11R6/include |
| 8 | X11LIB = /usr/X11R6/lib | 8 | X11LIB = /usr/X11R6/lib |
| 9 | 9 | ||
| 10 | VERSION = 0.4 | 10 | VERSION = 0.5 |
| 11 | 11 | ||
| 12 | # includes and libs | 12 | # includes and libs |
| 13 | LIBS = -L${PREFIX}/lib -L/usr/lib -lc -L${X11LIB} -lX11 | 13 | LIBS = -L${PREFIX}/lib -L/usr/lib -lc -L${X11LIB} -lX11 |
| @@ -14,6 +14,7 @@ static void | |||
| 14 | drawborder(void) | 14 | drawborder(void) |
| 15 | { | 15 | { |
| 16 | XPoint points[5]; | 16 | XPoint points[5]; |
| 17 | |||
| 17 | XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); | 18 | XSetLineAttributes(dpy, dc.gc, 1, LineSolid, CapButt, JoinMiter); |
| 18 | XSetForeground(dpy, dc.gc, dc.border); | 19 | XSetForeground(dpy, dc.gc, dc.border); |
| 19 | points[0].x = dc.x; | 20 | points[0].x = dc.x; |
| @@ -33,6 +34,7 @@ static unsigned int | |||
| 33 | textnw(char *text, unsigned int len) | 34 | textnw(char *text, unsigned int len) |
| 34 | { | 35 | { |
| 35 | XRectangle r; | 36 | XRectangle r; |
| 37 | |||
| 36 | if(dc.font.set) { | 38 | if(dc.font.set) { |
| 37 | XmbTextExtents(dc.font.set, text, len, NULL, &r); | 39 | XmbTextExtents(dc.font.set, text, len, NULL, &r); |
| 38 | return r.width; | 40 | return r.width; |
| @@ -44,8 +46,8 @@ static void | |||
| 44 | drawtext(const char *text, Bool invert, Bool border) | 46 | drawtext(const char *text, Bool invert, Bool border) |
| 45 | { | 47 | { |
| 46 | int x, y, w, h; | 48 | int x, y, w, h; |
| 47 | unsigned int len; | ||
| 48 | static char buf[256]; | 49 | static char buf[256]; |
| 50 | unsigned int len; | ||
| 49 | XGCValues gcv; | 51 | XGCValues gcv; |
| 50 | XRectangle r = { dc.x, dc.y, dc.w, dc.h }; | 52 | XRectangle r = { dc.x, dc.y, dc.w, dc.h }; |
| 51 | 53 | ||
| @@ -170,8 +172,8 @@ drawtitle(Client *c) | |||
| 170 | unsigned long | 172 | unsigned long |
| 171 | getcolor(const char *colstr) | 173 | getcolor(const char *colstr) |
| 172 | { | 174 | { |
| 173 | XColor color; | ||
| 174 | Colormap cmap = DefaultColormap(dpy, screen); | 175 | Colormap cmap = DefaultColormap(dpy, screen); |
| 176 | XColor color; | ||
| 175 | 177 | ||
| 176 | XAllocNamedColor(dpy, cmap, colstr, &color, &color); | 178 | XAllocNamedColor(dpy, cmap, colstr, &color, &color); |
| 177 | return color.pixel; | 179 | return color.pixel; |
| @@ -1,4 +1,4 @@ | |||
| 1 | .TH DWM 1 dwm-0.4 | 1 | .TH DWM 1 dwm-0.5 |
| 2 | .SH NAME | 2 | .SH NAME |
| 3 | dwm \- dynamic window manager | 3 | dwm \- dynamic window manager |
| 4 | .SH SYNOPSIS | 4 | .SH SYNOPSIS |
| @@ -20,50 +20,44 @@ typedef struct { | |||
| 20 | Arg arg; | 20 | Arg arg; |
| 21 | } Key; | 21 | } Key; |
| 22 | 22 | ||
| 23 | /* | ||
| 24 | const char *browse[] = { "firefox", NULL }; | 23 | const char *browse[] = { "firefox", NULL }; |
| 25 | const char *gimp[] = { "gimp", NULL }; | 24 | const char *gimp[] = { "gimp", NULL }; |
| 26 | */ | 25 | const char *term[] = { |
| 27 | const char *term[] = { "xterm", NULL }; | ||
| 28 | /* | ||
| 29 | "urxvtc", "-tr", "+sb", "-bg", "black", "-fg", "white", "-cr", "white", | 26 | "urxvtc", "-tr", "+sb", "-bg", "black", "-fg", "white", "-cr", "white", |
| 30 | "-fn", "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*", NULL | 27 | "-fn", "-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*", NULL |
| 31 | }; | 28 | }; |
| 32 | coonst char *xlock[] = { "xlock", NULL }; | 29 | const char *xlock[] = { "xlock", NULL }; |
| 33 | */ | ||
| 34 | 30 | ||
| 35 | static Key key[] = { | 31 | static Key key[] = { |
| 36 | /* modifier key function arguments */ | 32 | /* modifier key function arguments */ |
| 37 | { ControlMask, XK_0, appendtag, { .i = Tscratch } }, | 33 | { ControlMask, XK_0, appendtag, { .i = Tscratch } }, |
| 38 | { ControlMask, XK_1, appendtag, { .i = Tdev } }, | 34 | { ControlMask, XK_1, appendtag, { .i = Tdev } }, |
| 39 | { ControlMask, XK_2, appendtag, { .i = Twww } }, | 35 | { ControlMask, XK_2, appendtag, { .i = Twww } }, |
| 40 | { ControlMask, XK_3, appendtag, { .i = Twork } }, | 36 | { ControlMask, XK_3, appendtag, { .i = Twork } }, |
| 41 | { MODKEY, XK_0, view, { .i = Tscratch } }, | 37 | { MODKEY, XK_0, view, { .i = Tscratch } }, |
| 42 | { MODKEY, XK_1, view, { .i = Tdev } }, | 38 | { MODKEY, XK_1, view, { .i = Tdev } }, |
| 43 | { MODKEY, XK_2, view, { .i = Twww } }, | 39 | { MODKEY, XK_2, view, { .i = Twww } }, |
| 44 | { MODKEY, XK_3, view, { .i = Twork } }, | 40 | { MODKEY, XK_3, view, { .i = Twork } }, |
| 45 | { MODKEY, XK_j, focusnext, { 0 } }, | 41 | { MODKEY, XK_j, focusnext, { 0 } }, |
| 46 | { MODKEY, XK_k, focusprev, { 0 } }, | 42 | { MODKEY, XK_k, focusprev, { 0 } }, |
| 47 | { MODKEY, XK_m, maximize, { 0 } }, | 43 | { MODKEY, XK_m, maximize, { 0 } }, |
| 48 | { MODKEY, XK_space, dotile, { 0 } }, | 44 | { MODKEY, XK_space, dotile, { 0 } }, |
| 49 | { MODKEY, XK_Return, zoom, { 0 } }, | 45 | { MODKEY, XK_Return, zoom, { 0 } }, |
| 50 | { ControlMask|ShiftMask,XK_0, heretag, { .i = Tscratch } }, | 46 | { ControlMask|ShiftMask,XK_0, heretag, { .i = Tscratch } }, |
| 51 | { ControlMask|ShiftMask,XK_1, heretag, { .i = Tdev } }, | 47 | { ControlMask|ShiftMask,XK_1, heretag, { .i = Tdev } }, |
| 52 | { ControlMask|ShiftMask,XK_2, heretag, { .i = Twww } }, | 48 | { ControlMask|ShiftMask,XK_2, heretag, { .i = Twww } }, |
| 53 | { ControlMask|ShiftMask,XK_3, heretag, { .i = Twork } }, | 49 | { ControlMask|ShiftMask,XK_3, heretag, { .i = Twork } }, |
| 54 | { MODKEY|ShiftMask, XK_0, replacetag, { .i = Tscratch } }, | 50 | { MODKEY|ShiftMask, XK_0, replacetag, { .i = Tscratch } }, |
| 55 | { MODKEY|ShiftMask, XK_1, replacetag, { .i = Tdev } }, | 51 | { MODKEY|ShiftMask, XK_1, replacetag, { .i = Tdev } }, |
| 56 | { MODKEY|ShiftMask, XK_2, replacetag, { .i = Twww } }, | 52 | { MODKEY|ShiftMask, XK_2, replacetag, { .i = Twww } }, |
| 57 | { MODKEY|ShiftMask, XK_3, replacetag, { .i = Twork } }, | 53 | { MODKEY|ShiftMask, XK_3, replacetag, { .i = Twork } }, |
| 58 | { MODKEY|ShiftMask, XK_c, killclient, { 0 } }, | 54 | { MODKEY|ShiftMask, XK_c, killclient, { 0 } }, |
| 59 | /* | 55 | { MODKEY|ShiftMask, XK_g, spawn, { .argv = gimp } }, |
| 60 | { MODKEY|ShiftMask, XK_g, spawn, { .argv = gimp } }, | 56 | { MODKEY|ShiftMask, XK_l, spawn, { .argv = xlock } }, |
| 61 | { MODKEY|ShiftMask, XK_l, spawn, { .argv = xlock } }, | 57 | { MODKEY|ShiftMask, XK_q, quit, { 0 } }, |
| 62 | */ | 58 | { MODKEY|ShiftMask, XK_space, dofloat, { 0 } }, |
| 63 | { MODKEY|ShiftMask, XK_q, quit, { 0 } }, | 59 | { MODKEY|ShiftMask, XK_w, spawn, { .argv = browse } }, |
| 64 | { MODKEY|ShiftMask, XK_space, dofloat, { 0 } }, | 60 | { MODKEY|ShiftMask, XK_Return, spawn, { .argv = term } }, |
| 65 | /*{ MODKEY|ShiftMask, XK_w, spawn, { .argv = browse } },*/ | ||
| 66 | { MODKEY|ShiftMask, XK_Return, spawn, { .argv = term } }, | ||
| 67 | }; | 61 | }; |
| 68 | 62 | ||
| 69 | /* static */ | 63 | /* static */ |
| @@ -71,15 +65,15 @@ static Key key[] = { | |||
| 71 | static void | 65 | static void |
| 72 | movemouse(Client *c) | 66 | movemouse(Client *c) |
| 73 | { | 67 | { |
| 74 | XEvent ev; | ||
| 75 | int x1, y1, ocx, ocy, di; | 68 | int x1, y1, ocx, ocy, di; |
| 76 | unsigned int dui; | 69 | unsigned int dui; |
| 77 | Window dummy; | 70 | Window dummy; |
| 71 | XEvent ev; | ||
| 78 | 72 | ||
| 79 | ocx = c->x; | 73 | ocx = c->x; |
| 80 | ocy = c->y; | 74 | ocy = c->y; |
| 81 | if(XGrabPointer(dpy, root, False, MouseMask, GrabModeAsync, GrabModeAsync, | 75 | if(XGrabPointer(dpy, root, False, MouseMask, GrabModeAsync, GrabModeAsync, |
| 82 | None, cursor[CurMove], CurrentTime) != GrabSuccess) | 76 | None, cursor[CurMove], CurrentTime) != GrabSuccess) |
| 83 | return; | 77 | return; |
| 84 | XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui); | 78 | XQueryPointer(dpy, root, &dummy, &dummy, &x1, &y1, &di, &di, &dui); |
| 85 | for(;;) { | 79 | for(;;) { |
| @@ -105,9 +99,9 @@ movemouse(Client *c) | |||
| 105 | static void | 99 | static void |
| 106 | resizemouse(Client *c) | 100 | resizemouse(Client *c) |
| 107 | { | 101 | { |
| 108 | XEvent ev; | ||
| 109 | int ocx, ocy; | 102 | int ocx, ocy; |
| 110 | Corner sticky; | 103 | Corner sticky; |
| 104 | XEvent ev; | ||
| 111 | 105 | ||
| 112 | ocx = c->x; | 106 | ocx = c->x; |
| 113 | ocy = c->y; | 107 | ocy = c->y; |
| @@ -146,8 +140,8 @@ buttonpress(XEvent *e) | |||
| 146 | { | 140 | { |
| 147 | int x; | 141 | int x; |
| 148 | Arg a; | 142 | Arg a; |
| 149 | XButtonPressedEvent *ev = &e->xbutton; | ||
| 150 | Client *c; | 143 | Client *c; |
| 144 | XButtonPressedEvent *ev = &e->xbutton; | ||
| 151 | 145 | ||
| 152 | if(barwin == ev->window) { | 146 | if(barwin == ev->window) { |
| 153 | switch(ev->button) { | 147 | switch(ev->button) { |
| @@ -201,9 +195,9 @@ buttonpress(XEvent *e) | |||
| 201 | static void | 195 | static void |
| 202 | configurerequest(XEvent *e) | 196 | configurerequest(XEvent *e) |
| 203 | { | 197 | { |
| 198 | Client *c; | ||
| 204 | XConfigureRequestEvent *ev = &e->xconfigurerequest; | 199 | XConfigureRequestEvent *ev = &e->xconfigurerequest; |
| 205 | XWindowChanges wc; | 200 | XWindowChanges wc; |
| 206 | Client *c; | ||
| 207 | 201 | ||
| 208 | ev->value_mask &= ~CWSibling; | 202 | ev->value_mask &= ~CWSibling; |
| 209 | if((c = getclient(ev->window))) { | 203 | if((c = getclient(ev->window))) { |
| @@ -248,8 +242,8 @@ destroynotify(XEvent *e) | |||
| 248 | static void | 242 | static void |
| 249 | enternotify(XEvent *e) | 243 | enternotify(XEvent *e) |
| 250 | { | 244 | { |
| 251 | XCrossingEvent *ev = &e->xcrossing; | ||
| 252 | Client *c; | 245 | Client *c; |
| 246 | XCrossingEvent *ev = &e->xcrossing; | ||
| 253 | 247 | ||
| 254 | if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) | 248 | if(ev->mode != NotifyNormal || ev->detail == NotifyInferior) |
| 255 | return; | 249 | return; |
| @@ -263,8 +257,8 @@ enternotify(XEvent *e) | |||
| 263 | static void | 257 | static void |
| 264 | expose(XEvent *e) | 258 | expose(XEvent *e) |
| 265 | { | 259 | { |
| 266 | XExposeEvent *ev = &e->xexpose; | ||
| 267 | Client *c; | 260 | Client *c; |
| 261 | XExposeEvent *ev = &e->xexpose; | ||
| 268 | 262 | ||
| 269 | if(ev->count == 0) { | 263 | if(ev->count == 0) { |
| 270 | if(barwin == ev->window) | 264 | if(barwin == ev->window) |
| @@ -277,10 +271,10 @@ expose(XEvent *e) | |||
| 277 | static void | 271 | static void |
| 278 | keypress(XEvent *e) | 272 | keypress(XEvent *e) |
| 279 | { | 273 | { |
| 280 | XKeyEvent *ev = &e->xkey; | ||
| 281 | static unsigned int len = key ? sizeof(key) / sizeof(key[0]) : 0; | 274 | static unsigned int len = key ? sizeof(key) / sizeof(key[0]) : 0; |
| 282 | unsigned int i; | 275 | unsigned int i; |
| 283 | KeySym keysym; | 276 | KeySym keysym; |
| 277 | XKeyEvent *ev = &e->xkey; | ||
| 284 | 278 | ||
| 285 | keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); | 279 | keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); |
| 286 | for(i = 0; i < len; i++) | 280 | for(i = 0; i < len; i++) |
| @@ -303,8 +297,8 @@ leavenotify(XEvent *e) | |||
| 303 | static void | 297 | static void |
| 304 | maprequest(XEvent *e) | 298 | maprequest(XEvent *e) |
| 305 | { | 299 | { |
| 306 | XMapRequestEvent *ev = &e->xmaprequest; | ||
| 307 | static XWindowAttributes wa; | 300 | static XWindowAttributes wa; |
| 301 | XMapRequestEvent *ev = &e->xmaprequest; | ||
| 308 | 302 | ||
| 309 | if(!XGetWindowAttributes(dpy, ev->window, &wa)) | 303 | if(!XGetWindowAttributes(dpy, ev->window, &wa)) |
| 310 | return; | 304 | return; |
| @@ -322,9 +316,9 @@ maprequest(XEvent *e) | |||
| 322 | static void | 316 | static void |
| 323 | propertynotify(XEvent *e) | 317 | propertynotify(XEvent *e) |
| 324 | { | 318 | { |
| 325 | XPropertyEvent *ev = &e->xproperty; | ||
| 326 | Window trans; | ||
| 327 | Client *c; | 319 | Client *c; |
| 320 | Window trans; | ||
| 321 | XPropertyEvent *ev = &e->xproperty; | ||
| 328 | 322 | ||
| 329 | if(ev->state == PropertyDelete) | 323 | if(ev->state == PropertyDelete) |
| 330 | return; /* ignore */ | 324 | return; /* ignore */ |
| @@ -17,8 +17,8 @@ | |||
| 17 | 17 | ||
| 18 | /* static */ | 18 | /* static */ |
| 19 | 19 | ||
| 20 | static Bool otherwm; | ||
| 21 | static int (*xerrorxlib)(Display *, XErrorEvent *); | 20 | static int (*xerrorxlib)(Display *, XErrorEvent *); |
| 21 | static Bool otherwm; | ||
| 22 | 22 | ||
| 23 | static void | 23 | static void |
| 24 | cleanup() | 24 | cleanup() |
| @@ -34,9 +34,8 @@ static void | |||
| 34 | scan() | 34 | scan() |
| 35 | { | 35 | { |
| 36 | unsigned int i, num; | 36 | unsigned int i, num; |
| 37 | Window *wins; | 37 | Window *wins, d1, d2; |
| 38 | XWindowAttributes wa; | 38 | XWindowAttributes wa; |
| 39 | Window d1, d2; | ||
| 40 | 39 | ||
| 41 | if(XQueryTree(dpy, root, &d1, &d2, &wins, &num)) { | 40 | if(XQueryTree(dpy, root, &d1, &d2, &wins, &num)) { |
| 42 | for(i = 0; i < num; i++) { | 41 | for(i = 0; i < num; i++) { |
| @@ -55,10 +54,9 @@ scan() | |||
| 55 | static int | 54 | static int |
| 56 | win_property(Window w, Atom a, Atom t, long l, unsigned char **prop) | 55 | win_property(Window w, Atom a, Atom t, long l, unsigned char **prop) |
| 57 | { | 56 | { |
| 58 | Atom real; | 57 | int status, format; |
| 59 | int format; | ||
| 60 | unsigned long res, extra; | 58 | unsigned long res, extra; |
| 61 | int status; | 59 | Atom real; |
| 62 | 60 | ||
| 63 | status = XGetWindowProperty(dpy, w, a, 0L, l, False, t, &real, &format, | 61 | status = XGetWindowProperty(dpy, w, a, 0L, l, False, t, &real, &format, |
| 64 | &res, &extra, prop); | 62 | &res, &extra, prop); |
| @@ -101,10 +99,10 @@ Window root, barwin; | |||
| 101 | int | 99 | int |
| 102 | getproto(Window w) | 100 | getproto(Window w) |
| 103 | { | 101 | { |
| 104 | unsigned char *protocols; | ||
| 105 | long res; | ||
| 106 | int protos = 0; | 102 | int protos = 0; |
| 107 | int i; | 103 | int i; |
| 104 | long res; | ||
| 105 | unsigned char *protocols; | ||
| 108 | 106 | ||
| 109 | res = win_property(w, wmatom[WMProtocols], XA_ATOM, 20L, &protocols); | 107 | res = win_property(w, wmatom[WMProtocols], XA_ATOM, 20L, &protocols); |
| 110 | if(res <= 0) { | 108 | if(res <= 0) { |
| @@ -148,21 +146,15 @@ int | |||
| 148 | xerror(Display *dpy, XErrorEvent *ee) | 146 | xerror(Display *dpy, XErrorEvent *ee) |
| 149 | { | 147 | { |
| 150 | if(ee->error_code == BadWindow | 148 | if(ee->error_code == BadWindow |
| 151 | || (ee->request_code == X_SetInputFocus | 149 | || (ee->request_code == X_SetInputFocus && ee->error_code == BadMatch) |
| 152 | && ee->error_code == BadMatch) | 150 | || (ee->request_code == X_PolyText8 && ee->error_code == BadDrawable) |
| 153 | || (ee->request_code == X_PolyText8 | 151 | || (ee->request_code == X_PolyFillRectangle && ee->error_code == BadDrawable) |
| 154 | && ee->error_code == BadDrawable) | 152 | || (ee->request_code == X_PolySegment && ee->error_code == BadDrawable) |
| 155 | || (ee->request_code == X_PolyFillRectangle | 153 | || (ee->request_code == X_ConfigureWindow && ee->error_code == BadMatch) |
| 156 | && ee->error_code == BadDrawable) | 154 | || (ee->request_code == X_GrabKey && ee->error_code == BadAccess)) |
| 157 | || (ee->request_code == X_PolySegment | ||
| 158 | && ee->error_code == BadDrawable) | ||
| 159 | || (ee->request_code == X_ConfigureWindow | ||
| 160 | && ee->error_code == BadMatch) | ||
| 161 | || (ee->request_code == X_GrabKey | ||
| 162 | && ee->error_code == BadAccess)) | ||
| 163 | return 0; | 155 | return 0; |
| 164 | fprintf(stderr, "dwm: fatal error: request code=%d, error code=%d\n", | 156 | fprintf(stderr, "dwm: fatal error: request code=%d, error code=%d\n", |
| 165 | ee->request_code, ee->error_code); | 157 | ee->request_code, ee->error_code); |
| 166 | return xerrorxlib(dpy, ee); /* may call exit() */ | 158 | return xerrorxlib(dpy, ee); /* may call exit() */ |
| 167 | } | 159 | } |
| 168 | 160 | ||
| @@ -170,12 +162,12 @@ int | |||
| 170 | main(int argc, char *argv[]) | 162 | main(int argc, char *argv[]) |
| 171 | { | 163 | { |
| 172 | int i, n; | 164 | int i, n; |
| 173 | fd_set rd; | ||
| 174 | XSetWindowAttributes wa; | ||
| 175 | unsigned int mask; | 165 | unsigned int mask; |
| 166 | fd_set rd; | ||
| 176 | Bool readstdin = True; | 167 | Bool readstdin = True; |
| 177 | Window w; | 168 | Window w; |
| 178 | XEvent ev; | 169 | XEvent ev; |
| 170 | XSetWindowAttributes wa; | ||
| 179 | 171 | ||
| 180 | for(i = 1; (i < argc) && (argv[i][0] == '-'); i++) { | 172 | for(i = 1; (i < argc) && (argv[i][0] == '-'); i++) { |
| 181 | switch (argv[i][1]) { | 173 | switch (argv[i][1]) { |
| @@ -254,14 +246,11 @@ main(int argc, char *argv[]) | |||
| 254 | 246 | ||
| 255 | issel = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask); | 247 | issel = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask); |
| 256 | 248 | ||
| 257 | wa.event_mask = SubstructureRedirectMask | EnterWindowMask \ | 249 | wa.event_mask = SubstructureRedirectMask | EnterWindowMask | LeaveWindowMask; |
| 258 | | LeaveWindowMask; | ||
| 259 | wa.cursor = cursor[CurNormal]; | 250 | wa.cursor = cursor[CurNormal]; |
| 260 | |||
| 261 | XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa); | 251 | XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa); |
| 262 | 252 | ||
| 263 | strcpy(stext, "dwm-"VERSION); | 253 | strcpy(stext, "dwm-"VERSION); |
| 264 | |||
| 265 | scan(); | 254 | scan(); |
| 266 | 255 | ||
| 267 | /* main event loop, reads status text from stdin as well */ | 256 | /* main event loop, reads status text from stdin as well */ |
| @@ -20,9 +20,9 @@ typedef struct { | |||
| 20 | 20 | ||
| 21 | /* CUSTOMIZE */ | 21 | /* CUSTOMIZE */ |
| 22 | static Rule rule[] = { | 22 | static Rule rule[] = { |
| 23 | /* class instance tags isfloat */ | 23 | /* class:instance tags isfloat */ |
| 24 | { "Firefox.*", { [Twww] = "www" }, False }, | 24 | { "Firefox.*", { [Twww] = "www" }, False }, |
| 25 | { "Gimp.*", { 0 }, True}, | 25 | { "Gimp.*", { 0 }, True}, |
| 26 | }; | 26 | }; |
| 27 | 27 | ||
| 28 | /* extern */ | 28 | /* extern */ |
| @@ -71,8 +71,8 @@ dofloat(Arg *arg) | |||
| 71 | void | 71 | void |
| 72 | dotile(Arg *arg) | 72 | dotile(Arg *arg) |
| 73 | { | 73 | { |
| 74 | Client *c; | ||
| 75 | int n, i, w, h; | 74 | int n, i, w, h; |
| 75 | Client *c; | ||
| 76 | 76 | ||
| 77 | w = sw - mw; | 77 | w = sw - mw; |
| 78 | arrange = dotile; | 78 | arrange = dotile; |
| @@ -161,6 +161,7 @@ void | |||
| 161 | replacetag(Arg *arg) | 161 | replacetag(Arg *arg) |
| 162 | { | 162 | { |
| 163 | int i; | 163 | int i; |
| 164 | |||
| 164 | if(!sel) | 165 | if(!sel) |
| 165 | return; | 166 | return; |
| 166 | 167 | ||
| @@ -26,6 +26,7 @@ void * | |||
| 26 | emallocz(unsigned int size) | 26 | emallocz(unsigned int size) |
| 27 | { | 27 | { |
| 28 | void *res = calloc(1, size); | 28 | void *res = calloc(1, size); |
| 29 | |||
| 29 | if(!res) | 30 | if(!res) |
| 30 | bad_malloc(size); | 31 | bad_malloc(size); |
| 31 | return res; | 32 | return res; |
| @@ -34,6 +35,7 @@ emallocz(unsigned int size) | |||
| 34 | void | 35 | void |
| 35 | eprint(const char *errstr, ...) { | 36 | eprint(const char *errstr, ...) { |
| 36 | va_list ap; | 37 | va_list ap; |
| 38 | |||
| 37 | va_start(ap, errstr); | 39 | va_start(ap, errstr); |
| 38 | vfprintf(stderr, errstr, ap); | 40 | vfprintf(stderr, errstr, ap); |
| 39 | va_end(ap); | 41 | va_end(ap); |
| @@ -44,6 +46,7 @@ void | |||
| 44 | spawn(Arg *arg) | 46 | spawn(Arg *arg) |
| 45 | { | 47 | { |
| 46 | char **argv = (char **)arg->argv; | 48 | char **argv = (char **)arg->argv; |
| 49 | |||
| 47 | if(!argv || !argv[0]) | 50 | if(!argv || !argv[0]) |
| 48 | return; | 51 | return; |
| 49 | if(fork() == 0) { | 52 | if(fork() == 0) { |
