about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAnselm R. Garbe <garbeam@wmii.de>2006-07-13 01:55:54 +0200
committerAnselm R. Garbe <garbeam@wmii.de>2006-07-13 01:55:54 +0200
commitd7e17087ed2fc5eed57efa03e81460e3e41f7238 (patch)
treeefaa34fdd54e485be21c5e98f617678a61e4a9e1
parent8b59083eb13c0712e04d9a5b6d7bf4af5913c442 (diff)
downloaddwm-d7e17087ed2fc5eed57efa03e81460e3e41f7238.tar.gz
new stuff (some warning elimination)
-rw-r--r--client.c6
-rw-r--r--config.mk9
-rw-r--r--draw.c27
-rw-r--r--kb.c6
-rw-r--r--util.c4
-rw-r--r--wm.c10
-rw-r--r--wm.h29
7 files changed, 44 insertions, 47 deletions
diff --git a/client.c b/client.c
index 46e6e83..6777473 100644
--- a/client.c
+++ b/client.c
@@ -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);
diff --git a/config.mk b/config.mk
index 41cb070..9857f93 100644
--- a/config.mk
+++ b/config.mk
@@ -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}\"
diff --git a/draw.c b/draw.c
index 53af1cd..1046322 100644
--- a/draw.c
+++ b/draw.c
@@ -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);
diff --git a/kb.c b/kb.c
index 2f16910..f93f69f 100644
--- a/kb.c
+++ b/kb.c
@@ -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;
diff --git a/util.c b/util.c
index 1d37906..09fd872 100644
--- a/util.c
+++ b/util.c
@@ -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;
diff --git a/wm.c b/wm.c
index 1895015..6d67bfc 100644
--- a/wm.c
+++ b/wm.c
@@ -174,12 +174,6 @@ cleanup()
 }
 
 void
-run(void *aux)
-{
-	spawn(dpy, aux);
-}
-
-void
 quit(void *aux)
 {
 	running = False;
@@ -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);
 
diff --git a/wm.h b/wm.h
index 831c178..b5e1f71 100644
--- a/wm.h
+++ b/wm.h
@@ -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);
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651