new stuff (some warning elimination)

This commit is contained in:
Anselm R. Garbe 2006-07-13 01:55:54 +02:00
parent 8b59083eb1
commit d7e17087ed
7 changed files with 44 additions and 47 deletions

View file

@ -360,7 +360,7 @@ resize(Client *c)
}
static int
dummy_error_handler(Display *dpy, XErrorEvent *error)
dummy_error_handler(Display *dsply, XErrorEvent *err)
{
return 0;
}
@ -425,12 +425,12 @@ draw_client(Client *c)
if(c->tags[i]) {
brush.x += brush.w;
brush.w = textw(&brush.font, c->tags[i]) + brush.font.height;
draw(dpy, &brush, True, c->tags[i]);
draw(&brush, True, c->tags[i]);
}
}
brush.x += brush.w;
brush.w = textw(&brush.font, c->name) + brush.font.height;
draw(dpy, &brush, True, c->name);
draw(&brush, True, c->name);
XCopyArea(dpy, brush.drawable, c->title, brush.gc,
0, 0, c->tw, c->th, 0, 0);
XFlush(dpy);

View file

@ -14,9 +14,14 @@ VERSION = 0.0
LIBS = -L${PREFIX}/lib -L/usr/lib -lc -lm -L${X11LIB} -lX11
# Linux/BSD
CFLAGS = -g -Wall -O2 -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \
CFLAGS = -Os -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \
-DVERSION=\"${VERSION}\"
LDFLAGS = -g ${LIBS}
LDFLAGS = ${LIBS}
#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
#CFLAGS = -g -Wall -O2 -I. -I${PREFIX}/include -I/usr/include -I${X11INC} \
# -DVERSION=\"${VERSION}\"
#LDFLAGS = -g ${LIBS}
# Solaris
#CFLAGS = -fast -xtarget=ultra ${INCLUDES} -DVERSION=\"${VERSION}\"

27
draw.c
View file

@ -11,7 +11,7 @@
#include "wm.h"
static void
drawborder(Display *dpy, Brush *b)
drawborder(Brush *b)
{
XPoint points[5];
XSetLineAttributes(dpy, b->gc, 1, LineSolid, CapButt, JoinMiter);
@ -30,9 +30,10 @@ drawborder(Display *dpy, Brush *b)
}
void
draw(Display *dpy, Brush *b, Bool border, const char *text)
draw(Brush *b, Bool border, const char *text)
{
unsigned int x, y, w, h, len;
int x, y, w, h;
unsigned int len;
static char buf[256];
XGCValues gcv;
XRectangle r = { b->x, b->y, b->w, b->h };
@ -42,7 +43,7 @@ draw(Display *dpy, Brush *b, Bool border, const char *text)
w = 0;
if(border)
drawborder(dpy, b);
drawborder(b);
if(!text)
return;
@ -79,7 +80,7 @@ draw(Display *dpy, Brush *b, Bool border, const char *text)
}
static unsigned long
xloadcolors(Display *dpy, Colormap cmap, const char *colstr)
xloadcolors(Colormap cmap, const char *colstr)
{
XColor color;
XAllocNamedColor(dpy, cmap, colstr, &color, &color);
@ -87,13 +88,13 @@ xloadcolors(Display *dpy, Colormap cmap, const char *colstr)
}
void
loadcolors(Display *dpy, int screen, Brush *b,
loadcolors(int scr, Brush *b,
const char *bg, const char *fg, const char *border)
{
Colormap cmap = DefaultColormap(dpy, screen);
b->bg = xloadcolors(dpy, cmap, bg);
b->fg = xloadcolors(dpy, cmap, fg);
b->border = xloadcolors(dpy, cmap, border);
Colormap cmap = DefaultColormap(dpy, scr);
b->bg = xloadcolors(cmap, bg);
b->fg = xloadcolors(cmap, fg);
b->border = xloadcolors(cmap, border);
}
unsigned int
@ -120,13 +121,12 @@ texth(Fnt *font)
}
void
loadfont(Display *dpy, Fnt *font, const char *fontstr)
loadfont(Fnt *font, const char *fontstr)
{
char **missing, *def;
int n;
int i, n;
missing = NULL;
def = "?";
setlocale(LC_ALL, "");
if(font->set)
XFreeFontSet(dpy, font->set);
@ -144,7 +144,6 @@ loadfont(Display *dpy, Fnt *font, const char *fontstr)
XFontSetExtents *font_extents;
XFontStruct **xfonts;
char **font_names;
unsigned int i;
font->ascent = font->descent = 0;
font_extents = XExtentsOfFontSet(font->set);

6
kb.c
View file

@ -9,13 +9,13 @@
/********** CUSTOMIZE **********/
char *term[] = {
const char *term[] = {
"aterm", "-tr", "+sb", "-bg", "black", "-fg", "white", "-fn",
"-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*",NULL
};
static Key key[] = {
{ Mod1Mask, XK_Return, run, term },
{ Mod1Mask, XK_Return, (void (*)(void *))spawn, term },
{ Mod1Mask, XK_k, sel, "prev" },
{ Mod1Mask, XK_j, sel, "next" },
{ Mod1Mask, XK_g, grid, NULL },
@ -28,7 +28,7 @@ static Key key[] = {
/********** CUSTOMIZE **********/
void
update_keys()
update_keys(void)
{
unsigned int i, len;
KeyCode code;

4
util.c
View file

@ -14,7 +14,7 @@
#include "wm.h"
void
error(char *errstr, ...) {
error(const char *errstr, ...) {
va_list ap;
va_start(ap, errstr);
vfprintf(stderr, errstr, ap);
@ -75,7 +75,7 @@ swap(void **p1, void **p2)
}
void
spawn(Display *dpy, char *argv[])
spawn(char *argv[])
{
if(!argv || !argv[0])
return;

10
wm.c
View file

@ -173,12 +173,6 @@ cleanup()
XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
}
void
run(void *aux)
{
spawn(dpy, aux);
}
void
quit(void *aux)
{
@ -250,8 +244,8 @@ main(int argc, char *argv[])
update_keys();
/* style */
loadcolors(dpy, screen, &brush, BGCOLOR, FGCOLOR, BORDERCOLOR);
loadfont(dpy, &brush.font, FONT);
loadcolors(screen, &brush, BGCOLOR, FGCOLOR, BORDERCOLOR);
loadfont(&brush.font, FONT);
th = texth(&brush.font);

29
wm.h
View file

@ -87,15 +87,6 @@ extern char stext[1024], *tags[TLast];
extern Brush brush;
extern Client *clients, *stack;
/* draw.c */
extern void draw(Display *dpy, Brush *b, Bool border, const char *text);
extern void loadcolors(Display *dpy, int screen, Brush *b,
const char *bg, const char *fg, const char *bo);
extern void loadfont(Display *dpy, Fnt *font, const char *fontstr);
extern unsigned int textnw(Fnt *font, char *text, unsigned int len);
extern unsigned int textw(Fnt *font, char *text);
extern unsigned int texth(Fnt *font);
/* client.c */
extern void manage(Window w, XWindowAttributes *wa);
extern void unmanage(Client *c);
@ -115,11 +106,20 @@ extern void floating(void *aux);
extern void grid(void *aux);
extern void gravitate(Client *c, Bool invert);
/* draw.c */
extern void draw(Brush *b, Bool border, const char *text);
extern void loadcolors(int scr, Brush *b,
const char *bg, const char *fg, const char *bo);
extern void loadfont(Fnt *font, const char *fontstr);
extern unsigned int textnw(Fnt *font, char *text, unsigned int len);
extern unsigned int textw(Fnt *font, char *text);
extern unsigned int texth(Fnt *font);
/* event.c */
extern void discard_events(long even_mask);
/* key.c */
extern void update_keys();
/* kb.c */
extern void update_keys(void);
extern void keypress(XEvent *e);
/* mouse.c */
@ -127,17 +127,16 @@ extern void mresize(Client *c);
extern void mmove(Client *c);
/* util.c */
extern void error(char *errstr, ...);
extern void error(const char *errstr, ...);
extern void *emallocz(unsigned int size);
extern void *emalloc(unsigned int size);
extern void *erealloc(void *ptr, unsigned int size);
extern char *estrdup(const char *str);
extern void spawn(Display *dpy, char *argv[]);
extern void spawn(char *argv[]);
extern void swap(void **p1, void **p2);
/* wm.c */
extern int error_handler(Display *dpy, XErrorEvent *error);
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 void run(void *aux);
extern void quit(void *aux);