dwm-meillo

changeset 74:5370ef170cc9

sanitized names
author Anselm R. Garbe <garbeam@wmii.de>
date Fri, 14 Jul 2006 22:54:09 +0200
parents c2ddb9dbbd10
children f08271b7cb20
files client.c draw.c dwm.h event.c key.c main.c screen.c
diffstat 7 files changed, 72 insertions(+), 72 deletions(-) [+]
line diff
     1.1 --- a/client.c	Fri Jul 14 22:33:38 2006 +0200
     1.2 +++ b/client.c	Fri Jul 14 22:54:09 2006 +0200
     1.3 @@ -17,14 +17,14 @@
     1.4  };
     1.5  
     1.6  Client *
     1.7 -next(Client *c)
     1.8 +getnext(Client *c)
     1.9  {
    1.10  	for(; c && !c->tags[tsel]; c = c->next);
    1.11  	return c;
    1.12  }
    1.13  
    1.14  void
    1.15 -ban_client(Client *c)
    1.16 +ban(Client *c)
    1.17  {
    1.18  	XMoveWindow(dpy, c->win, c->x + 2 * sw, c->y);
    1.19  	XMoveWindow(dpy, c->title, c->tx + 2 * sw, c->ty);
    1.20 @@ -48,7 +48,7 @@
    1.21  }
    1.22  
    1.23  void
    1.24 -update_name(Client *c)
    1.25 +settitle(Client *c)
    1.26  {
    1.27  	XTextProperty name;
    1.28  	int n;
    1.29 @@ -76,7 +76,7 @@
    1.30  }
    1.31  
    1.32  void
    1.33 -update_size(Client *c)
    1.34 +setsize(Client *c)
    1.35  {
    1.36  	XSizeHints size;
    1.37  	long msize;
    1.38 @@ -114,7 +114,7 @@
    1.39  }
    1.40  
    1.41  void
    1.42 -craise(Client *c)
    1.43 +higher(Client *c)
    1.44  {
    1.45  	XRaiseWindow(dpy, c->win);
    1.46  	XRaiseWindow(dpy, c->title);
    1.47 @@ -136,8 +136,8 @@
    1.48  	XFlush(dpy);
    1.49  	sel = c;
    1.50  	if(old && old != c)
    1.51 -		draw_client(old);
    1.52 -	draw_client(c);
    1.53 +		drawtitle(old);
    1.54 +	drawtitle(c);
    1.55  	XSetInputFocus(dpy, c->win, RevertToPointerRoot, CurrentTime);
    1.56  	XFlush(dpy);
    1.57  	while(XCheckMaskEvent(dpy, EnterWindowMask, &ev));
    1.58 @@ -196,8 +196,8 @@
    1.59  	c->h = wa->height;
    1.60  	c->th = bh;
    1.61  	c->border = 1;
    1.62 -	c->proto = win_proto(c->win);
    1.63 -	update_size(c);
    1.64 +	c->proto = proto(c->win);
    1.65 +	setsize(c);
    1.66  	XSelectInput(dpy, c->win,
    1.67  			StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
    1.68  	XGetTransientForHint(dpy, c->win, &trans);
    1.69 @@ -210,7 +210,7 @@
    1.70  			DefaultVisual(dpy, screen),
    1.71  			CWOverrideRedirect | CWBackPixmap | CWEventMask, &twa);
    1.72  
    1.73 -	update_name(c);
    1.74 +	settitle(c);
    1.75  	init_tags(c);
    1.76  
    1.77  	for(l = &clients; *l; l = &(*l)->next);
    1.78 @@ -236,7 +236,7 @@
    1.79  		focus(c);
    1.80  	}
    1.81  	else {
    1.82 -		ban_client(c);
    1.83 +		ban(c);
    1.84  		XMapRaised(dpy, c->win);
    1.85  		XMapRaised(dpy, c->title);
    1.86  	}
    1.87 @@ -339,7 +339,7 @@
    1.88  }
    1.89  
    1.90  static int
    1.91 -dummy_error_handler(Display *dsply, XErrorEvent *err)
    1.92 +dummy_xerror(Display *dsply, XErrorEvent *err)
    1.93  {
    1.94  	return 0;
    1.95  }
    1.96 @@ -350,7 +350,7 @@
    1.97  	Client **l;
    1.98  
    1.99  	XGrabServer(dpy);
   1.100 -	XSetErrorHandler(dummy_error_handler);
   1.101 +	XSetErrorHandler(dummy_xerror);
   1.102  
   1.103  	XUngrabButton(dpy, AnyButton, AnyModifier, c->win);
   1.104  	XDestroyWindow(dpy, c->title);
   1.105 @@ -366,7 +366,7 @@
   1.106  	free(c);
   1.107  
   1.108  	XFlush(dpy);
   1.109 -	XSetErrorHandler(error_handler);
   1.110 +	XSetErrorHandler(xerror);
   1.111  	XUngrabServer(dpy);
   1.112  	arrange(NULL);
   1.113  	if(sel)
     2.1 --- a/draw.c	Fri Jul 14 22:33:38 2006 +0200
     2.2 +++ b/draw.c	Fri Jul 14 22:54:09 2006 +0200
     2.3 @@ -11,7 +11,7 @@
     2.4  #include "dwm.h"
     2.5  
     2.6  void
     2.7 -draw_bar()
     2.8 +drawstatus()
     2.9  {
    2.10  	int i;
    2.11  
    2.12 @@ -44,11 +44,11 @@
    2.13  }
    2.14  
    2.15  void
    2.16 -draw_client(Client *c)
    2.17 +drawtitle(Client *c)
    2.18  {
    2.19  	int i;
    2.20  	if(c == sel) {
    2.21 -		draw_bar();
    2.22 +		drawstatus();
    2.23  		XUnmapWindow(dpy, c->title);
    2.24  		XSetWindowBorder(dpy, c->win, dc.fg);
    2.25  		return;
    2.26 @@ -145,7 +145,7 @@
    2.27  }
    2.28  
    2.29  unsigned long
    2.30 -initcolor(const char *colstr)
    2.31 +getcolor(const char *colstr)
    2.32  {
    2.33  	XColor color;
    2.34  	Colormap cmap = DefaultColormap(dpy, screen);
    2.35 @@ -172,7 +172,7 @@
    2.36  }
    2.37  
    2.38  void
    2.39 -initfont(const char *fontstr)
    2.40 +setfont(const char *fontstr)
    2.41  {
    2.42  	char **missing, *def;
    2.43  	int i, n;
     3.1 --- a/dwm.h	Fri Jul 14 22:33:38 2006 +0200
     3.2 +++ b/dwm.h	Fri Jul 14 22:54:09 2006 +0200
     3.3 @@ -107,22 +107,22 @@
     3.4  extern void unmanage(Client *c);
     3.5  extern Client *getclient(Window w);
     3.6  extern void focus(Client *c);
     3.7 -extern void update_name(Client *c);
     3.8 +extern void settitle(Client *c);
     3.9  extern void resize(Client *c, Bool inc);
    3.10 -extern void update_size(Client *c);
    3.11 +extern void setsize(Client *c);
    3.12  extern Client *gettitle(Window w);
    3.13 -extern void craise(Client *c);
    3.14 +extern void higher(Client *c);
    3.15  extern void lower(Client *c);
    3.16  extern void gravitate(Client *c, Bool invert);
    3.17 -extern void ban_client(Client *c);
    3.18 -extern Client *next(Client *c);
    3.19 +extern void ban(Client *c);
    3.20 +extern Client *getnext(Client *c);
    3.21  
    3.22  /* draw.c */
    3.23 -extern void draw_bar();
    3.24 -extern void draw_client(Client *c);
    3.25 +extern void drawstatus();
    3.26 +extern void drawtitle(Client *c);
    3.27  extern void drawtext(const char *text, Bool invert, Bool border);
    3.28 -extern unsigned long initcolor(const char *colstr);
    3.29 -extern void initfont(const char *fontstr);
    3.30 +extern unsigned long getcolor(const char *colstr);
    3.31 +extern void setfont(const char *fontstr);
    3.32  extern unsigned int textnw(char *text, unsigned int len);
    3.33  extern unsigned int textw(char *text);
    3.34  extern unsigned int texth(void);
    3.35 @@ -132,9 +132,9 @@
    3.36  extern void keypress(XEvent *e);
    3.37  
    3.38  /* main.c */
    3.39 -extern int error_handler(Display *dsply, XErrorEvent *e);
    3.40 -extern void send_message(Window w, Atom a, long value);
    3.41 -extern int win_proto(Window w);
    3.42 +extern int xerror(Display *dsply, XErrorEvent *e);
    3.43 +extern void sendevent(Window w, Atom a, long value);
    3.44 +extern int proto(Window w);
    3.45  extern void quit(Arg *arg);
    3.46  
    3.47  /* screen.c */
     4.1 --- a/event.c	Fri Jul 14 22:33:38 2006 +0200
     4.2 +++ b/event.c	Fri Jul 14 22:54:09 2006 +0200
     4.3 @@ -129,7 +129,7 @@
     4.4  	else if((c = getclient(ev->window))) {
     4.5  		if(arrange == tiling && !c->floating)
     4.6  			return;
     4.7 -		craise(c);
     4.8 +		higher(c);
     4.9  		switch(ev->button) {
    4.10  		default:
    4.11  			break;
    4.12 @@ -225,9 +225,9 @@
    4.13  
    4.14  	if(ev->count == 0) {
    4.15  		if(barwin == ev->window)
    4.16 -			draw_bar();
    4.17 +			drawstatus();
    4.18  		else if((c = gettitle(ev->window)))
    4.19 -			draw_client(c);
    4.20 +			drawtitle(c);
    4.21  	}
    4.22  }
    4.23  
    4.24 @@ -262,7 +262,7 @@
    4.25  
    4.26  	if((c = getclient(ev->window))) {
    4.27  		if(ev->atom == wm_atom[WMProtocols]) {
    4.28 -			c->proto = win_proto(c->win);
    4.29 +			c->proto = proto(c->win);
    4.30  			return;
    4.31  		}
    4.32  		switch (ev->atom) {
    4.33 @@ -273,12 +273,12 @@
    4.34  					arrange(NULL);
    4.35  				break;
    4.36  			case XA_WM_NORMAL_HINTS:
    4.37 -				update_size(c);
    4.38 +				setsize(c);
    4.39  				break;
    4.40  		}
    4.41  		if(ev->atom == XA_WM_NAME || ev->atom == net_atom[NetWMName]) {
    4.42 -			update_name(c);
    4.43 -			draw_client(c);
    4.44 +			settitle(c);
    4.45 +			drawtitle(c);
    4.46  		}
    4.47  	}
    4.48  }
     5.1 --- a/key.c	Fri Jul 14 22:33:38 2006 +0200
     5.2 +++ b/key.c	Fri Jul 14 22:54:09 2006 +0200
     5.3 @@ -99,8 +99,8 @@
     5.4  	if(!sel)
     5.5  		return;
     5.6  
     5.7 -	if(sel == next(clients) && sel->next)  {
     5.8 -		if((c = next(sel->next)))
     5.9 +	if(sel == getnext(clients) && sel->next)  {
    5.10 +		if((c = getnext(sel->next)))
    5.11  			sel = c;
    5.12  	}
    5.13  
    5.14 @@ -122,7 +122,7 @@
    5.15  	sel->y = sy + bh;
    5.16  	sel->w = sw - 2 * sel->border;
    5.17  	sel->h = sh - 2 * sel->border - bh;
    5.18 -	craise(sel);
    5.19 +	higher(sel);
    5.20  	resize(sel, False);
    5.21  }
    5.22  
    5.23 @@ -157,7 +157,7 @@
    5.24  		return;
    5.25  
    5.26  	if((c = sel->revert && sel->revert->tags[tsel] ? sel->revert : NULL)) {
    5.27 -		craise(c);
    5.28 +		higher(c);
    5.29  		focus(c);
    5.30  	}
    5.31  }
    5.32 @@ -170,10 +170,10 @@
    5.33  	if(!sel)
    5.34  		return;
    5.35  
    5.36 -	if(!(c = next(sel->next)))
    5.37 -		c = next(clients);
    5.38 +	if(!(c = getnext(sel->next)))
    5.39 +		c = getnext(clients);
    5.40  	if(c) {
    5.41 -		craise(c);
    5.42 +		higher(c);
    5.43  		c->revert = sel;
    5.44  		focus(c);
    5.45  	}
    5.46 @@ -185,7 +185,7 @@
    5.47  	if(!sel)
    5.48  		return;
    5.49  	if(sel->proto & WM_PROTOCOL_DELWIN)
    5.50 -		send_message(sel->win, wm_atom[WMProtocols], wm_atom[WMDelete]);
    5.51 +		sendevent(sel->win, wm_atom[WMProtocols], wm_atom[WMDelete]);
    5.52  	else
    5.53  		XKillClient(dpy, sel->win);
    5.54  }
     6.1 --- a/main.c	Fri Jul 14 22:33:38 2006 +0200
     6.2 +++ b/main.c	Fri Jul 14 22:54:09 2006 +0200
     6.3 @@ -46,7 +46,7 @@
     6.4  static Bool other_wm_running;
     6.5  static const char version[] =
     6.6  	"dwm-" VERSION ", (C)opyright MMVI Anselm R. Garbe\n";
     6.7 -static int (*x_error_handler) (Display *, XErrorEvent *);
     6.8 +static int (*x_xerror) (Display *, XErrorEvent *);
     6.9  
    6.10  static void
    6.11  usage() {	error("usage: dwm [-v]\n"); }
    6.12 @@ -94,7 +94,7 @@
    6.13  }
    6.14  
    6.15  int
    6.16 -win_proto(Window w)
    6.17 +proto(Window w)
    6.18  {
    6.19  	unsigned char *protocols;
    6.20  	long res;
    6.21 @@ -114,7 +114,7 @@
    6.22  }
    6.23  
    6.24  void
    6.25 -send_message(Window w, Atom a, long value)
    6.26 +sendevent(Window w, Atom a, long value)
    6.27  {
    6.28  	XEvent e;
    6.29  
    6.30 @@ -135,7 +135,7 @@
    6.31   * calls exit().
    6.32   */
    6.33  int
    6.34 -error_handler(Display *dpy, XErrorEvent *error)
    6.35 +xerror(Display *dpy, XErrorEvent *error)
    6.36  {
    6.37  	if(error->error_code == BadWindow
    6.38  			|| (error->request_code == X_SetInputFocus
    6.39 @@ -153,7 +153,7 @@
    6.40  		return 0;
    6.41  	fprintf(stderr, "dwm: fatal error: request code=%d, error code=%d\n",
    6.42  			error->request_code, error->error_code);
    6.43 -	return x_error_handler(dpy, error); /* may call exit() */
    6.44 +	return x_xerror(dpy, error); /* may call exit() */
    6.45  }
    6.46  
    6.47  /*
    6.48 @@ -161,7 +161,7 @@
    6.49   * is already running.
    6.50   */
    6.51  static int
    6.52 -startup_error_handler(Display *dpy, XErrorEvent *error)
    6.53 +startup_xerror(Display *dpy, XErrorEvent *error)
    6.54  {
    6.55  	other_wm_running = True;
    6.56  	return -1;
    6.57 @@ -215,7 +215,7 @@
    6.58  
    6.59  	/* check if another WM is already running */
    6.60  	other_wm_running = False;
    6.61 -	XSetErrorHandler(startup_error_handler);
    6.62 +	XSetErrorHandler(startup_xerror);
    6.63  	/* this causes an error if some other WM is running */
    6.64  	XSelectInput(dpy, root, SubstructureRedirectMask);
    6.65  	XFlush(dpy);
    6.66 @@ -224,7 +224,7 @@
    6.67  		error("dwm: another window manager is already running\n");
    6.68  
    6.69  	XSetErrorHandler(0);
    6.70 -	x_error_handler = XSetErrorHandler(error_handler);
    6.71 +	x_xerror = XSetErrorHandler(xerror);
    6.72  
    6.73  	/* init atoms */
    6.74  	wm_atom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
    6.75 @@ -242,10 +242,10 @@
    6.76  	grabkeys();
    6.77  
    6.78  	/* style */
    6.79 -	dc.bg = initcolor(BGCOLOR);
    6.80 -	dc.fg = initcolor(FGCOLOR);
    6.81 -	dc.border = initcolor(BORDERCOLOR);
    6.82 -	initfont(FONT);
    6.83 +	dc.bg = getcolor(BGCOLOR);
    6.84 +	dc.fg = getcolor(FGCOLOR);
    6.85 +	dc.border = getcolor(BORDERCOLOR);
    6.86 +	setfont(FONT);
    6.87  
    6.88  	sx = sy = 0;
    6.89  	sw = DisplayWidth(dpy, screen);
    6.90 @@ -267,7 +267,7 @@
    6.91  
    6.92  	dc.drawable = XCreatePixmap(dpy, root, sw, bh, DefaultDepth(dpy, screen));
    6.93  	dc.gc = XCreateGC(dpy, root, 0, 0);
    6.94 -	draw_bar();
    6.95 +	drawstatus();
    6.96  
    6.97  	issel = XQueryPointer(dpy, root, &w, &w, &i, &i, &i, &i, &mask);
    6.98  
    6.99 @@ -315,7 +315,7 @@
   6.100  					stext[n++] = i;
   6.101  				}
   6.102  				stext[n] = 0;
   6.103 -				draw_bar();
   6.104 +				drawstatus();
   6.105  			}
   6.106  		}
   6.107  	}
     7.1 --- a/screen.c	Fri Jul 14 22:33:38 2006 +0200
     7.2 +++ b/screen.c	Fri Jul 14 22:54:09 2006 +0200
     7.3 @@ -15,9 +15,9 @@
     7.4  	tsel = arg->i;
     7.5  	arrange(NULL);
     7.6  
     7.7 -	for(c = clients; c; c = next(c->next))
     7.8 -		draw_client(c);
     7.9 -	draw_bar();
    7.10 +	for(c = clients; c; c = getnext(c->next))
    7.11 +		drawtitle(c);
    7.12 +	drawstatus();
    7.13  }
    7.14  
    7.15  void
    7.16 @@ -30,15 +30,15 @@
    7.17  		if(c->tags[tsel])
    7.18  			resize(c, True);
    7.19  		else
    7.20 -			ban_client(c);
    7.21 +			ban(c);
    7.22  	}
    7.23  	if(sel && !sel->tags[tsel]) {
    7.24 -		if((sel = next(clients))) {
    7.25 -			craise(sel);
    7.26 +		if((sel = getnext(clients))) {
    7.27 +			higher(sel);
    7.28  			focus(sel);
    7.29  		}
    7.30  	}
    7.31 -	draw_bar();
    7.32 +	drawstatus();
    7.33  }
    7.34  
    7.35  void
    7.36 @@ -61,7 +61,7 @@
    7.37  	for(i = 0, c = clients; c; c = c->next) {
    7.38  		if(c->tags[tsel]) {
    7.39  			if(c->floating) {
    7.40 -				craise(c);
    7.41 +				higher(c);
    7.42  				resize(c, True);
    7.43  				continue;
    7.44  			}
    7.45 @@ -87,14 +87,14 @@
    7.46  			i++;
    7.47  		}
    7.48  		else
    7.49 -			ban_client(c);
    7.50 +			ban(c);
    7.51  	}
    7.52  	if(!sel || (sel && !sel->tags[tsel])) {
    7.53 -		if((sel = next(clients))) {
    7.54 -			craise(sel);
    7.55 +		if((sel = getnext(clients))) {
    7.56 +			higher(sel);
    7.57  			focus(sel);
    7.58  		}
    7.59  	}
    7.60 -	draw_bar();
    7.61 +	drawstatus();
    7.62  }
    7.63