mirror of git://git.suckless.org/dwm
new stuff (some warning elimination)
This commit is contained in:
parent
8b59083eb1
commit
d7e17087ed
6
client.c
6
client.c
|
@ -360,7 +360,7 @@ resize(Client *c)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
dummy_error_handler(Display *dpy, XErrorEvent *error)
|
dummy_error_handler(Display *dsply, XErrorEvent *err)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -425,12 +425,12 @@ draw_client(Client *c)
|
||||||
if(c->tags[i]) {
|
if(c->tags[i]) {
|
||||||
brush.x += brush.w;
|
brush.x += brush.w;
|
||||||
brush.w = textw(&brush.font, c->tags[i]) + brush.font.height;
|
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.x += brush.w;
|
||||||
brush.w = textw(&brush.font, c->name) + brush.font.height;
|
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,
|
XCopyArea(dpy, brush.drawable, c->title, brush.gc,
|
||||||
0, 0, c->tw, c->th, 0, 0);
|
0, 0, c->tw, c->th, 0, 0);
|
||||||
XFlush(dpy);
|
XFlush(dpy);
|
||||||
|
|
|
@ -14,9 +14,14 @@ VERSION = 0.0
|
||||||
LIBS = -L${PREFIX}/lib -L/usr/lib -lc -lm -L${X11LIB} -lX11
|
LIBS = -L${PREFIX}/lib -L/usr/lib -lc -lm -L${X11LIB} -lX11
|
||||||
|
|
||||||
# Linux/BSD
|
# 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}\"
|
-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
|
# Solaris
|
||||||
#CFLAGS = -fast -xtarget=ultra ${INCLUDES} -DVERSION=\"${VERSION}\"
|
#CFLAGS = -fast -xtarget=ultra ${INCLUDES} -DVERSION=\"${VERSION}\"
|
||||||
|
|
27
draw.c
27
draw.c
|
@ -11,7 +11,7 @@
|
||||||
#include "wm.h"
|
#include "wm.h"
|
||||||
|
|
||||||
static void
|
static void
|
||||||
drawborder(Display *dpy, Brush *b)
|
drawborder(Brush *b)
|
||||||
{
|
{
|
||||||
XPoint points[5];
|
XPoint points[5];
|
||||||
XSetLineAttributes(dpy, b->gc, 1, LineSolid, CapButt, JoinMiter);
|
XSetLineAttributes(dpy, b->gc, 1, LineSolid, CapButt, JoinMiter);
|
||||||
|
@ -30,9 +30,10 @@ drawborder(Display *dpy, Brush *b)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
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];
|
static char buf[256];
|
||||||
XGCValues gcv;
|
XGCValues gcv;
|
||||||
XRectangle r = { b->x, b->y, b->w, b->h };
|
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;
|
w = 0;
|
||||||
if(border)
|
if(border)
|
||||||
drawborder(dpy, b);
|
drawborder(b);
|
||||||
|
|
||||||
if(!text)
|
if(!text)
|
||||||
return;
|
return;
|
||||||
|
@ -79,7 +80,7 @@ draw(Display *dpy, Brush *b, Bool border, const char *text)
|
||||||
}
|
}
|
||||||
|
|
||||||
static unsigned long
|
static unsigned long
|
||||||
xloadcolors(Display *dpy, Colormap cmap, const char *colstr)
|
xloadcolors(Colormap cmap, const char *colstr)
|
||||||
{
|
{
|
||||||
XColor color;
|
XColor color;
|
||||||
XAllocNamedColor(dpy, cmap, colstr, &color, &color);
|
XAllocNamedColor(dpy, cmap, colstr, &color, &color);
|
||||||
|
@ -87,13 +88,13 @@ xloadcolors(Display *dpy, Colormap cmap, const char *colstr)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
loadcolors(Display *dpy, int screen, Brush *b,
|
loadcolors(int scr, Brush *b,
|
||||||
const char *bg, const char *fg, const char *border)
|
const char *bg, const char *fg, const char *border)
|
||||||
{
|
{
|
||||||
Colormap cmap = DefaultColormap(dpy, screen);
|
Colormap cmap = DefaultColormap(dpy, scr);
|
||||||
b->bg = xloadcolors(dpy, cmap, bg);
|
b->bg = xloadcolors(cmap, bg);
|
||||||
b->fg = xloadcolors(dpy, cmap, fg);
|
b->fg = xloadcolors(cmap, fg);
|
||||||
b->border = xloadcolors(dpy, cmap, border);
|
b->border = xloadcolors(cmap, border);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int
|
unsigned int
|
||||||
|
@ -120,13 +121,12 @@ texth(Fnt *font)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
loadfont(Display *dpy, Fnt *font, const char *fontstr)
|
loadfont(Fnt *font, const char *fontstr)
|
||||||
{
|
{
|
||||||
char **missing, *def;
|
char **missing, *def;
|
||||||
int n;
|
int i, n;
|
||||||
|
|
||||||
missing = NULL;
|
missing = NULL;
|
||||||
def = "?";
|
|
||||||
setlocale(LC_ALL, "");
|
setlocale(LC_ALL, "");
|
||||||
if(font->set)
|
if(font->set)
|
||||||
XFreeFontSet(dpy, font->set);
|
XFreeFontSet(dpy, font->set);
|
||||||
|
@ -144,7 +144,6 @@ loadfont(Display *dpy, Fnt *font, const char *fontstr)
|
||||||
XFontSetExtents *font_extents;
|
XFontSetExtents *font_extents;
|
||||||
XFontStruct **xfonts;
|
XFontStruct **xfonts;
|
||||||
char **font_names;
|
char **font_names;
|
||||||
unsigned int i;
|
|
||||||
|
|
||||||
font->ascent = font->descent = 0;
|
font->ascent = font->descent = 0;
|
||||||
font_extents = XExtentsOfFontSet(font->set);
|
font_extents = XExtentsOfFontSet(font->set);
|
||||||
|
|
6
kb.c
6
kb.c
|
@ -9,13 +9,13 @@
|
||||||
|
|
||||||
/********** CUSTOMIZE **********/
|
/********** CUSTOMIZE **********/
|
||||||
|
|
||||||
char *term[] = {
|
const char *term[] = {
|
||||||
"aterm", "-tr", "+sb", "-bg", "black", "-fg", "white", "-fn",
|
"aterm", "-tr", "+sb", "-bg", "black", "-fg", "white", "-fn",
|
||||||
"-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*",NULL
|
"-*-terminus-medium-*-*-*-13-*-*-*-*-*-iso10646-*",NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
static Key key[] = {
|
static Key key[] = {
|
||||||
{ Mod1Mask, XK_Return, run, term },
|
{ Mod1Mask, XK_Return, (void (*)(void *))spawn, term },
|
||||||
{ Mod1Mask, XK_k, sel, "prev" },
|
{ Mod1Mask, XK_k, sel, "prev" },
|
||||||
{ Mod1Mask, XK_j, sel, "next" },
|
{ Mod1Mask, XK_j, sel, "next" },
|
||||||
{ Mod1Mask, XK_g, grid, NULL },
|
{ Mod1Mask, XK_g, grid, NULL },
|
||||||
|
@ -28,7 +28,7 @@ static Key key[] = {
|
||||||
/********** CUSTOMIZE **********/
|
/********** CUSTOMIZE **********/
|
||||||
|
|
||||||
void
|
void
|
||||||
update_keys()
|
update_keys(void)
|
||||||
{
|
{
|
||||||
unsigned int i, len;
|
unsigned int i, len;
|
||||||
KeyCode code;
|
KeyCode code;
|
||||||
|
|
4
util.c
4
util.c
|
@ -14,7 +14,7 @@
|
||||||
#include "wm.h"
|
#include "wm.h"
|
||||||
|
|
||||||
void
|
void
|
||||||
error(char *errstr, ...) {
|
error(const char *errstr, ...) {
|
||||||
va_list ap;
|
va_list ap;
|
||||||
va_start(ap, errstr);
|
va_start(ap, errstr);
|
||||||
vfprintf(stderr, errstr, ap);
|
vfprintf(stderr, errstr, ap);
|
||||||
|
@ -75,7 +75,7 @@ swap(void **p1, void **p2)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
spawn(Display *dpy, char *argv[])
|
spawn(char *argv[])
|
||||||
{
|
{
|
||||||
if(!argv || !argv[0])
|
if(!argv || !argv[0])
|
||||||
return;
|
return;
|
||||||
|
|
10
wm.c
10
wm.c
|
@ -173,12 +173,6 @@ cleanup()
|
||||||
XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
|
XSetInputFocus(dpy, PointerRoot, RevertToPointerRoot, CurrentTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
run(void *aux)
|
|
||||||
{
|
|
||||||
spawn(dpy, aux);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
quit(void *aux)
|
quit(void *aux)
|
||||||
{
|
{
|
||||||
|
@ -250,8 +244,8 @@ main(int argc, char *argv[])
|
||||||
update_keys();
|
update_keys();
|
||||||
|
|
||||||
/* style */
|
/* style */
|
||||||
loadcolors(dpy, screen, &brush, BGCOLOR, FGCOLOR, BORDERCOLOR);
|
loadcolors(screen, &brush, BGCOLOR, FGCOLOR, BORDERCOLOR);
|
||||||
loadfont(dpy, &brush.font, FONT);
|
loadfont(&brush.font, FONT);
|
||||||
|
|
||||||
th = texth(&brush.font);
|
th = texth(&brush.font);
|
||||||
|
|
||||||
|
|
29
wm.h
29
wm.h
|
@ -87,15 +87,6 @@ extern char stext[1024], *tags[TLast];
|
||||||
extern Brush brush;
|
extern Brush brush;
|
||||||
extern Client *clients, *stack;
|
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 */
|
/* client.c */
|
||||||
extern void manage(Window w, XWindowAttributes *wa);
|
extern void manage(Window w, XWindowAttributes *wa);
|
||||||
extern void unmanage(Client *c);
|
extern void unmanage(Client *c);
|
||||||
|
@ -115,11 +106,20 @@ extern void floating(void *aux);
|
||||||
extern void grid(void *aux);
|
extern void grid(void *aux);
|
||||||
extern void gravitate(Client *c, Bool invert);
|
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 */
|
/* event.c */
|
||||||
extern void discard_events(long even_mask);
|
extern void discard_events(long even_mask);
|
||||||
|
|
||||||
/* key.c */
|
/* kb.c */
|
||||||
extern void update_keys();
|
extern void update_keys(void);
|
||||||
extern void keypress(XEvent *e);
|
extern void keypress(XEvent *e);
|
||||||
|
|
||||||
/* mouse.c */
|
/* mouse.c */
|
||||||
|
@ -127,17 +127,16 @@ extern void mresize(Client *c);
|
||||||
extern void mmove(Client *c);
|
extern void mmove(Client *c);
|
||||||
|
|
||||||
/* util.c */
|
/* util.c */
|
||||||
extern void error(char *errstr, ...);
|
extern void error(const char *errstr, ...);
|
||||||
extern void *emallocz(unsigned int size);
|
extern void *emallocz(unsigned int size);
|
||||||
extern void *emalloc(unsigned int size);
|
extern void *emalloc(unsigned int size);
|
||||||
extern void *erealloc(void *ptr, unsigned int size);
|
extern void *erealloc(void *ptr, unsigned int size);
|
||||||
extern char *estrdup(const char *str);
|
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);
|
extern void swap(void **p1, void **p2);
|
||||||
|
|
||||||
/* wm.c */
|
/* 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 void send_message(Window w, Atom a, long value);
|
||||||
extern int win_proto(Window w);
|
extern int win_proto(Window w);
|
||||||
extern void run(void *aux);
|
|
||||||
extern void quit(void *aux);
|
extern void quit(void *aux);
|
||||||
|
|
Loading…
Reference in New Issue