aewl

changeset 33:e90449e03167

new stuff (some warning elimination)
author Anselm R. Garbe <garbeam@wmii.de>
date Thu, 13 Jul 2006 01:55:54 +0200
parents 082c75b937b5
children cd30cce52b78
files client.c config.mk draw.c kb.c util.c wm.c wm.h
diffstat 7 files changed, 44 insertions(+), 47 deletions(-) [+]
line diff
     1.1 --- a/client.c	Thu Jul 13 01:30:55 2006 +0200
     1.2 +++ b/client.c	Thu Jul 13 01:55:54 2006 +0200
     1.3 @@ -360,7 +360,7 @@
     1.4  }
     1.5  
     1.6  static int
     1.7 -dummy_error_handler(Display *dpy, XErrorEvent *error)
     1.8 +dummy_error_handler(Display *dsply, XErrorEvent *err)
     1.9  {
    1.10  	return 0;
    1.11  }
    1.12 @@ -425,12 +425,12 @@
    1.13  		if(c->tags[i]) {
    1.14  			brush.x += brush.w;
    1.15  			brush.w = textw(&brush.font, c->tags[i]) + brush.font.height;
    1.16 -			draw(dpy, &brush, True, c->tags[i]);
    1.17 +			draw(&brush, True, c->tags[i]);
    1.18  		}
    1.19  	}
    1.20  	brush.x += brush.w;
    1.21  	brush.w = textw(&brush.font, c->name) + brush.font.height;
    1.22 -	draw(dpy, &brush, True, c->name);
    1.23 +	draw(&brush, True, c->name);
    1.24  	XCopyArea(dpy, brush.drawable, c->title, brush.gc,
    1.25  			0, 0, c->tw, c->th, 0, 0);
    1.26  	XFlush(dpy);
     2.1 --- a/config.mk	Thu Jul 13 01:30:55 2006 +0200
     2.2 +++ b/config.mk	Thu Jul 13 01:55:54 2006 +0200
     2.3 @@ -14,9 +14,14 @@
     2.4  LIBS = -L${PREFIX}/lib -L/usr/lib -lc -lm -L${X11LIB} -lX11
     2.5  
     2.6  # Linux/BSD
     2.7 -CFLAGS = -g -Wall -O2 -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \
     2.8 +CFLAGS = -Os -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \
     2.9  	-DVERSION=\"${VERSION}\"
    2.10 -LDFLAGS = -g ${LIBS}
    2.11 +LDFLAGS = ${LIBS}
    2.12 +#CFLAGS  += -W -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -Waggregate-return -Wnested-externs -Winline -Wwrite-strings -Wundef -Wsign-compare -Wmissing-prototypes -Wredundant-decls
    2.13 +
    2.14 +#CFLAGS = -g -Wall -O2 -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \
    2.15 +#	-DVERSION=\"${VERSION}\"
    2.16 +#LDFLAGS = -g ${LIBS}
    2.17  
    2.18  # Solaris
    2.19  #CFLAGS = -fast -xtarget=ultra ${INCLUDES} -DVERSION=\"${VERSION}\"
     3.1 --- a/draw.c	Thu Jul 13 01:30:55 2006 +0200
     3.2 +++ b/draw.c	Thu Jul 13 01:55:54 2006 +0200
     3.3 @@ -11,7 +11,7 @@
     3.4  #include "wm.h"
     3.5  
     3.6  static void
     3.7 -drawborder(Display *dpy, Brush *b)
     3.8 +drawborder(Brush *b)
     3.9  {
    3.10  	XPoint points[5];
    3.11  	XSetLineAttributes(dpy, b->gc, 1, LineSolid, CapButt, JoinMiter);
    3.12 @@ -30,9 +30,10 @@
    3.13  }
    3.14  
    3.15  void
    3.16 -draw(Display *dpy, Brush *b, Bool border, const char *text)
    3.17 +draw(Brush *b, Bool border, const char *text)
    3.18  {
    3.19 -	unsigned int x, y, w, h, len;
    3.20 +	int x, y, w, h;
    3.21 +	unsigned int len;
    3.22  	static char buf[256];
    3.23  	XGCValues gcv;
    3.24  	XRectangle r = { b->x, b->y, b->w, b->h };
    3.25 @@ -42,7 +43,7 @@
    3.26  
    3.27  	w = 0;
    3.28  	if(border)
    3.29 -		drawborder(dpy, b);
    3.30 +		drawborder(b);
    3.31  
    3.32  	if(!text)
    3.33  		return;
    3.34 @@ -79,7 +80,7 @@
    3.35  }
    3.36  
    3.37  static unsigned long
    3.38 -xloadcolors(Display *dpy, Colormap cmap, const char *colstr)
    3.39 +xloadcolors(Colormap cmap, const char *colstr)
    3.40  {
    3.41  	XColor color;
    3.42  	XAllocNamedColor(dpy, cmap, colstr, &color, &color);
    3.43 @@ -87,13 +88,13 @@
    3.44  }
    3.45  
    3.46  void
    3.47 -loadcolors(Display *dpy, int screen, Brush *b,
    3.48 +loadcolors(int scr, Brush *b,
    3.49  		const char *bg, const char *fg, const char *border)
    3.50  {
    3.51 -	Colormap cmap = DefaultColormap(dpy, screen);
    3.52 -	b->bg = xloadcolors(dpy, cmap, bg);
    3.53 -	b->fg = xloadcolors(dpy, cmap, fg);
    3.54 -	b->border = xloadcolors(dpy, cmap, border);
    3.55 +	Colormap cmap = DefaultColormap(dpy, scr);
    3.56 +	b->bg = xloadcolors(cmap, bg);
    3.57 +	b->fg = xloadcolors(cmap, fg);
    3.58 +	b->border = xloadcolors(cmap, border);
    3.59  }
    3.60  
    3.61  unsigned int
    3.62 @@ -120,13 +121,12 @@
    3.63  }
    3.64  
    3.65  void
    3.66 -loadfont(Display *dpy, Fnt *font, const char *fontstr)
    3.67 +loadfont(Fnt *font, const char *fontstr)
    3.68  {
    3.69  	char **missing, *def;
    3.70 -	int n;
    3.71 +	int i, n;
    3.72  
    3.73  	missing = NULL;
    3.74 -	def = "?";
    3.75  	setlocale(LC_ALL, "");
    3.76  	if(font->set)
    3.77  		XFreeFontSet(dpy, font->set);
    3.78 @@ -144,7 +144,6 @@
    3.79  		XFontSetExtents *font_extents;
    3.80  		XFontStruct **xfonts;
    3.81  		char **font_names;
    3.82 -		unsigned int i;
    3.83  
    3.84  		font->ascent = font->descent = 0;
    3.85  		font_extents = XExtentsOfFontSet(font->set);
     4.1 --- a/kb.c	Thu Jul 13 01:30:55 2006 +0200
     4.2 +++ b/kb.c	Thu Jul 13 01:55:54 2006 +0200
     4.3 @@ -9,13 +9,13 @@
     4.4  
     4.5  /********** CUSTOMIZE **********/
     4.6  
     4.7 -char *term[] = { 
     4.8 +const char *term[] = { 
     4.9  	"aterm", "-tr", "+sb", "-bg", "black", "-fg", "white", "-fn",
    4.10  	"-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*",NULL
    4.11  };
    4.12  
    4.13  static Key key[] = {
    4.14 -	{ Mod1Mask, XK_Return, run, term },
    4.15 +	{ Mod1Mask, XK_Return, (void (*)(void *))spawn, term },
    4.16  	{ Mod1Mask, XK_k, sel, "prev" }, 
    4.17  	{ Mod1Mask, XK_j, sel, "next" }, 
    4.18  	{ Mod1Mask, XK_g, grid, NULL }, 
    4.19 @@ -28,7 +28,7 @@
    4.20  /********** CUSTOMIZE **********/
    4.21  
    4.22  void
    4.23 -update_keys()
    4.24 +update_keys(void)
    4.25  {
    4.26  	unsigned int i, len;
    4.27  	KeyCode code;
     5.1 --- a/util.c	Thu Jul 13 01:30:55 2006 +0200
     5.2 +++ b/util.c	Thu Jul 13 01:55:54 2006 +0200
     5.3 @@ -14,7 +14,7 @@
     5.4  #include "wm.h"
     5.5  
     5.6  void
     5.7 -error(char *errstr, ...) {
     5.8 +error(const char *errstr, ...) {
     5.9  	va_list ap;
    5.10  	va_start(ap, errstr);
    5.11  	vfprintf(stderr, errstr, ap);
    5.12 @@ -75,7 +75,7 @@
    5.13  }
    5.14  
    5.15  void
    5.16 -spawn(Display *dpy, char *argv[])
    5.17 +spawn(char *argv[])
    5.18  {
    5.19  	if(!argv || !argv[0])
    5.20  		return;
     6.1 --- a/wm.c	Thu Jul 13 01:30:55 2006 +0200
     6.2 +++ b/wm.c	Thu Jul 13 01:55:54 2006 +0200
     6.3 @@ -174,12 +174,6 @@
     6.4  }
     6.5  
     6.6  void
     6.7 -run(void *aux)
     6.8 -{
     6.9 -	spawn(dpy, aux);
    6.10 -}
    6.11 -
    6.12 -void
    6.13  quit(void *aux)
    6.14  {
    6.15  	running = False;
    6.16 @@ -250,8 +244,8 @@
    6.17  	update_keys();
    6.18  
    6.19  	/* style */
    6.20 -	loadcolors(dpy, screen, &brush, BGCOLOR, FGCOLOR, BORDERCOLOR);
    6.21 -	loadfont(dpy, &brush.font, FONT);
    6.22 +	loadcolors(screen, &brush, BGCOLOR, FGCOLOR, BORDERCOLOR);
    6.23 +	loadfont(&brush.font, FONT);
    6.24  
    6.25  	th = texth(&brush.font);
    6.26  
     7.1 --- a/wm.h	Thu Jul 13 01:30:55 2006 +0200
     7.2 +++ b/wm.h	Thu Jul 13 01:55:54 2006 +0200
     7.3 @@ -87,15 +87,6 @@
     7.4  extern Brush brush;
     7.5  extern Client *clients, *stack;
     7.6  
     7.7 -/* draw.c */
     7.8 -extern void draw(Display *dpy, Brush *b, Bool border, const char *text);
     7.9 -extern void loadcolors(Display *dpy, int screen, Brush *b,
    7.10 -		const char *bg, const char *fg, const char *bo);
    7.11 -extern void loadfont(Display *dpy, Fnt *font, const char *fontstr);
    7.12 -extern unsigned int textnw(Fnt *font, char *text, unsigned int len);
    7.13 -extern unsigned int textw(Fnt *font, char *text);
    7.14 -extern unsigned int texth(Fnt *font);
    7.15 -
    7.16  /* client.c */
    7.17  extern void manage(Window w, XWindowAttributes *wa);
    7.18  extern void unmanage(Client *c);
    7.19 @@ -115,11 +106,20 @@
    7.20  extern void grid(void *aux);
    7.21  extern void gravitate(Client *c, Bool invert);
    7.22  
    7.23 +/* draw.c */
    7.24 +extern void draw(Brush *b, Bool border, const char *text);
    7.25 +extern void loadcolors(int scr, Brush *b,
    7.26 +		const char *bg, const char *fg, const char *bo);
    7.27 +extern void loadfont(Fnt *font, const char *fontstr);
    7.28 +extern unsigned int textnw(Fnt *font, char *text, unsigned int len);
    7.29 +extern unsigned int textw(Fnt *font, char *text);
    7.30 +extern unsigned int texth(Fnt *font);
    7.31 +
    7.32  /* event.c */
    7.33  extern void discard_events(long even_mask);
    7.34  
    7.35 -/* key.c */
    7.36 -extern void update_keys();
    7.37 +/* kb.c */
    7.38 +extern void update_keys(void);
    7.39  extern void keypress(XEvent *e);
    7.40  
    7.41  /* mouse.c */
    7.42 @@ -127,17 +127,16 @@
    7.43  extern void mmove(Client *c);
    7.44  
    7.45  /* util.c */
    7.46 -extern void error(char *errstr, ...);
    7.47 +extern void error(const char *errstr, ...);
    7.48  extern void *emallocz(unsigned int size);
    7.49  extern void *emalloc(unsigned int size);
    7.50  extern void *erealloc(void *ptr, unsigned int size);
    7.51  extern char *estrdup(const char *str);
    7.52 -extern void spawn(Display *dpy, char *argv[]);
    7.53 +extern void spawn(char *argv[]);
    7.54  extern void swap(void **p1, void **p2);
    7.55  
    7.56  /* wm.c */
    7.57 -extern int error_handler(Display *dpy, XErrorEvent *error);
    7.58 +extern int error_handler(Display *dsply, XErrorEvent *e);
    7.59  extern void send_message(Window w, Atom a, long value);
    7.60  extern int win_proto(Window w);
    7.61 -extern void run(void *aux);
    7.62  extern void quit(void *aux);