tremoved a bunch of lines through making function signatures more consistent wi… | |
git clone git://src.adamsgaard.dk/dwm | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit ca65478c8968434c78aacf4a102ccbbe4a66ad9e | |
parent a1e9362d38d0527d482bf7bec735d3a949a24d82 | |
Author: Anselm R. Garbe <[email protected]> | |
Date: Tue, 12 Sep 2006 10:57:28 +0200 | |
removed a bunch of lines through making function signatures more consistent wit… | |
Diffstat: | |
M client.c | 50 ++++++++++-------------------… | |
M draw.c | 24 ++++++++---------------- | |
M event.c | 59 ++++++++++++-----------------… | |
M main.c | 30 +++++++++++------------------- | |
M tag.c | 18 ++++++------------ | |
M util.c | 12 ++++-------- | |
M view.c | 48 +++++++++++------------------… | |
7 files changed, 83 insertions(+), 158 deletions(-) | |
--- | |
diff --git a/client.c b/client.c | |
t@@ -11,16 +11,14 @@ | |
/* static functions */ | |
static void | |
-detachstack(Client *c) | |
-{ | |
+detachstack(Client *c) { | |
Client **tc; | |
for(tc=&stack; *tc && *tc != c; tc=&(*tc)->snext); | |
*tc = c->snext; | |
} | |
static void | |
-grabbuttons(Client *c, Bool focused) | |
-{ | |
+grabbuttons(Client *c, Bool focused) { | |
XUngrabButton(dpy, AnyButton, AnyModifier, c->win); | |
if(focused) { | |
t@@ -54,12 +52,10 @@ grabbuttons(Client *c, Bool focused) | |
else | |
XGrabButton(dpy, AnyButton, AnyModifier, c->win, False, BUTTON… | |
GrabModeAsync, GrabModeSync, None, None); | |
- | |
} | |
static void | |
-resizetitle(Client *c) | |
-{ | |
+resizetitle(Client *c) { | |
c->tw = textw(c->name); | |
if(c->tw > c->w) | |
c->tw = c->w + 2; | |
t@@ -69,27 +65,23 @@ resizetitle(Client *c) | |
XMoveResizeWindow(dpy, c->twin, c->tx, c->ty, c->tw, c->th); | |
else | |
XMoveResizeWindow(dpy, c->twin, c->tx + 2 * sw, c->ty, c->tw, … | |
- | |
} | |
static int | |
-xerrordummy(Display *dsply, XErrorEvent *ee) | |
-{ | |
+xerrordummy(Display *dsply, XErrorEvent *ee) { | |
return 0; | |
} | |
/* extern functions */ | |
void | |
-ban(Client *c) | |
-{ | |
+ban(Client *c) { | |
XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y); | |
XMoveWindow(dpy, c->twin, c->tx + 2 * sw, c->ty); | |
} | |
void | |
-focus(Client *c) | |
-{ | |
+focus(Client *c) { | |
Client *old; | |
if(!issel) | |
t@@ -119,8 +111,7 @@ focus(Client *c) | |
} | |
Client * | |
-getclient(Window w) | |
-{ | |
+getclient(Window w) { | |
Client *c; | |
for(c = clients; c; c = c->next) | |
t@@ -130,8 +121,7 @@ getclient(Window w) | |
} | |
Client * | |
-getctitle(Window w) | |
-{ | |
+getctitle(Window w) { | |
Client *c; | |
for(c = clients; c; c = c->next) | |
t@@ -141,8 +131,7 @@ getctitle(Window w) | |
} | |
void | |
-gravitate(Client *c, Bool invert) | |
-{ | |
+gravitate(Client *c, Bool invert) { | |
int dx = 0, dy = 0; | |
switch(c->grav) { | |
t@@ -196,8 +185,7 @@ gravitate(Client *c, Bool invert) | |
} | |
void | |
-killclient(Arg *arg) | |
-{ | |
+killclient(Arg *arg) { | |
if(!sel) | |
return; | |
if(sel->proto & PROTODELWIN) | |
t@@ -207,8 +195,7 @@ killclient(Arg *arg) | |
} | |
void | |
-manage(Window w, XWindowAttributes *wa) | |
-{ | |
+manage(Window w, XWindowAttributes *wa) { | |
Client *c; | |
Window trans; | |
XSetWindowAttributes twa; | |
t@@ -270,8 +257,7 @@ manage(Window w, XWindowAttributes *wa) | |
} | |
void | |
-resize(Client *c, Bool sizehints, Corner sticky) | |
-{ | |
+resize(Client *c, Bool sizehints, Corner sticky) { | |
int bottom = c->y + c->h; | |
int right = c->x + c->w; | |
XWindowChanges wc; | |
t@@ -309,8 +295,7 @@ resize(Client *c, Bool sizehints, Corner sticky) | |
} | |
void | |
-updatesize(Client *c) | |
-{ | |
+updatesize(Client *c) { | |
long msize; | |
XSizeHints size; | |
t@@ -348,8 +333,7 @@ updatesize(Client *c) | |
} | |
void | |
-updatetitle(Client *c) | |
-{ | |
+updatetitle(Client *c) { | |
char **list = NULL; | |
int n; | |
XTextProperty name; | |
t@@ -376,8 +360,7 @@ updatetitle(Client *c) | |
} | |
void | |
-togglemax(Arg *arg) | |
-{ | |
+togglemax(Arg *arg) { | |
int ox, oy, ow, oh; | |
Client *c; | |
XEvent ev; | |
t@@ -412,8 +395,7 @@ togglemax(Arg *arg) | |
} | |
void | |
-unmanage(Client *c) | |
-{ | |
+unmanage(Client *c) { | |
Client *nc; | |
XGrabServer(dpy); | |
diff --git a/draw.c b/draw.c | |
t@@ -10,8 +10,7 @@ | |
/* static */ | |
static unsigned int | |
-textnw(const char *text, unsigned int len) | |
-{ | |
+textnw(const char *text, unsigned int len) { | |
XRectangle r; | |
if(dc.font.set) { | |
t@@ -22,8 +21,7 @@ textnw(const char *text, unsigned int len) | |
} | |
static void | |
-drawtext(const char *text, unsigned long col[ColLast], Bool highlight) | |
-{ | |
+drawtext(const char *text, unsigned long col[ColLast], Bool highlight) { | |
int x, y, w, h; | |
static char buf[256]; | |
unsigned int len, olen; | |
t@@ -82,8 +80,7 @@ drawtext(const char *text, unsigned long col[ColLast], Bool … | |
/* extern */ | |
void | |
-drawall() | |
-{ | |
+drawall() { | |
Client *c; | |
for(c = clients; c; c = getnext(c->next)) | |
t@@ -92,8 +89,7 @@ drawall() | |
} | |
void | |
-drawstatus() | |
-{ | |
+drawstatus() { | |
int i, x; | |
dc.x = dc.y = 0; | |
t@@ -131,8 +127,7 @@ drawstatus() | |
} | |
void | |
-drawtitle(Client *c) | |
-{ | |
+drawtitle(Client *c) { | |
if(c == sel && issel) { | |
drawstatus(); | |
XUnmapWindow(dpy, c->twin); | |
t@@ -150,8 +145,7 @@ drawtitle(Client *c) | |
} | |
unsigned long | |
-getcolor(const char *colstr) | |
-{ | |
+getcolor(const char *colstr) { | |
Colormap cmap = DefaultColormap(dpy, screen); | |
XColor color; | |
t@@ -160,8 +154,7 @@ getcolor(const char *colstr) | |
} | |
void | |
-setfont(const char *fontstr) | |
-{ | |
+setfont(const char *fontstr) { | |
char **missing, *def; | |
int i, n; | |
t@@ -211,7 +204,6 @@ setfont(const char *fontstr) | |
} | |
unsigned int | |
-textw(const char *text) | |
-{ | |
+textw(const char *text) { | |
return textnw(text, strlen(text)) + dc.font.height; | |
} | |
diff --git a/event.c b/event.c | |
t@@ -21,8 +21,7 @@ KEYS | |
#define CLEANMASK(mask) (mask & ~(numlockmask | LockMask)) | |
static void | |
-movemouse(Client *c) | |
-{ | |
+movemouse(Client *c) { | |
int x1, y1, ocx, ocy, di; | |
unsigned int dui; | |
Window dummy; | |
t@@ -37,7 +36,8 @@ movemouse(Client *c) | |
for(;;) { | |
XMaskEvent(dpy, MOUSEMASK | ExposureMask, &ev); | |
switch (ev.type) { | |
- default: break; | |
+ default: | |
+ break; | |
case Expose: | |
handler[Expose](&ev); | |
break; | |
t@@ -55,8 +55,7 @@ movemouse(Client *c) | |
} | |
static void | |
-resizemouse(Client *c) | |
-{ | |
+resizemouse(Client *c) { | |
int ocx, ocy; | |
int nw, nh; | |
Corner sticky; | |
t@@ -71,7 +70,8 @@ resizemouse(Client *c) | |
for(;;) { | |
XMaskEvent(dpy, MOUSEMASK | ExposureMask, &ev); | |
switch(ev.type) { | |
- default: break; | |
+ default: | |
+ break; | |
case Expose: | |
handler[Expose](&ev); | |
break; | |
t@@ -97,8 +97,7 @@ resizemouse(Client *c) | |
} | |
static void | |
-buttonpress(XEvent *e) | |
-{ | |
+buttonpress(XEvent *e) { | |
int x; | |
Arg a; | |
Client *c; | |
t@@ -147,8 +146,7 @@ buttonpress(XEvent *e) | |
} | |
static void | |
-synconfig(Client *c, int x, int y, int w, int h, unsigned int border) | |
-{ | |
+synconfig(Client *c, int x, int y, int w, int h, unsigned int border) { | |
XEvent synev; | |
synev.type = ConfigureNotify; | |
t@@ -165,8 +163,7 @@ synconfig(Client *c, int x, int y, int w, int h, unsigned … | |
} | |
static void | |
-configurerequest(XEvent *e) | |
-{ | |
+configurerequest(XEvent *e) { | |
unsigned long newmask; | |
Client *c; | |
XConfigureRequestEvent *ev = &e->xconfigurerequest; | |
t@@ -219,8 +216,7 @@ configurerequest(XEvent *e) | |
} | |
static void | |
-destroynotify(XEvent *e) | |
-{ | |
+destroynotify(XEvent *e) { | |
Client *c; | |
XDestroyWindowEvent *ev = &e->xdestroywindow; | |
t@@ -229,8 +225,7 @@ destroynotify(XEvent *e) | |
} | |
static void | |
-enternotify(XEvent *e) | |
-{ | |
+enternotify(XEvent *e) { | |
Client *c; | |
XCrossingEvent *ev = &e->xcrossing; | |
t@@ -247,8 +242,7 @@ enternotify(XEvent *e) | |
} | |
static void | |
-expose(XEvent *e) | |
-{ | |
+expose(XEvent *e) { | |
Client *c; | |
XExposeEvent *ev = &e->xexpose; | |
t@@ -261,8 +255,7 @@ expose(XEvent *e) | |
} | |
static void | |
-keypress(XEvent *e) | |
-{ | |
+keypress(XEvent *e) { | |
static unsigned int len = sizeof(key) / sizeof(key[0]); | |
unsigned int i; | |
KeySym keysym; | |
t@@ -270,8 +263,8 @@ keypress(XEvent *e) | |
keysym = XKeycodeToKeysym(dpy, (KeyCode)ev->keycode, 0); | |
for(i = 0; i < len; i++) { | |
- if(keysym == key[i].keysym && | |
- CLEANMASK(key[i].mod) == CLEANMASK(ev->state)) | |
+ if(keysym == key[i].keysym | |
+ && CLEANMASK(key[i].mod) == CLEANMASK(ev->state)) | |
{ | |
if(key[i].func) | |
key[i].func(&key[i].arg); | |
t@@ -281,8 +274,7 @@ keypress(XEvent *e) | |
} | |
static void | |
-leavenotify(XEvent *e) | |
-{ | |
+leavenotify(XEvent *e) { | |
XCrossingEvent *ev = &e->xcrossing; | |
if((ev->window == root) && !ev->same_screen) { | |
t@@ -292,8 +284,7 @@ leavenotify(XEvent *e) | |
} | |
static void | |
-mappingnotify(XEvent *e) | |
-{ | |
+mappingnotify(XEvent *e) { | |
XMappingEvent *ev = &e->xmapping; | |
XRefreshKeyboardMapping(ev); | |
t@@ -302,8 +293,7 @@ mappingnotify(XEvent *e) | |
} | |
static void | |
-maprequest(XEvent *e) | |
-{ | |
+maprequest(XEvent *e) { | |
static XWindowAttributes wa; | |
XMapRequestEvent *ev = &e->xmaprequest; | |
t@@ -321,8 +311,7 @@ maprequest(XEvent *e) | |
} | |
static void | |
-propertynotify(XEvent *e) | |
-{ | |
+propertynotify(XEvent *e) { | |
Client *c; | |
Window trans; | |
XPropertyEvent *ev = &e->xproperty; | |
t@@ -354,8 +343,7 @@ propertynotify(XEvent *e) | |
} | |
static void | |
-unmapnotify(XEvent *e) | |
-{ | |
+unmapnotify(XEvent *e) { | |
Client *c; | |
XUnmapEvent *ev = &e->xunmap; | |
t@@ -380,8 +368,7 @@ void (*handler[LASTEvent]) (XEvent *) = { | |
}; | |
void | |
-grabkeys() | |
-{ | |
+grabkeys() { | |
static unsigned int len = sizeof(key) / sizeof(key[0]); | |
unsigned int i; | |
KeyCode code; | |
t@@ -401,8 +388,7 @@ grabkeys() | |
} | |
void | |
-procevent() | |
-{ | |
+procevent() { | |
XEvent ev; | |
while(XPending(dpy)) { | |
t@@ -411,4 +397,3 @@ procevent() | |
(handler[ev.type])(&ev); /* call handler */ | |
} | |
} | |
- | |
diff --git a/main.c b/main.c | |
t@@ -39,8 +39,7 @@ static int (*xerrorxlib)(Display *, XErrorEvent *); | |
static Bool otherwm, readin; | |
static void | |
-cleanup() | |
-{ | |
+cleanup() { | |
close(STDIN_FILENO); | |
while(sel) { | |
resize(sel, True, TopLeft); | |
t@@ -60,8 +59,7 @@ cleanup() | |
} | |
static void | |
-scan() | |
-{ | |
+scan() { | |
unsigned int i, num; | |
Window *wins, d1, d2; | |
XWindowAttributes wa; | |
t@@ -82,8 +80,7 @@ scan() | |
} | |
static void | |
-setup() | |
-{ | |
+setup() { | |
int i, j; | |
unsigned int mask; | |
Window w; | |
t@@ -112,7 +109,8 @@ setup() | |
} | |
XFree(modmap); | |
- wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask | En… | |
+ wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask | |
+ | EnterWindowMask | LeaveWindowMask; | |
wa.cursor = cursor[CurNormal]; | |
XChangeWindowAttributes(dpy, root, CWEventMask | CWCursor, &wa); | |
t@@ -163,8 +161,7 @@ setup() | |
* is already running. | |
*/ | |
static int | |
-xerrorstart(Display *dsply, XErrorEvent *ee) | |
-{ | |
+xerrorstart(Display *dsply, XErrorEvent *ee) { | |
otherwm = True; | |
return -1; | |
} | |
t@@ -172,8 +169,7 @@ xerrorstart(Display *dsply, XErrorEvent *ee) | |
/* extern */ | |
int | |
-getproto(Window w) | |
-{ | |
+getproto(Window w) { | |
int i, format, protos, status; | |
unsigned long extra, res; | |
Atom *protocols, real; | |
t@@ -191,8 +187,7 @@ getproto(Window w) | |
} | |
void | |
-sendevent(Window w, Atom a, long value) | |
-{ | |
+sendevent(Window w, Atom a, long value) { | |
XEvent e; | |
e.type = ClientMessage; | |
t@@ -206,8 +201,7 @@ sendevent(Window w, Atom a, long value) | |
} | |
void | |
-quit(Arg *arg) | |
-{ | |
+quit(Arg *arg) { | |
readin = running = False; | |
} | |
t@@ -217,8 +211,7 @@ quit(Arg *arg) | |
* default error handler, which may call exit. | |
*/ | |
int | |
-xerror(Display *dpy, XErrorEvent *ee) | |
-{ | |
+xerror(Display *dpy, XErrorEvent *ee) { | |
if(ee->error_code == BadWindow | |
|| (ee->request_code == X_SetInputFocus && ee->error_code == BadMatch) | |
|| (ee->request_code == X_PolyText8 && ee->error_code == BadDrawable) | |
t@@ -234,8 +227,7 @@ xerror(Display *dpy, XErrorEvent *ee) | |
} | |
int | |
-main(int argc, char *argv[]) | |
-{ | |
+main(int argc, char *argv[]) { | |
int r, xfd; | |
fd_set rd; | |
diff --git a/tag.c b/tag.c | |
t@@ -33,22 +33,19 @@ static unsigned int len = 0; | |
/* extern */ | |
Client * | |
-getnext(Client *c) | |
-{ | |
+getnext(Client *c) { | |
for(; c && !isvisible(c); c = c->next); | |
return c; | |
} | |
Client * | |
-getprev(Client *c) | |
-{ | |
+getprev(Client *c) { | |
for(; c && !isvisible(c); c = c->prev); | |
return c; | |
} | |
void | |
-initrregs() | |
-{ | |
+initrregs() { | |
unsigned int i; | |
regex_t *reg; | |
t@@ -76,8 +73,7 @@ initrregs() | |
} | |
void | |
-settags(Client *c, Client *trans) | |
-{ | |
+settags(Client *c, Client *trans) { | |
char prop[512]; | |
unsigned int i, j; | |
regmatch_t tmp; | |
t@@ -114,8 +110,7 @@ settags(Client *c, Client *trans) | |
} | |
void | |
-tag(Arg *arg) | |
-{ | |
+tag(Arg *arg) { | |
unsigned int i; | |
if(!sel) | |
t@@ -129,8 +124,7 @@ tag(Arg *arg) | |
} | |
void | |
-toggletag(Arg *arg) | |
-{ | |
+toggletag(Arg *arg) { | |
unsigned int i; | |
if(!sel) | |
diff --git a/util.c b/util.c | |
t@@ -12,8 +12,7 @@ | |
/* extern */ | |
void * | |
-emallocz(unsigned int size) | |
-{ | |
+emallocz(unsigned int size) { | |
void *res = calloc(1, size); | |
if(!res) | |
t@@ -22,8 +21,7 @@ emallocz(unsigned int size) | |
} | |
void | |
-eprint(const char *errstr, ...) | |
-{ | |
+eprint(const char *errstr, ...) { | |
va_list ap; | |
va_start(ap, errstr); | |
t@@ -33,8 +31,7 @@ eprint(const char *errstr, ...) | |
} | |
void * | |
-erealloc(void *ptr, unsigned int size) | |
-{ | |
+erealloc(void *ptr, unsigned int size) { | |
void *res = realloc(ptr, size); | |
if(!res) | |
eprint("fatal: could not malloc() %u bytes\n", size); | |
t@@ -42,8 +39,7 @@ erealloc(void *ptr, unsigned int size) | |
} | |
void | |
-spawn(Arg *arg) | |
-{ | |
+spawn(Arg *arg) { | |
static char *shell = NULL; | |
if(!shell && !(shell = getenv("SHELL"))) | |
diff --git a/view.c b/view.c | |
t@@ -8,8 +8,7 @@ | |
/* static */ | |
static Client * | |
-minclient() | |
-{ | |
+minclient() { | |
Client *c, *min; | |
if((clients && clients->isfloat) || arrange == dofloat) | |
t@@ -21,8 +20,7 @@ minclient() | |
} | |
static void | |
-reorder() | |
-{ | |
+reorder() { | |
Client *c, *newclients, *tail; | |
newclients = tail = NULL; | |
t@@ -40,8 +38,7 @@ reorder() | |
} | |
static Client * | |
-nexttiled(Client *c) | |
-{ | |
+nexttiled(Client *c) { | |
for(c = getnext(c); c && c->isfloat; c = getnext(c->next)); | |
return c; | |
} | |
t@@ -51,8 +48,7 @@ nexttiled(Client *c) | |
void (*arrange)(Arg *) = DEFMODE; | |
void | |
-detach(Client *c) | |
-{ | |
+detach(Client *c) { | |
if(c->prev) | |
c->prev->next = c->next; | |
if(c->next) | |
t@@ -63,8 +59,7 @@ detach(Client *c) | |
} | |
void | |
-dofloat(Arg *arg) | |
-{ | |
+dofloat(Arg *arg) { | |
Client *c; | |
maximized = False; | |
t@@ -84,8 +79,7 @@ dofloat(Arg *arg) | |
} | |
void | |
-dotile(Arg *arg) | |
-{ | |
+dotile(Arg *arg) { | |
int h, i, n, w; | |
Client *c; | |
t@@ -148,8 +142,7 @@ dotile(Arg *arg) | |
} | |
void | |
-focusnext(Arg *arg) | |
-{ | |
+focusnext(Arg *arg) { | |
Client *c; | |
if(!sel) | |
t@@ -164,8 +157,7 @@ focusnext(Arg *arg) | |
} | |
void | |
-focusprev(Arg *arg) | |
-{ | |
+focusprev(Arg *arg) { | |
Client *c; | |
if(!sel) | |
t@@ -182,8 +174,7 @@ focusprev(Arg *arg) | |
} | |
Bool | |
-isvisible(Client *c) | |
-{ | |
+isvisible(Client *c) { | |
unsigned int i; | |
for(i = 0; i < ntags; i++) | |
t@@ -193,8 +184,7 @@ isvisible(Client *c) | |
} | |
void | |
-resizecol(Arg *arg) | |
-{ | |
+resizecol(Arg *arg) { | |
unsigned int n; | |
Client *c; | |
t@@ -218,8 +208,7 @@ resizecol(Arg *arg) | |
} | |
void | |
-restack() | |
-{ | |
+restack() { | |
Client *c; | |
XEvent ev; | |
t@@ -242,8 +231,7 @@ restack() | |
} | |
void | |
-togglemode(Arg *arg) | |
-{ | |
+togglemode(Arg *arg) { | |
arrange = (arrange == dofloat) ? dotile : dofloat; | |
if(sel) | |
arrange(NULL); | |
t@@ -252,8 +240,7 @@ togglemode(Arg *arg) | |
} | |
void | |
-toggleview(Arg *arg) | |
-{ | |
+toggleview(Arg *arg) { | |
unsigned int i; | |
seltag[arg->i] = !seltag[arg->i]; | |
t@@ -265,8 +252,7 @@ toggleview(Arg *arg) | |
} | |
void | |
-view(Arg *arg) | |
-{ | |
+view(Arg *arg) { | |
unsigned int i; | |
for(i = 0; i < ntags; i++) | |
t@@ -277,8 +263,7 @@ view(Arg *arg) | |
} | |
void | |
-viewall(Arg *arg) | |
-{ | |
+viewall(Arg *arg) { | |
unsigned int i; | |
for(i = 0; i < ntags; i++) | |
t@@ -288,8 +273,7 @@ viewall(Arg *arg) | |
} | |
void | |
-zoom(Arg *arg) | |
-{ | |
+zoom(Arg *arg) { | |
unsigned int n; | |
Client *c; | |