diff options
| author | Anselm R. Garbe <arg@10kloc.org> | 2006-09-12 10:57:28 +0200 |
|---|---|---|
| committer | Anselm R. Garbe <arg@10kloc.org> | 2006-09-12 10:57:28 +0200 |
| commit | ca65478c8968434c78aacf4a102ccbbe4a66ad9e (patch) | |
| tree | a7b8e02be5fb457e1c3f0e646e212911048390b6 | |
| parent | some more simplifications of intro comment in dwm.h, this should suffice for ... (diff) | |
| download | dwm-ca65478c8968434c78aacf4a102ccbbe4a66ad9e.tar.gz dwm-ca65478c8968434c78aacf4a102ccbbe4a66ad9e.zip | |
removed a bunch of lines through making function signatures more consistent with my style ( { does not belong to a new line, if function args are single-lined)
Diffstat (limited to '')
| -rw-r--r-- | client.c | 50 | ||||
| -rw-r--r-- | draw.c | 24 | ||||
| -rw-r--r-- | event.c | 59 | ||||
| -rw-r--r-- | main.c | 30 | ||||
| -rw-r--r-- | tag.c | 18 | ||||
| -rw-r--r-- | util.c | 12 | ||||
| -rw-r--r-- | view.c | 48 |
7 files changed, 83 insertions, 158 deletions
| @@ -11,16 +11,14 @@ | |||
| 11 | /* static functions */ | 11 | /* static functions */ |
| 12 | 12 | ||
| 13 | static void | 13 | static void |
| 14 | detachstack(Client *c) | 14 | detachstack(Client *c) { |
| 15 | { | ||
| 16 | Client **tc; | 15 | Client **tc; |
| 17 | for(tc=&stack; *tc && *tc != c; tc=&(*tc)->snext); | 16 | for(tc=&stack; *tc && *tc != c; tc=&(*tc)->snext); |
| 18 | *tc = c->snext; | 17 | *tc = c->snext; |
| 19 | } | 18 | } |
| 20 | 19 | ||
| 21 | static void | 20 | static void |
| 22 | grabbuttons(Client *c, Bool focused) | 21 | grabbuttons(Client *c, Bool focused) { |
| 23 | { | ||
| 24 | XUngrabButton(dpy, AnyButton, AnyModifier, c->win); | 22 | XUngrabButton(dpy, AnyButton, AnyModifier, c->win); |
| 25 | 23 | ||
| 26 | if(focused) { | 24 | if(focused) { |
| @@ -54,12 +52,10 @@ grabbuttons(Client *c, Bool focused) | |||
| 54 | else | 52 | else |
| 55 | XGrabButton(dpy, AnyButton, AnyModifier, c->win, False, BUTTONMASK, | 53 | XGrabButton(dpy, AnyButton, AnyModifier, c->win, False, BUTTONMASK, |
| 56 | GrabModeAsync, GrabModeSync, None, None); | 54 | GrabModeAsync, GrabModeSync, None, None); |
| 57 | |||
| 58 | } | 55 | } |
| 59 | 56 | ||
| 60 | static void | 57 | static void |
| 61 | resizetitle(Client *c) | 58 | resizetitle(Client *c) { |
| 62 | { | ||
| 63 | c->tw = textw(c->name); | 59 | c->tw = textw(c->name); |
| 64 | if(c->tw > c->w) | 60 | if(c->tw > c->w) |
| 65 | c->tw = c->w + 2; | 61 | c->tw = c->w + 2; |
| @@ -69,27 +65,23 @@ resizetitle(Client *c) | |||
| 69 | XMoveResizeWindow(dpy, c->twin, c->tx, c->ty, c->tw, c->th); | 65 | XMoveResizeWindow(dpy, c->twin, c->tx, c->ty, c->tw, c->th); |
| 70 | else | 66 | else |
| 71 | XMoveResizeWindow(dpy, c->twin, c->tx + 2 * sw, c->ty, c->tw, c->th); | 67 | XMoveResizeWindow(dpy, c->twin, c->tx + 2 * sw, c->ty, c->tw, c->th); |
| 72 | |||
| 73 | } | 68 | } |
| 74 | 69 | ||
| 75 | static int | 70 | static int |
| 76 | xerrordummy(Display *dsply, XErrorEvent *ee) | 71 | xerrordummy(Display *dsply, XErrorEvent *ee) { |
| 77 | { | ||
| 78 | return 0; | 72 | return 0; |
| 79 | } | 73 | } |
| 80 | 74 | ||
| 81 | /* extern functions */ | 75 | /* extern functions */ |
| 82 | 76 | ||
| 83 | void | 77 | void |
| 84 | ban(Client *c) | 78 | ban(Client *c) { |
| 85 | { | ||
| 86 | XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); | 79 | XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); |
| 87 | XMoveWindow(dpy, c->twin, c->tx + 2 * sw, c->ty); | 80 | XMoveWindow(dpy, c->twin, c->tx + 2 * sw, c->ty); |
| 88 | } | 81 | } |
| 89 | 82 | ||
| 90 | void | 83 | void |
| 91 | focus(Client *c) | 84 | focus(Client *c) { |
| 92 | { | ||
| 93 | Client *old; | 85 | Client *old; |
| 94 | 86 | ||
| 95 | if(!issel) | 87 | if(!issel) |
| @@ -119,8 +111,7 @@ focus(Client *c) | |||
| 119 | } | 111 | } |
| 120 | 112 | ||
| 121 | Client * | 113 | Client * |
| 122 | getclient(Window w) | 114 | getclient(Window w) { |
| 123 | { | ||
| 124 | Client *c; | 115 | Client *c; |
| 125 | 116 | ||
| 126 | for(c = clients; c; c = c->next) | 117 | for(c = clients; c; c = c->next) |
| @@ -130,8 +121,7 @@ getclient(Window w) | |||
| 130 | } | 121 | } |
| 131 | 122 | ||
| 132 | Client * | 123 | Client * |
| 133 | getctitle(Window w) | 124 | getctitle(Window w) { |
| 134 | { | ||
| 135 | Client *c; | 125 | Client *c; |
| 136 | 126 | ||
| 137 | for(c = clients; c; c = c->next) | 127 | for(c = clients; c; c = c->next) |
| @@ -141,8 +131,7 @@ getctitle(Window w) | |||
| 141 | } | 131 | } |
| 142 | 132 | ||
| 143 | void | 133 | void |
| 144 | gravitate(Client *c, Bool invert) | 134 | gravitate(Client *c, Bool invert) { |
| 145 | { | ||
| 146 | int dx = 0, dy = 0; | 135 | int dx = 0, dy = 0; |
| 147 | 136 | ||
| 148 | switch(c->grav) { | 137 | switch(c->grav) { |
| @@ -196,8 +185,7 @@ gravitate(Client *c, Bool invert) | |||
| 196 | } | 185 | } |
| 197 | 186 | ||
| 198 | void | 187 | void |
| 199 | killclient(Arg *arg) | 188 | killclient(Arg *arg) { |
| 200 | { | ||
| 201 | if(!sel) | 189 | if(!sel) |
| 202 | return; | 190 | return; |
| 203 | if(sel->proto & PROTODELWIN) | 191 | if(sel->proto & PROTODELWIN) |
| @@ -207,8 +195,7 @@ killclient(Arg *arg) | |||
| 207 | } | 195 | } |
| 208 | 196 | ||
| 209 | void | 197 | void |
| 210 | manage(Window w, XWindowAttributes *wa) | 198 | manage(Window w, XWindowAttributes *wa) { |
| 211 | { | ||
| 212 | Client *c; | 199 | Client *c; |
| 213 | Window trans; | 200 | Window trans; |
| 214 | XSetWindowAttributes twa; | 201 | XSetWindowAttributes twa; |
| @@ -270,8 +257,7 @@ manage(Window w, XWindowAttributes *wa) | |||
| 270 | } | 257 | } |
| 271 | 258 | ||
| 272 | void | 259 | void |
| 273 | resize(Client *c, Bool sizehints, Corner sticky) | 260 | resize(Client *c, Bool sizehints, Corner sticky) { |
| 274 | { | ||
| 275 | int bottom = c->y + c->h; | 261 | int bottom = c->y + c->h; |
| 276 | int right = c->x + c->w; | 262 | int right = c->x + c->w; |
| 277 | XWindowChanges wc; | 263 | XWindowChanges wc; |
| @@ -309,8 +295,7 @@ resize(Client *c, Bool sizehints, Corner sticky) | |||
| 309 | } | 295 | } |
| 310 | 296 | ||
| 311 | void | 297 | void |
| 312 | updatesize(Client *c) | 298 | updatesize(Client *c) { |
| 313 | { | ||
| 314 | long msize; | 299 | long msize; |
| 315 | XSizeHints size; | 300 | XSizeHints size; |
| 316 | 301 | ||
| @@ -348,8 +333,7 @@ updatesize(Client *c) | |||
| 348 | } | 333 | } |
| 349 | 334 | ||
| 350 | void | 335 | void |
| 351 | updatetitle(Client *c) | 336 | updatetitle(Client *c) { |
| 352 | { | ||
| 353 | char **list = NULL; | 337 | char **list = NULL; |
| 354 | int n; | 338 | int n; |
| 355 | XTextProperty name; | 339 | XTextProperty name; |
| @@ -376,8 +360,7 @@ updatetitle(Client *c) | |||
| 376 | } | 360 | } |
| 377 | 361 | ||
| 378 | void | 362 | void |
| 379 | togglemax(Arg *arg) | 363 | togglemax(Arg *arg) { |
| 380 | { | ||
| 381 | int ox, oy, ow, oh; | 364 | int ox, oy, ow, oh; |
| 382 | Client *c; | 365 | Client *c; |
| 383 | XEvent ev; | 366 | XEvent ev; |
| @@ -412,8 +395,7 @@ togglemax(Arg *arg) | |||
| 412 | } | 395 | } |
| 413 | 396 | ||
| 414 | void | 397 | void |
| 415 | unmanage(Client *c) | 398 | unmanage(Client *c) { |
| 416 | { | ||
| 417 | Client *nc; | 399 | Client *nc; |
| 418 | 400 | ||
| 419 | XGrabServer(dpy); | 401 | XGrabServer(dpy); |
| @@ -10,8 +10,7 @@ | |||
| 10 | /* static */ | 10 | /* static */ |
| 11 | 11 | ||
| 12 | static unsigned int | 12 | static unsigned int |
| 13 | textnw(const char *text, unsigned int len) | 13 | textnw(const char *text, unsigned int len) { |
| 14 | { | ||
| 15 | XRectangle r; | 14 | XRectangle r; |
| 16 | 15 | ||
| 17 | if(dc.font.set) { | 16 | if(dc.font.set) { |
| @@ -22,8 +21,7 @@ textnw(const char *text, unsigned int len) | |||
| 22 | } | 21 | } |
| 23 | 22 | ||
| 24 | static void | 23 | static void |
| 25 | drawtext(const char *text, unsigned long col[ColLast], Bool highlight) | 24 | drawtext(const char *text, unsigned long col[ColLast], Bool highlight) { |
| 26 | { | ||
| 27 | int x, y, w, h; | 25 | int x, y, w, h; |
| 28 | static char buf[256]; | 26 | static char buf[256]; |
| 29 | unsigned int len, olen; | 27 | unsigned int len, olen; |
| @@ -82,8 +80,7 @@ drawtext(const char *text, unsigned long col[ColLast], Bool highlight) | |||
| 82 | /* extern */ | 80 | /* extern */ |
| 83 | 81 | ||
| 84 | void | 82 | void |
| 85 | drawall() | 83 | drawall() { |
| 86 | { | ||
| 87 | Client *c; | 84 | Client *c; |
| 88 | 85 | ||
| 89 | for(c = clients; c; c = getnext(c->next)) | 86 | for(c = clients; c; c = getnext(c->next)) |
| @@ -92,8 +89,7 @@ drawall() | |||
| 92 | } | 89 | } |
| 93 | 90 | ||
| 94 | void | 91 | void |
| 95 | drawstatus() | 92 | drawstatus() { |
| 96 | { | ||
| 97 | int i, x; | 93 | int i, x; |
| 98 | 94 | ||
| 99 | dc.x = dc.y = 0; | 95 | dc.x = dc.y = 0; |
| @@ -131,8 +127,7 @@ drawstatus() | |||
| 131 | } | 127 | } |
| 132 | 128 | ||
| 133 | void | 129 | void |
| 134 | drawtitle(Client *c) | 130 | drawtitle(Client *c) { |
| 135 | { | ||
| 136 | if(c == sel && issel) { | 131 | if(c == sel && issel) { |
| 137 | drawstatus(); | 132 | drawstatus(); |
| 138 | XUnmapWindow(dpy, c->twin); | 133 | XUnmapWindow(dpy, c->twin); |
| @@ -150,8 +145,7 @@ drawtitle(Client *c) | |||
| 150 | } | 145 | } |
| 151 | 146 | ||
| 152 | unsigned long | 147 | unsigned long |
| 153 | getcolor(const char *colstr) | 148 | getcolor(const char *colstr) { |
| 154 | { | ||
| 155 | Colormap cmap = DefaultColormap(dpy, screen); | 149 | Colormap cmap = DefaultColormap(dpy, screen); |
| 156 | XColor color; | 150 | XColor color; |
| 157 | 151 | ||
| @@ -160,8 +154,7 @@ getcolor(const char *colstr) | |||
| 160 | } | 154 | } |
| 161 | 155 | ||
| 162 | void | 156 | void |
| 163 | setfont(const char *fontstr) | 157 | setfont(const char *fontstr) { |
| 164 | { | ||
| 165 | char **missing, *def; | 158 | char **missing, *def; |
| 166 | int i, n; | 159 | int i, n; |
| 167 | 160 | ||
| @@ -211,7 +204,6 @@ setfont(const char *fontstr) | |||
| 211 | } | 204 | } |
| 212 | 205 | ||
| 213 | unsigned int | 206 | unsigned int |
| 214 | textw(const char *text) | 207 | textw(const char *text) { |
| 215 | { | ||
| 216 | return textnw(text, strlen(text)) + dc.font.height; | 208 | return textnw(text, strlen(text)) + dc.font.height; |
| 217 | } | 209 | } |
| @@ -21,8 +21,7 @@ KEYS | |||
| 21 | #define CLEANMASK(mask) (mask & ~(numlockmask | LockMask)) | 21 | #define CLEANMASK(mask) (mask & ~(numlockmask | LockMask)) |
| 22 | 22 | ||
| 23 | static void | 23 | static void |
| 24 | movemouse(Client *c) | 24 | movemouse(Client *c) { |
| 25 | { | ||
| 26 | int x1, y1, ocx, ocy, di; | 25 | int x1, y1, ocx, ocy, di; |
| 27 | unsigned int dui; | 26 | unsigned int dui; |
| 28 | Window dummy; | 27 | Window dummy; |
| @@ -37,7 +36,8 @@ movemouse(Client *c) | |||
| 37 | for(;;) { | 36 | for(;;) { |
| 38 | XMaskEvent(dpy, MOUSEMASK | ExposureMask, &ev); | 37 | XMaskEvent(dpy, MOUSEMASK | ExposureMask, &ev); |
| 39 | switch (ev.type) { | 38 | switch (ev.type) { |
| 40 | default: break; | 39 | default: |
| 40 | break; | ||
| 41 | case Expose: | 41 | case Expose: |
| 42 | handler[Expose](&ev); | 42 | handler[Expose](&ev); |
| 43 | break; | 43 | break; |
| @@ -55,8 +55,7 @@ movemouse(Client *c) | |||
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | static void | 57 | static void |
| 58 | resizemouse(Client *c) | 58 | resizemouse(Client *c) { |
| 59 | { | ||
| 60 | int ocx, ocy; | 59 | int ocx, ocy; |
| 61 | int nw, nh; | 60 | int nw, nh; |
| 62 | Corner sticky; | 61 | Corner sticky; |
| @@ -71,7 +70,8 @@ resizemouse(Client *c) | |||
| 71 | for(;;) { | 70 | for(;;) { |
| 72 | XMaskEvent(dpy, MOUSEMASK | ExposureMask, &ev); | 71 | XMaskEvent(dpy, MOUSEMASK | ExposureMask, &ev); |
| 73 | switch(ev.type) { | 72 | switch(ev.type) { |
| 74 | default: break; | 73 | default: |
| 74 | break; | ||
| 75 | case Expose: | 75 | case Expose: |
| 76 | handler[Expose](&ev); | 76 | handler[Expose](&ev); |
| 77 | break; | 77 | break; |
| @@ -97,8 +97,7 @@ resizemouse(Client *c) | |||
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | static void | 99 | static void |
| 100 | buttonpress(XEvent *e) | 100 | buttonpress(XEvent *e) { |
| 101 | { | ||
| 102 | int x; | 101 | int x; |
| 103 | Arg a; | 102 | Arg a; |
| 104 | Client *c; | 103 | Client *c; |
| @@ -147,8 +146,7 @@ buttonpress(XEvent *e) | |||
| 147 | } | 146 | } |
| 148 | 147 | ||
| 149 | static void | 148 | static void |
| 150 | synconfig(Client *c, int x, int y, int w, int h, unsigned int border) | 149 | synconfig(Client *c, int x, int y, int w, int h, unsigned int border) { |
| 151 | { | ||
| 152 | XEvent synev; | 150 | XEvent synev; |
| 153 | 151 | ||
| 154 | synev.type = ConfigureNotify; | 152 | synev.type = ConfigureNotify; |
| @@ -165,8 +163,7 @@ synconfig(Client *c, int x, int y, int w, int h, unsigned int border) | |||
| 165 | } | 163 | } |
| 166 | 164 | ||
| 167 | static void | 165 | static void |
| 168 | configurerequest(XEvent *e) | 166 | configurerequest(XEvent *e) { |
| 169 | { | ||
| 170 | unsigned long newmask; | 167 | unsigned long newmask; |
| 171 | Client *c; | 168 | Client *c; |
| 172 | XConfigureRequestEvent *ev = &e->xconfigurerequest; | 169 | XConfigureRequestEvent *ev = &e->xconfigurerequest; |
| @@ -219,8 +216,7 @@ configurerequest(XEvent *e) | |||
| 219 | } | 216 | } |
| 220 | 217 | ||
| 221 | static void | 218 | static void |
| 222 | destroynotify(XEvent *e) | 219 | destroynotify(XEvent *e) { |
| 223 | { | ||
| 224 | Client *c; | 220 | Client *c; |
| 225 | XDestroyWindowEvent *ev = &e->xdestroywindow; | 221 | XDestroyWindowEvent *ev = &e->xdestroywindow; |
| 226 | 222 | ||
| @@ -229,8 +225,7 @@ destroynotify(XEvent *e) | |||
| 229 | } | 225 | } |
| 230 | 226 | ||
| 231 | static void | 227 | static void |
| 232 | enternotify(XEvent *e) | 228 | enternotify(XEvent *e) { |
| 233 | { | ||
| 234 | Client *c; | 229 | Client *c; |
| 235 | XCrossingEvent *ev = &e->xcrossing; | 230 | XCrossingEvent *ev = &e->xcrossing; |
| 236 | 231 | ||
| @@ -247,8 +242,7 @@ enternotify(XEvent *e) | |||
| 247 | } | 242 | } |
| 248 | 243 | ||
| 249 | static void | 244 | static void |
| 250 | expose(XEvent *e) | 245 | expose(XEvent *e) { |
| 251 | { | ||
| 252 | Client *c; | 246 | Client *c; |
| 253 | XExposeEvent *ev = &e->xexpose; | 247 | XExposeEvent *ev = &e->xexpose; |
| 254 | 248 | ||
| @@ -261,8 +255,7 @@ expose(XEvent *e) | |||
| 261 | } | 255 | } |
| 262 | 256 | ||
| 263 | static void | 257 | static void |
| 264 | keypress(XEvent *e) | 258 | keypress(XEvent *e) { |
| 265 | { | ||
| 266 | static unsigned int len = sizeof(key) / sizeof(key[0]); | 259 | static unsigned int len = sizeof(key) / sizeof(key[0]); |
| 267 | unsigned int i; | 260 | unsigned int i; |
| 268 | KeySym keysym; | 261 | KeySym keysym; |
| @@ -270,8 +263,8 @@ keypress(XEvent *e) | |||
| 270 | 263 | ||
| 271 | keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); | 264 | keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); |
| 272 | for(i = 0; i < len; i++) { | 265 | for(i = 0; i < len; i++) { |
| 273 | if(keysym == key[i].keysym && | 266 | if(keysym == key[i].keysym |
| 274 | CLEANMASK(key[i].mod) == CLEANMASK(ev->state)) | 267 | && CLEANMASK(key[i].mod) == CLEANMASK(ev->state)) |
| 275 | { | 268 | { |
| 276 | if(key[i].func) | 269 | if(key[i].func) |
| 277 | key[i].func(&key[i].arg); | 270 | key[i].func(&key[i].arg); |
| @@ -281,8 +274,7 @@ keypress(XEvent *e) | |||
| 281 | } | 274 | } |
| 282 | 275 | ||
| 283 | static void | 276 | static void |
| 284 | leavenotify(XEvent *e) | 277 | leavenotify(XEvent *e) { |
| 285 | { | ||
| 286 | XCrossingEvent *ev = &e->xcrossing; | 278 | XCrossingEvent *ev = &e->xcrossing; |
| 287 | 279 | ||
| 288 | if((ev->window == root) && !ev->same_screen) { | 280 | if((ev->window == root) && !ev->same_screen) { |
| @@ -292,8 +284,7 @@ leavenotify(XEvent *e) | |||
| 292 | } | 284 | } |
| 293 | 285 | ||
| 294 | static void | 286 | static void |
| 295 | mappingnotify(XEvent *e) | 287 | mappingnotify(XEvent *e) { |
| 296 | { | ||
| 297 | XMappingEvent *ev = &e->xmapping; | 288 | XMappingEvent *ev = &e->xmapping; |
| 298 | 289 | ||
| 299 | XRefreshKeyboardMapping(ev); | 290 | XRefreshKeyboardMapping(ev); |
| @@ -302,8 +293,7 @@ mappingnotify(XEvent *e) | |||
| 302 | } | 293 | } |
| 303 | 294 | ||
| 304 | static void | 295 | static void |
| 305 | maprequest(XEvent *e) | 296 | maprequest(XEvent *e) { |
| 306 | { | ||
| 307 | static XWindowAttributes wa; | 297 | static XWindowAttributes wa; |
| 308 | XMapRequestEvent *ev = &e->xmaprequest; | 298 | XMapRequestEvent *ev = &e->xmaprequest; |
| 309 | 299 | ||
| @@ -321,8 +311,7 @@ maprequest(XEvent *e) | |||
| 321 | } | 311 | } |
| 322 | 312 | ||
| 323 | static void | 313 | static void |
| 324 | propertynotify(XEvent *e) | 314 | propertynotify(XEvent *e) { |
| 325 | { | ||
| 326 | Client *c; | 315 | Client *c; |
| 327 | Window trans; | 316 | Window trans; |
| 328 | XPropertyEvent *ev = &e->xproperty; | 317 | XPropertyEvent *ev = &e->xproperty; |
| @@ -354,8 +343,7 @@ propertynotify(XEvent *e) | |||
| 354 | } | 343 | } |
| 355 | 344 | ||
| 356 | static void | 345 | static void |
| 357 | unmapnotify(XEvent *e) | 346 | unmapnotify(XEvent *e) { |
| 358 | { | ||
| 359 | Client *c; | 347 | Client *c; |
| 360 | XUnmapEvent *ev = &e->xunmap; | 348 | XUnmapEvent *ev = &e->xunmap; |
| 361 | 349 | ||
| @@ -380,8 +368,7 @@ void (*handler[LASTEvent]) (XEvent *) = { | |||
| 380 | }; | 368 | }; |
| 381 | 369 | ||
| 382 | void | 370 | void |
| 383 | grabkeys() | 371 | grabkeys() { |
| 384 | { | ||
| 385 | static unsigned int len = sizeof(key) / sizeof(key[0]); | 372 | static unsigned int len = sizeof(key) / sizeof(key[0]); |
| 386 | unsigned int i; | 373 | unsigned int i; |
| 387 | KeyCode code; | 374 | KeyCode code; |
| @@ -401,8 +388,7 @@ grabkeys() | |||
| 401 | } | 388 | } |
| 402 | 389 | ||
| 403 | void | 390 | void |
| 404 | procevent() | 391 | procevent() { |
| 405 | { | ||
| 406 | XEvent ev; | 392 | XEvent ev; |
| 407 | 393 | ||
| 408 | while(XPending(dpy)) { | 394 | while(XPending(dpy)) { |
| @@ -411,4 +397,3 @@ procevent() | |||
| 411 | (handler[ev.type])(&ev); /* call handler */ | 397 | (handler[ev.type])(&ev); /* call handler */ |
| 412 | } | 398 | } |
| 413 | } | 399 | } |
| 414 | |||
| @@ -39,8 +39,7 @@ static int (*xerrorxlib)(Display *, XErrorEvent *); | |||
| 39 | static Bool otherwm, readin; | 39 | static Bool otherwm, readin; |
| 40 | 40 | ||
| 41 | static void | 41 | static void |
| 42 | cleanup() | 42 | cleanup() { |
| 43 | { | ||
| 44 | close(STDIN_FILENO); | 43 | close(STDIN_FILENO); |
| 45 | while(sel) { | 44 | while(sel) { |
| 46 | resize(sel, True, TopLeft); | 45 | resize(sel, True, TopLeft); |
| @@ -60,8 +59,7 @@ cleanup() | |||
| 60 | } | 59 | } |
| 61 | 60 | ||
| 62 | static void | 61 | static void |
| 63 | scan() | 62 | scan() { |
| 64 | { | ||
| 65 | unsigned int i, num; | 63 | unsigned int i, num; |
| 66 | Window *wins, d1, d2; | 64 | Window *wins, d1, d2; |
| 67 | XWindowAttributes wa; | 65 | XWindowAttributes wa; |
| @@ -82,8 +80,7 @@ scan() | |||
| 82 | } | 80 | } |
| 83 | 81 | ||
| 84 | static void | 82 | static void |
| 85 | setup() | 83 | setup() { |
| 86 | { | ||
| 87 | int i, j; | 84 | int i, j; |
| 88 | unsigned int mask; | 85 | unsigned int mask; |
| 89 | Window w; | 86 | Window w; |
| @@ -112,7 +109,8 @@ setup() | |||
| 112 | } | 109 | } |
| 113 | XFree(modmap); | 110 | XFree(modmap); |
| 114 | 111 | ||
| 115 | wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask | EnterWindowMask | LeaveWindowMask; | 112 | wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask |
| 113 | | EnterWindowMask | LeaveWindowMask; | ||
| 116 | wa.cursor = cursor[CurNormal]; | 114 | wa.cursor = cursor[CurNormal]; |
| 117 | XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa); | 115 | XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa); |
| 118 | 116 | ||
| @@ -163,8 +161,7 @@ setup() | |||
| 163 | * is already running. | 161 | * is already running. |
| 164 | */ | 162 | */ |
| 165 | static int | 163 | static int |
| 166 | xerrorstart(Display *dsply, XErrorEvent *ee) | 164 | xerrorstart(Display *dsply, XErrorEvent *ee) { |
| 167 | { | ||
| 168 | otherwm = True; | 165 | otherwm = True; |
| 169 | return -1; | 166 | return -1; |
| 170 | } | 167 | } |
| @@ -172,8 +169,7 @@ xerrorstart(Display *dsply, XErrorEvent *ee) | |||
| 172 | /* extern */ | 169 | /* extern */ |
| 173 | 170 | ||
| 174 | int | 171 | int |
| 175 | getproto(Window w) | 172 | getproto(Window w) { |
| 176 | { | ||
| 177 | int i, format, protos, status; | 173 | int i, format, protos, status; |
| 178 | unsigned long extra, res; | 174 | unsigned long extra, res; |
| 179 | Atom *protocols, real; | 175 | Atom *protocols, real; |
| @@ -191,8 +187,7 @@ getproto(Window w) | |||
| 191 | } | 187 | } |
| 192 | 188 | ||
| 193 | void | 189 | void |
| 194 | sendevent(Window w, Atom a, long value) | 190 | sendevent(Window w, Atom a, long value) { |
| 195 | { | ||
| 196 | XEvent e; | 191 | XEvent e; |
| 197 | 192 | ||
| 198 | e.type = ClientMessage; | 193 | e.type = ClientMessage; |
| @@ -206,8 +201,7 @@ sendevent(Window w, Atom a, long value) | |||
| 206 | } | 201 | } |
| 207 | 202 | ||
| 208 | void | 203 | void |
| 209 | quit(Arg *arg) | 204 | quit(Arg *arg) { |
| 210 | { | ||
| 211 | readin = running = False; | 205 | readin = running = False; |
| 212 | } | 206 | } |
| 213 | 207 | ||
| @@ -217,8 +211,7 @@ quit(Arg *arg) | |||
| 217 | * default error handler, which may call exit. | 211 | * default error handler, which may call exit. |
| 218 | */ | 212 | */ |
| 219 | int | 213 | int |
| 220 | xerror(Display *dpy, XErrorEvent *ee) | 214 | xerror(Display *dpy, XErrorEvent *ee) { |
| 221 | { | ||
| 222 | if(ee->error_code == BadWindow | 215 | if(ee->error_code == BadWindow |
| 223 | || (ee->request_code == X_SetInputFocus && ee->error_code == BadMatch) | 216 | || (ee->request_code == X_SetInputFocus && ee->error_code == BadMatch) |
| 224 | || (ee->request_code == X_PolyText8 && ee->error_code == BadDrawable) | 217 | || (ee->request_code == X_PolyText8 && ee->error_code == BadDrawable) |
| @@ -234,8 +227,7 @@ xerror(Display *dpy, XErrorEvent *ee) | |||
| 234 | } | 227 | } |
| 235 | 228 | ||
| 236 | int | 229 | int |
| 237 | main(int argc, char *argv[]) | 230 | main(int argc, char *argv[]) { |
| 238 | { | ||
| 239 | int r, xfd; | 231 | int r, xfd; |
| 240 | fd_set rd; | 232 | fd_set rd; |
| 241 | 233 | ||
| @@ -33,22 +33,19 @@ static unsigned int len = 0; | |||
| 33 | /* extern */ | 33 | /* extern */ |
| 34 | 34 | ||
| 35 | Client * | 35 | Client * |
| 36 | getnext(Client *c) | 36 | getnext(Client *c) { |
| 37 | { | ||
| 38 | for(; c && !isvisible(c); c = c->next); | 37 | for(; c && !isvisible(c); c = c->next); |
| 39 | return c; | 38 | return c; |
| 40 | } | 39 | } |
| 41 | 40 | ||
| 42 | Client * | 41 | Client * |
| 43 | getprev(Client *c) | 42 | getprev(Client *c) { |
| 44 | { | ||
| 45 | for(; c && !isvisible(c); c = c->prev); | 43 | for(; c && !isvisible(c); c = c->prev); |
| 46 | return c; | 44 | return c; |
| 47 | } | 45 | } |
| 48 | 46 | ||
| 49 | void | 47 | void |
| 50 | initrregs() | 48 | initrregs() { |
| 51 | { | ||
| 52 | unsigned int i; | 49 | unsigned int i; |
| 53 | regex_t *reg; | 50 | regex_t *reg; |
| 54 | 51 | ||
| @@ -76,8 +73,7 @@ initrregs() | |||
| 76 | } | 73 | } |
| 77 | 74 | ||
| 78 | void | 75 | void |
| 79 | settags(Client *c, Client *trans) | 76 | settags(Client *c, Client *trans) { |
| 80 | { | ||
| 81 | char prop[512]; | 77 | char prop[512]; |
| 82 | unsigned int i, j; | 78 | unsigned int i, j; |
| 83 | regmatch_t tmp; | 79 | regmatch_t tmp; |
| @@ -114,8 +110,7 @@ settags(Client *c, Client *trans) | |||
| 114 | } | 110 | } |
| 115 | 111 | ||
| 116 | void | 112 | void |
| 117 | tag(Arg *arg) | 113 | tag(Arg *arg) { |
| 118 | { | ||
| 119 | unsigned int i; | 114 | unsigned int i; |
| 120 | 115 | ||
| 121 | if(!sel) | 116 | if(!sel) |
| @@ -129,8 +124,7 @@ tag(Arg *arg) | |||
| 129 | } | 124 | } |
| 130 | 125 | ||
| 131 | void | 126 | void |
| 132 | toggletag(Arg *arg) | 127 | toggletag(Arg *arg) { |
| 133 | { | ||
| 134 | unsigned int i; | 128 | unsigned int i; |
| 135 | 129 | ||
| 136 | if(!sel) | 130 | if(!sel) |
| @@ -12,8 +12,7 @@ | |||
| 12 | /* extern */ | 12 | /* extern */ |
| 13 | 13 | ||
| 14 | void * | 14 | void * |
| 15 | emallocz(unsigned int size) | 15 | emallocz(unsigned int size) { |
| 16 | { | ||
| 17 | void *res = calloc(1, size); | 16 | void *res = calloc(1, size); |
| 18 | 17 | ||
| 19 | if(!res) | 18 | if(!res) |
| @@ -22,8 +21,7 @@ emallocz(unsigned int size) | |||
| 22 | } | 21 | } |
| 23 | 22 | ||
| 24 | void | 23 | void |
| 25 | eprint(const char *errstr, ...) | 24 | eprint(const char *errstr, ...) { |
| 26 | { | ||
| 27 | va_list ap; | 25 | va_list ap; |
| 28 | 26 | ||
| 29 | va_start(ap, errstr); | 27 | va_start(ap, errstr); |
| @@ -33,8 +31,7 @@ eprint(const char *errstr, ...) | |||
| 33 | } | 31 | } |
| 34 | 32 | ||
| 35 | void * | 33 | void * |
| 36 | erealloc(void *ptr, unsigned int size) | 34 | erealloc(void *ptr, unsigned int size) { |
| 37 | { | ||
| 38 | void *res = realloc(ptr, size); | 35 | void *res = realloc(ptr, size); |
| 39 | if(!res) | 36 | if(!res) |
| 40 | eprint("fatal: could not malloc() %u bytes\n", size); | 37 | eprint("fatal: could not malloc() %u bytes\n", size); |
| @@ -42,8 +39,7 @@ erealloc(void *ptr, unsigned int size) | |||
| 42 | } | 39 | } |
| 43 | 40 | ||
| 44 | void | 41 | void |
| 45 | spawn(Arg *arg) | 42 | spawn(Arg *arg) { |
| 46 | { | ||
| 47 | static char *shell = NULL; | 43 | static char *shell = NULL; |
| 48 | 44 | ||
| 49 | if(!shell && !(shell = getenv("SHELL"))) | 45 | if(!shell && !(shell = getenv("SHELL"))) |
| @@ -8,8 +8,7 @@ | |||
| 8 | /* static */ | 8 | /* static */ |
| 9 | 9 | ||
| 10 | static Client * | 10 | static Client * |
| 11 | minclient() | 11 | minclient() { |
| 12 | { | ||
| 13 | Client *c, *min; | 12 | Client *c, *min; |
| 14 | 13 | ||
| 15 | if((clients && clients->isfloat) || arrange == dofloat) | 14 | if((clients && clients->isfloat) || arrange == dofloat) |
| @@ -21,8 +20,7 @@ minclient() | |||
| 21 | } | 20 | } |
| 22 | 21 | ||
| 23 | static void | 22 | static void |
| 24 | reorder() | 23 | reorder() { |
| 25 | { | ||
| 26 | Client *c, *newclients, *tail; | 24 | Client *c, *newclients, *tail; |
| 27 | 25 | ||
| 28 | newclients = tail = NULL; | 26 | newclients = tail = NULL; |
| @@ -40,8 +38,7 @@ reorder() | |||
| 40 | } | 38 | } |
| 41 | 39 | ||
| 42 | static Client * | 40 | static Client * |
| 43 | nexttiled(Client *c) | 41 | nexttiled(Client *c) { |
| 44 | { | ||
| 45 | for(c = getnext(c); c && c->isfloat; c = getnext(c->next)); | 42 | for(c = getnext(c); c && c->isfloat; c = getnext(c->next)); |
| 46 | return c; | 43 | return c; |
| 47 | } | 44 | } |
| @@ -51,8 +48,7 @@ nexttiled(Client *c) | |||
| 51 | void (*arrange)(Arg *) = DEFMODE; | 48 | void (*arrange)(Arg *) = DEFMODE; |
| 52 | 49 | ||
| 53 | void | 50 | void |
| 54 | detach(Client *c) | 51 | detach(Client *c) { |
| 55 | { | ||
| 56 | if(c->prev) | 52 | if(c->prev) |
| 57 | c->prev->next = c->next; | 53 | c->prev->next = c->next; |
| 58 | if(c->next) | 54 | if(c->next) |
| @@ -63,8 +59,7 @@ detach(Client *c) | |||
| 63 | } | 59 | } |
| 64 | 60 | ||
| 65 | void | 61 | void |
| 66 | dofloat(Arg *arg) | 62 | dofloat(Arg *arg) { |
| 67 | { | ||
| 68 | Client *c; | 63 | Client *c; |
| 69 | 64 | ||
| 70 | maximized = False; | 65 | maximized = False; |
| @@ -84,8 +79,7 @@ dofloat(Arg *arg) | |||
| 84 | } | 79 | } |
| 85 | 80 | ||
| 86 | void | 81 | void |
| 87 | dotile(Arg *arg) | 82 | dotile(Arg *arg) { |
| 88 | { | ||
| 89 | int h, i, n, w; | 83 | int h, i, n, w; |
| 90 | Client *c; | 84 | Client *c; |
| 91 | 85 | ||
| @@ -148,8 +142,7 @@ dotile(Arg *arg) | |||
| 148 | } | 142 | } |
| 149 | 143 | ||
| 150 | void | 144 | void |
| 151 | focusnext(Arg *arg) | 145 | focusnext(Arg *arg) { |
| 152 | { | ||
| 153 | Client *c; | 146 | Client *c; |
| 154 | 147 | ||
| 155 | if(!sel) | 148 | if(!sel) |
| @@ -164,8 +157,7 @@ focusnext(Arg *arg) | |||
| 164 | } | 157 | } |
| 165 | 158 | ||
| 166 | void | 159 | void |
| 167 | focusprev(Arg *arg) | 160 | focusprev(Arg *arg) { |
| 168 | { | ||
| 169 | Client *c; | 161 | Client *c; |
| 170 | 162 | ||
| 171 | if(!sel) | 163 | if(!sel) |
| @@ -182,8 +174,7 @@ focusprev(Arg *arg) | |||
| 182 | } | 174 | } |
| 183 | 175 | ||
| 184 | Bool | 176 | Bool |
| 185 | isvisible(Client *c) | 177 | isvisible(Client *c) { |
| 186 | { | ||
| 187 | unsigned int i; | 178 | unsigned int i; |
| 188 | 179 | ||
| 189 | for(i = 0; i < ntags; i++) | 180 | for(i = 0; i < ntags; i++) |
| @@ -193,8 +184,7 @@ isvisible(Client *c) | |||
| 193 | } | 184 | } |
| 194 | 185 | ||
| 195 | void | 186 | void |
| 196 | resizecol(Arg *arg) | 187 | resizecol(Arg *arg) { |
| 197 | { | ||
| 198 | unsigned int n; | 188 | unsigned int n; |
| 199 | Client *c; | 189 | Client *c; |
| 200 | 190 | ||
| @@ -218,8 +208,7 @@ resizecol(Arg *arg) | |||
| 218 | } | 208 | } |
| 219 | 209 | ||
| 220 | void | 210 | void |
| 221 | restack() | 211 | restack() { |
| 222 | { | ||
| 223 | Client *c; | 212 | Client *c; |
| 224 | XEvent ev; | 213 | XEvent ev; |
| 225 | 214 | ||
| @@ -242,8 +231,7 @@ restack() | |||
| 242 | } | 231 | } |
| 243 | 232 | ||
| 244 | void | 233 | void |
| 245 | togglemode(Arg *arg) | 234 | togglemode(Arg *arg) { |
| 246 | { | ||
| 247 | arrange = (arrange == dofloat) ? dotile : dofloat; | 235 | arrange = (arrange == dofloat) ? dotile : dofloat; |
| 248 | if(sel) | 236 | if(sel) |
| 249 | arrange(NULL); | 237 | arrange(NULL); |
| @@ -252,8 +240,7 @@ togglemode(Arg *arg) | |||
| 252 | } | 240 | } |
| 253 | 241 | ||
| 254 | void | 242 | void |
| 255 | toggleview(Arg *arg) | 243 | toggleview(Arg *arg) { |
| 256 | { | ||
| 257 | unsigned int i; | 244 | unsigned int i; |
| 258 | 245 | ||
| 259 | seltag[arg->i] = !seltag[arg->i]; | 246 | seltag[arg->i] = !seltag[arg->i]; |
| @@ -265,8 +252,7 @@ toggleview(Arg *arg) | |||
| 265 | } | 252 | } |
| 266 | 253 | ||
| 267 | void | 254 | void |
| 268 | view(Arg *arg) | 255 | view(Arg *arg) { |
| 269 | { | ||
| 270 | unsigned int i; | 256 | unsigned int i; |
| 271 | 257 | ||
| 272 | for(i = 0; i < ntags; i++) | 258 | for(i = 0; i < ntags; i++) |
| @@ -277,8 +263,7 @@ view(Arg *arg) | |||
| 277 | } | 263 | } |
| 278 | 264 | ||
| 279 | void | 265 | void |
| 280 | viewall(Arg *arg) | 266 | viewall(Arg *arg) { |
| 281 | { | ||
| 282 | unsigned int i; | 267 | unsigned int i; |
| 283 | 268 | ||
| 284 | for(i = 0; i < ntags; i++) | 269 | for(i = 0; i < ntags; i++) |
| @@ -288,8 +273,7 @@ viewall(Arg *arg) | |||
| 288 | } | 273 | } |
| 289 | 274 | ||
| 290 | void | 275 | void |
| 291 | zoom(Arg *arg) | 276 | zoom(Arg *arg) { |
| 292 | { | ||
| 293 | unsigned int n; | 277 | unsigned int n; |
| 294 | Client *c; | 278 | Client *c; |
| 295 | 279 | ||
