diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2008-01-16 11:39:21 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2008-01-16 11:39:21 +0000 |
commit | 64235bdf319891cb1c808dfc5643d3a43e175964 (patch) | |
tree | 3027c252f1ecd5e4eaa277ca73d9f67cde1b337d /app/cwm/calmwm.c | |
parent | 6173bfbec7ad3d75a2e626a2a1c9e75b432d0ae6 (diff) |
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 'app/cwm/calmwm.c')
-rw-r--r-- | app/cwm/calmwm.c | 47 |
1 files changed, 6 insertions, 41 deletions
diff --git a/app/cwm/calmwm.c b/app/cwm/calmwm.c index bbc2cd713..b81d65035 100644 --- a/app/cwm/calmwm.c +++ b/app/cwm/calmwm.c @@ -15,14 +15,13 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: calmwm.c,v 1.6 2008/01/14 15:21:10 oga Exp $ + * $Id: calmwm.c,v 1.7 2008/01/16 11:39:20 oga Exp $ */ #include "headers.h" #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 * |