From 475e835196e065d2010dc146b3ca01598b554893 Mon Sep 17 00:00:00 2001 From: oga Date: Wed, 16 Jan 2008 11:39:20 +0000 Subject: 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. --- group.c | 33 ++++++--------------------------- 1 file changed, 6 insertions(+), 27 deletions(-) (limited to 'group.c') diff --git a/group.c b/group.c index 8147fa8..26c0acd 100644 --- a/group.c +++ b/group.c @@ -16,7 +16,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $Id: group.c,v 1.4 2008/01/14 15:21:10 oga Exp $ + * $Id: group.c,v 1.5 2008/01/16 11:39:20 oga Exp $ */ #include "headers.h" @@ -197,36 +197,15 @@ group_init(void) * manipulate the 'current group' */ -#if 0 -/* set current group to the first empty group - * returns 0 on success, -1 if there are no empty groups - */ -int -group_new(void) -{ - int i; - - for (i=0; i < CALMWM_NGROUPS; i++) { - if (TAILQ_EMPTY(&Groups[i].clients)) { - Group_current = &Groups[i]; - - return (0); - } - } - - return (-1); -} -#endif - /* change the current group */ -int +void group_select(int idx) { struct group_ctx *gc = Group_current; struct client_ctx *cc; if (idx < 0 || idx >= CALMWM_NGROUPS) - return (-1); + return; TAILQ_FOREACH(cc, &gc->clients, group_entry) { cc->highlight = 0; @@ -237,7 +216,7 @@ group_select(int idx) Group_current = &Groups[idx]; group_display_draw(screen_current()); - return (0); + return; } /* enter group mode */ @@ -353,7 +332,7 @@ void group_display_draw(struct screen_ctx *sc) { struct group_ctx *gc = Group_current; - int x, y, dx, dy, fontheight, titlelen; + int x, y, dx, dy, fontheight; struct client_ctx *cc; char titlebuf[1024]; struct fontdesc *font = DefaultFont; @@ -363,7 +342,7 @@ group_display_draw(struct screen_ctx *sc) x = y = 0; fontheight = font_ascent(font) + font_descent(font) + 1; - dx = titlelen = font_width(font, titlebuf, strlen(titlebuf)); + dx = font_width(font, titlebuf, strlen(titlebuf)); dy = fontheight; TAILQ_FOREACH(cc, &gc->clients, group_entry) { -- cgit v1.2.3-2-gb3c3