summary refs log tree commit diff
path: root/calmwm.c
diff options
context:
space:
mode:
authoroga <oga>2008-01-16 11:39:20 +0000
committeroga <oga>2008-01-16 11:39:20 +0000
commit7fb2664f92a087762ab58158ab5c4f7c442bcd1b (patch)
tree3a933e2d545f729de0a4340161f080c762693619 /calmwm.c
parent1eed217b1c54d32d3c9269be79c3cb298b4b2805 (diff)
downloadcwm-7fb2664f92a087762ab58158ab5c4f7c442bcd1b.tar.gz
cwm-7fb2664f92a087762ab58158ab5c4f7c442bcd1b.tar.xz
cwm-7fb2664f92a087762ab58158ab5c4f7c442bcd1b.zip
huge amount of cleanup and dead code removal.
full description of changes:
-remove fontlist, and all associated structures/calls, it's not needed.
 this also removes any doubt about leftover 9wm code (the list was
 borrowed from it). Since cwm now uses Xft for everything, the legacy
 font handling is just not needed.
-add /* FALLTHROUGH */ comments into grab_{label,menu}. I actually
 didn't intend grab_menu to be a fallthrough, but it actually works quite
 well there, so remove the extra rectangle drawing. I love it when that
 happens.
-remove a couple of unused prototypes that were obviously missed
 before.
-remove a bunch of commented out or if 0ed out code. It doesn't look to
 be coming back anytime soon.
-several functions returned an int, but this was never checked. most of
 them only failed if they failed to grab the pointer (thus the internal
 state didn't change), so just make them void and return early if this is
 the case.
-remove several unused functions and some useless variables.

knocks something like 200bytes off the stripped binary size for me.

ok marc@, tested by several others.
Diffstat (limited to 'calmwm.c')
-rw-r--r--calmwm.c45
1 files changed, 5 insertions, 40 deletions
diff --git a/calmwm.c b/calmwm.c
index 5c91b2f..49584a1 100644
--- a/calmwm.c
+++ b/calmwm.c
@@ -22,7 +22,6 @@
 #include "calmwm.h"
 
 Display				*X_Dpy;
-XFontStruct			*X_Font;
 
 Cursor				 Cursor_move;
 Cursor				 Cursor_resize;
@@ -47,15 +46,6 @@ char                            *DefaultFontName;
 #define gray_height 2
 static char gray_bits[] = {0x02, 0x01};
 
-/* List borrowed from 9wm/rio */
-char *tryfonts[] = {
-	"9x15bold",
-	"*-lucidatypewriter-bold-*-14-*-75-*",
-	"*-lucidatypewriter-medium-*-12-*-75-*",
-	"fixed",
-	"*",
-	NULL,
-};
 
 static void _sigchld_cb(int);
 
@@ -140,15 +130,6 @@ x_setup(char *display_name)
 
 	Doshape = XShapeQueryExtension(X_Dpy, &Shape_ev, &i);
 
-	i = 0;
-	while ((fontname = tryfonts[i++]) != NULL) {
-		if ((X_Font = XLoadQueryFont(X_Dpy, fontname)) != NULL)
-			break;
-	}
-
-	if (fontname == NULL)
-		errx(1, "Couldn't load any fonts.");
-
 	Nscreens = ScreenCount(X_Dpy);
 	for (i = 0; i < (int)Nscreens; i++) {
 		XMALLOC(sc, struct screen_ctx);
@@ -158,13 +139,12 @@ x_setup(char *display_name)
 
 	Cursor_move = XCreateFontCursor(X_Dpy, XC_fleur);
 	Cursor_resize = XCreateFontCursor(X_Dpy, XC_bottom_right_corner);
-	/* (used to be) XCreateFontCursor(X_Dpy, XC_hand1); */
 	Cursor_select = XCreateFontCursor(X_Dpy, XC_hand1);
 	Cursor_default = XCreateFontCursor(X_Dpy, XC_X_cursor);
 	Cursor_question = XCreateFontCursor(X_Dpy, XC_question_arrow);
 }
 
-int
+void
 x_setupscreen(struct screen_ctx *sc, u_int which)
 {
 	XColor tmp;
@@ -196,10 +176,6 @@ x_setupscreen(struct screen_ctx *sc, u_int which)
 	TAILQ_FOREACH(kb, &Conf.keybindingq, entry)
 		xu_key_grab(sc->rootwin, kb->modmask, kb->keysym);
 
-	/* Special -- for alt state. */
-/* 	xu_key_grab(sc->rootwin, 0, XK_Alt_L); */
-/* 	xu_key_grab(sc->rootwin, 0, XK_Alt_R); */
-
 	sc->blackpixl = BlackPixel(X_Dpy, sc->which);
 	sc->whitepixl = WhitePixel(X_Dpy, sc->which);
 	sc->bluepixl = sc->fccolor.pixel;
@@ -223,32 +199,21 @@ x_setupscreen(struct screen_ctx *sc, u_int which)
 	gv.function = GXxor;
 	gv.line_width = 1;
 	gv.subwindow_mode = IncludeInferiors;
-	gv.font = X_Font->fid;
 
 	sc->gc = XCreateGC(X_Dpy, sc->rootwin,
 	    GCForeground|GCBackground|GCFunction|
-	    GCLineWidth|GCSubwindowMode|GCFont, &gv);
-
-#ifdef notyet
-	gv2.foreground = sc->blackpixl^sc->cyanpixl;
-	gv2.background = sc->cyanpixl;
-	gv2.function = GXxor;
-	gv2.line_width = 1;
-	gv2.subwindow_mode = IncludeInferiors;
-	gv2.font = X_Font->fid;
-#endif
+	    GCLineWidth|GCSubwindowMode, &gv);
 
 	sc->hlgc = XCreateGC(X_Dpy, sc->rootwin,
 	    GCForeground|GCBackground|GCFunction|
-	    GCLineWidth|GCSubwindowMode|GCFont, &gv);
+	    GCLineWidth|GCSubwindowMode, &gv);
 
 	gv1.function = GXinvert;
 	gv1.subwindow_mode = IncludeInferiors;
 	gv1.line_width = 1;
-	gv1.font = X_Font->fid;
 
 	sc->invgc = XCreateGC(X_Dpy, sc->rootwin,
-	    GCFunction|GCSubwindowMode|GCLineWidth|GCFont, &gv1);
+	    GCFunction|GCSubwindowMode|GCLineWidth, &gv1);
 
 	font_init(sc);
 	DefaultFont = font_getx(sc, DefaultFontName);
@@ -290,7 +255,7 @@ x_setupscreen(struct screen_ctx *sc, u_int which)
 
 	XSync(X_Dpy, False);
 
-	return (0);
+	return;
 }
 
 char *