sanitized names
authorAnselm R. Garbe <garbeam@wmii.de>
Fri, 14 Jul 2006 22:54:09 +0200
changeset 74 5370ef170cc9
parent 73 c2ddb9dbbd10
child 75 f08271b7cb20
sanitized names
client.c
draw.c
dwm.h
event.c
key.c
main.c
screen.c
--- a/client.c	Fri Jul 14 22:33:38 2006 +0200
+++ b/client.c	Fri Jul 14 22:54:09 2006 +0200
@@ -17,14 +17,14 @@
 };
 
 Client *
-next(Client *c)
+getnext(Client *c)
 {
 	for(; c && !c->tags[tsel]; c = c->next);
 	return c;
 }
 
 void
-ban_client(Client *c)
+ban(Client *c)
 {
 	XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
 	XMoveWindow(dpy, c->title, c->tx + 2 * sw, c->ty);
@@ -48,7 +48,7 @@
 }
 
 void
-update_name(Client *c)
+settitle(Client *c)
 {
 	XTextProperty name;
 	int n;
@@ -76,7 +76,7 @@
 }
 
 void
-update_size(Client *c)
+setsize(Client *c)
 {
 	XSizeHints size;
 	long msize;
@@ -114,7 +114,7 @@
 }
 
 void
-craise(Client *c)
+higher(Client *c)
 {
 	XRaiseWindow(dpy, c->win);
 	XRaiseWindow(dpy, c->title);
@@ -136,8 +136,8 @@
 	XFlush(dpy);
 	sel = c;
 	if(old && old != c)
-		draw_client(old);
-	draw_client(c);
+		drawtitle(old);
+	drawtitle(c);
 	XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
 	XFlush(dpy);
 	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
@@ -196,8 +196,8 @@
 	c->h = wa->height;
 	c->th = bh;
 	c->border = 1;
-	c->proto = win_proto(c->win);
-	update_size(c);
+	c->proto = proto(c->win);
+	setsize(c);
 	XSelectInput(dpy, c->win,
 			StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
 	XGetTransientForHint(dpy, c->win, &trans);
@@ -210,7 +210,7 @@
 			DefaultVisual(dpy, screen),
 			CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
 
-	update_name(c);
+	settitle(c);
 	init_tags(c);
 
 	for(l = &clients; *l; l = &(*l)->next);
@@ -236,7 +236,7 @@
 		focus(c);
 	}
 	else {
-		ban_client(c);
+		ban(c);
 		XMapRaised(dpy, c->win);
 		XMapRaised(dpy, c->title);
 	}
@@ -339,7 +339,7 @@
 }
 
 static int
-dummy_error_handler(Display *dsply, XErrorEvent *err)
+dummy_xerror(Display *dsply, XErrorEvent *err)
 {
 	return 0;
 }
@@ -350,7 +350,7 @@
 	Client **l;
 
 	XGrabServer(dpy);
-	XSetErrorHandler(dummy_error_handler);
+	XSetErrorHandler(dummy_xerror);
 
 	XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
 	XDestroyWindow(dpy, c->title);
@@ -366,7 +366,7 @@
 	free(c);
 
 	XFlush(dpy);
-	XSetErrorHandler(error_handler);
+	XSetErrorHandler(xerror);
 	XUngrabServer(dpy);
 	arrange(NULL);
 	if(sel)
--- a/draw.c	Fri Jul 14 22:33:38 2006 +0200
+++ b/draw.c	Fri Jul 14 22:54:09 2006 +0200
@@ -11,7 +11,7 @@
 #include "dwm.h"
 
 void
-draw_bar()
+drawstatus()
 {
 	int i;
 
@@ -44,11 +44,11 @@
 }
 
 void
-draw_client(Client *c)
+drawtitle(Client *c)
 {
 	int i;
 	if(c == sel) {
-		draw_bar();
+		drawstatus();
 		XUnmapWindow(dpy, c->title);
 		XSetWindowBorder(dpy, c->win, dc.fg);
 		return;
@@ -145,7 +145,7 @@
 }
 
 unsigned long
-initcolor(const char *colstr)
+getcolor(const char *colstr)
 {
 	XColor color;
 	Colormap cmap = DefaultColormap(dpy, screen);
@@ -172,7 +172,7 @@
 }
 
 void
-initfont(const char *fontstr)
+setfont(const char *fontstr)
 {
 	char **missing, *def;
 	int i, n;
--- a/dwm.h	Fri Jul 14 22:33:38 2006 +0200
+++ b/dwm.h	Fri Jul 14 22:54:09 2006 +0200
@@ -107,22 +107,22 @@
 extern void unmanage(Client *c);
 extern Client *getclient(Window w);
 extern void focus(Client *c);
-extern void update_name(Client *c);
+extern void settitle(Client *c);
 extern void resize(Client *c, Bool inc);
-extern void update_size(Client *c);
+extern void setsize(Client *c);
 extern Client *gettitle(Window w);
-extern void craise(Client *c);
+extern void higher(Client *c);
 extern void lower(Client *c);
 extern void gravitate(Client *c, Bool invert);
-extern void ban_client(Client *c);
-extern Client *next(Client *c);
+extern void ban(Client *c);
+extern Client *getnext(Client *c);
 
 /* draw.c */
-extern void draw_bar();
-extern void draw_client(Client *c);
+extern void drawstatus();
+extern void drawtitle(Client *c);
 extern void drawtext(const char *text, Bool invert, Bool border);
-extern unsigned long initcolor(const char *colstr);
-extern void initfont(const char *fontstr);
+extern unsigned long getcolor(const char *colstr);
+extern void setfont(const char *fontstr);
 extern unsigned int textnw(char *text, unsigned int len);
 extern unsigned int textw(char *text);
 extern unsigned int texth(void);
@@ -132,9 +132,9 @@
 extern void keypress(XEvent *e);
 
 /* main.c */
-extern int error_handler(Display *dsply, XErrorEvent *e);
-extern void send_message(Window w, Atom a, long value);
-extern int win_proto(Window w);
+extern int xerror(Display *dsply, XErrorEvent *e);
+extern void sendevent(Window w, Atom a, long value);
+extern int proto(Window w);
 extern void quit(Arg *arg);
 
 /* screen.c */
--- a/event.c	Fri Jul 14 22:33:38 2006 +0200
+++ b/event.c	Fri Jul 14 22:54:09 2006 +0200
@@ -129,7 +129,7 @@
 	else if((c = getclient(ev->window))) {
 		if(arrange == tiling && !c->floating)
 			return;
-		craise(c);
+		higher(c);
 		switch(ev->button) {
 		default:
 			break;
@@ -225,9 +225,9 @@
 
 	if(ev->count == 0) {
 		if(barwin == ev->window)
-			draw_bar();
+			drawstatus();
 		else if((c = gettitle(ev->window)))
-			draw_client(c);
+			drawtitle(c);
 	}
 }
 
@@ -262,7 +262,7 @@
 
 	if((c = getclient(ev->window))) {
 		if(ev->atom == wm_atom[WMProtocols]) {
-			c->proto = win_proto(c->win);
+			c->proto = proto(c->win);
 			return;
 		}
 		switch (ev->atom) {
@@ -273,12 +273,12 @@
 					arrange(NULL);
 				break;
 			case XA_WM_NORMAL_HINTS:
-				update_size(c);
+				setsize(c);
 				break;
 		}
 		if(ev->atom == XA_WM_NAME || ev->atom == net_atom[NetWMName]) {
-			update_name(c);
-			draw_client(c);
+			settitle(c);
+			drawtitle(c);
 		}
 	}
 }
--- a/key.c	Fri Jul 14 22:33:38 2006 +0200
+++ b/key.c	Fri Jul 14 22:54:09 2006 +0200
@@ -99,8 +99,8 @@
 	if(!sel)
 		return;
 
-	if(sel == next(clients) && sel->next)  {
-		if((c = next(sel->next)))
+	if(sel == getnext(clients) && sel->next)  {
+		if((c = getnext(sel->next)))
 			sel = c;
 	}
 
@@ -122,7 +122,7 @@
 	sel->y = sy + bh;
 	sel->w = sw - 2 * sel->border;
 	sel->h = sh - 2 * sel->border - bh;
-	craise(sel);
+	higher(sel);
 	resize(sel, False);
 }
 
@@ -157,7 +157,7 @@
 		return;
 
 	if((c = sel->revert && sel->revert->tags[tsel] ? sel->revert : NULL)) {
-		craise(c);
+		higher(c);
 		focus(c);
 	}
 }
@@ -170,10 +170,10 @@
 	if(!sel)
 		return;
 
-	if(!(c = next(sel->next)))
-		c = next(clients);
+	if(!(c = getnext(sel->next)))
+		c = getnext(clients);
 	if(c) {
-		craise(c);
+		higher(c);
 		c->revert = sel;
 		focus(c);
 	}
@@ -185,7 +185,7 @@
 	if(!sel)
 		return;
 	if(sel->proto & WM_PROTOCOL_DELWIN)
-		send_message(sel->win, wm_atom[WMProtocols], wm_atom[WMDelete]);
+		sendevent(sel->win, wm_atom[WMProtocols], wm_atom[WMDelete]);
 	else
 		XKillClient(dpy, sel->win);
 }
--- a/main.c	Fri Jul 14 22:33:38 2006 +0200
+++ b/main.c	Fri Jul 14 22:54:09 2006 +0200
@@ -46,7 +46,7 @@
 static Bool other_wm_running;
 static const char version[] =
 	"dwm-" VERSION ", (C)opyright MMVI Anselm R. Garbe\n";
-static int (*x_error_handler) (Display *, XErrorEvent *);
+static int (*x_xerror) (Display *, XErrorEvent *);
 
 static void
 usage() {	error("usage: dwm [-v]\n"); }
@@ -94,7 +94,7 @@
 }
 
 int
-win_proto(Window w)
+proto(Window w)
 {
 	unsigned char *protocols;
 	long res;
@@ -114,7 +114,7 @@
 }
 
 void
-send_message(Window w, Atom a, long value)
+sendevent(Window w, Atom a, long value)
 {
 	XEvent e;
 
@@ -135,7 +135,7 @@
  * calls exit().
  */
 int
-error_handler(Display *dpy, XErrorEvent *error)
+xerror(Display *dpy, XErrorEvent *error)
 {
 	if(error->error_code == BadWindow
 			|| (error->request_code == X_SetInputFocus
@@ -153,7 +153,7 @@
 		return 0;
 	fprintf(stderr, "dwm: fatal error: request code=%d, error code=%d\n",
 			error->request_code, error->error_code);
-	return x_error_handler(dpy, error); /* may call exit() */
+	return x_xerror(dpy, error); /* may call exit() */
 }
 
 /*
@@ -161,7 +161,7 @@
  * is already running.
  */
 static int
-startup_error_handler(Display *dpy, XErrorEvent *error)
+startup_xerror(Display *dpy, XErrorEvent *error)
 {
 	other_wm_running = True;
 	return -1;
@@ -215,7 +215,7 @@
 
 	/* check if another WM is already running */
 	other_wm_running = False;
-	XSetErrorHandler(startup_error_handler);
+	XSetErrorHandler(startup_xerror);
 	/* this causes an error if some other WM is running */
 	XSelectInput(dpy, root, SubstructureRedirectMask);
 	XFlush(dpy);
@@ -224,7 +224,7 @@
 		error("dwm: another window manager is already running\n");
 
 	XSetErrorHandler(0);
-	x_error_handler = XSetErrorHandler(error_handler);
+	x_xerror = XSetErrorHandler(xerror);
 
 	/* init atoms */
 	wm_atom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
@@ -242,10 +242,10 @@
 	grabkeys();
 
 	/* style */
-	dc.bg = initcolor(BGCOLOR);
-	dc.fg = initcolor(FGCOLOR);
-	dc.border = initcolor(BORDERCOLOR);
-	initfont(FONT);
+	dc.bg = getcolor(BGCOLOR);
+	dc.fg = getcolor(FGCOLOR);
+	dc.border = getcolor(BORDERCOLOR);
+	setfont(FONT);
 
 	sx = sy = 0;
 	sw = DisplayWidth(dpy, screen);
@@ -267,7 +267,7 @@
 
 	dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
 	dc.gc = XCreateGC(dpy, root, 0, 0);
-	draw_bar();
+	drawstatus();
 
 	issel = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask);
 
@@ -315,7 +315,7 @@
 					stext[n++] = i;
 				}
 				stext[n] = 0;
-				draw_bar();
+				drawstatus();
 			}
 		}
 	}
--- a/screen.c	Fri Jul 14 22:33:38 2006 +0200
+++ b/screen.c	Fri Jul 14 22:54:09 2006 +0200
@@ -15,9 +15,9 @@
 	tsel = arg->i;
 	arrange(NULL);
 
-	for(c = clients; c; c = next(c->next))
-		draw_client(c);
-	draw_bar();
+	for(c = clients; c; c = getnext(c->next))
+		drawtitle(c);
+	drawstatus();
 }
 
 void
@@ -30,15 +30,15 @@
 		if(c->tags[tsel])
 			resize(c, True);
 		else
-			ban_client(c);
+			ban(c);
 	}
 	if(sel && !sel->tags[tsel]) {
-		if((sel = next(clients))) {
-			craise(sel);
+		if((sel = getnext(clients))) {
+			higher(sel);
 			focus(sel);
 		}
 	}
-	draw_bar();
+	drawstatus();
 }
 
 void
@@ -61,7 +61,7 @@
 	for(i = 0, c = clients; c; c = c->next) {
 		if(c->tags[tsel]) {
 			if(c->floating) {
-				craise(c);
+				higher(c);
 				resize(c, True);
 				continue;
 			}
@@ -87,14 +87,14 @@
 			i++;
 		}
 		else
-			ban_client(c);
+			ban(c);
 	}
 	if(!sel || (sel && !sel->tags[tsel])) {
-		if((sel = next(clients))) {
-			craise(sel);
+		if((sel = getnext(clients))) {
+			higher(sel);
 			focus(sel);
 		}
 	}
-	draw_bar();
+	drawstatus();
 }