From 4af4c3825fad7381288400ef15944ebe85bb71bf Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Thu, 17 Sep 2009 09:27:11 -0400 Subject: [PATCH] Makefile cleanup and other general cleanup. --- alternative_wmiircs/python/wmiirc.py | 2 +- cmd/Makefile | 2 +- cmd/menu/Makefile | 2 +- cmd/menu/fns.h | 1 + cmd/menu/main.c | 21 +++++++++++++++------ cmd/menu/menu.c | 22 +++++++++------------- cmd/wmii/Makefile | 3 +-- cmd/wmii/main.c | 2 +- cmd/wmiir.c | 2 +- mk/wmii.mk | 2 ++ util/compile | 2 +- 11 files changed, 34 insertions(+), 27 deletions(-) diff --git a/alternative_wmiircs/python/wmiirc.py b/alternative_wmiircs/python/wmiirc.py index e8e4e37f..350d596d 100644 --- a/alternative_wmiircs/python/wmiirc.py +++ b/alternative_wmiircs/python/wmiirc.py @@ -140,7 +140,7 @@ def clickmenu(choices, args): class Notice(Button): def __init__(self): - super(Notice, self).__init__(*noticebar) + super(Notice, self).__init__(*noticebar, colors=wmii['normcolors']) self.timer = None def tick(self): diff --git a/cmd/Makefile b/cmd/Makefile index d4b5069e..ee7844ec 100644 --- a/cmd/Makefile +++ b/cmd/Makefile @@ -23,7 +23,7 @@ FILTER = sed "s|CONFPREFIX|$(ETC)|g; \ s|AWKPATH|$(AWKPATH)|g" LDFLAGS += -lfmt -lutf -CFLAGS += $(INCX11) -DVERSION=\"$(VERSION)\" +CFLAGS += $(INCX11) include $(ROOT)/mk/many.mk include $(ROOT)/mk/dir.mk diff --git a/cmd/menu/Makefile b/cmd/menu/Makefile index a043b74c..c4365a83 100644 --- a/cmd/menu/Makefile +++ b/cmd/menu/Makefile @@ -16,7 +16,7 @@ PACKAGES += $(X11PACKAGES) xext xrandr xrender xinerama LIB = $(LIBIXP) LDFLAGS += -lm -lregexp9 -lbio -lfmt -lutf -CFLAGS += -DVERSION=\"$(VERSION)\" -DIXP_NEEDAPI=86 +CFLAGS += -DIXP_NEEDAPI=86 OBJ = main \ caret \ history \ diff --git a/cmd/menu/fns.h b/cmd/menu/fns.h index 817eaef2..d95ab7f1 100644 --- a/cmd/menu/fns.h +++ b/cmd/menu/fns.h @@ -21,6 +21,7 @@ void debug(int, const char*, ...); Item* filter_list(Item*, char*); void init_screens(int); void update_filter(bool); +void update_input(void); /* menu.c */ void menu_draw(void); diff --git a/cmd/menu/main.c b/cmd/menu/main.c index dfe79882..a5d821b9 100644 --- a/cmd/menu/main.c +++ b/cmd/menu/main.c @@ -14,7 +14,7 @@ #include "fns.h" #define link _link -static const char version[] = "wimenu-"VERSION", ©2009 Kris Maglione\n"; +static const char version[] = "wimenu-"VERSION", "COPYRIGHT"\n"; static Biobuf* cmplbuf; static Biobuf* inbuf; static bool alwaysprint; @@ -140,6 +140,15 @@ filter_list(Item *i, char *filter) { return exact.next; } +void +update_input(void) { + if(alwaysprint) { + write(1, input.string, input.pos - input.string); + write(1, "", 1); + write(1, input.pos, input.end - input.pos + 1); + } +} + void update_filter(bool print) { char *filter; @@ -150,11 +159,8 @@ update_filter(bool print) { matchidx = nil; matchfirst = matchstart = filter_list(items, filter); - if(alwaysprint && print) { - write(1, input.string, input.pos - input.string); - write(1, "", 1); - write(1, input.pos, input.end - input.pos + 1); - } + if(print) + update_input(); } /* @@ -264,6 +270,9 @@ main(int argc, char *argv[]) { case 's': screen = strtol(EARGF(usage()), nil, 10); break; + case 'v': + print("%s", version); + return 0; default: usage(); }ARGEND; diff --git a/cmd/menu/menu.c b/cmd/menu/menu.c index fb08037d..46eb2072 100644 --- a/cmd/menu/menu.c +++ b/cmd/menu/menu.c @@ -95,6 +95,7 @@ next: case BACKWARD: case FORWARD: caret_move(op, motion); + update_input(); break; case CMPL_NEXT: selectitem(matchidx ? matchidx->next : matchfirst); @@ -298,19 +299,14 @@ kdown_event(Window *w, XKeyEvent *e) { menu_cmd(BACKWARD, amount); break; case LCOMPLETE: - amount = CMPL_NEXT; - if(have(LNEXT)) - amount = CMPL_NEXT; - else if(have(LPREV)) - amount = CMPL_PREV; - else if(have(LNEXTPAGE)) - amount = CMPL_NEXT_PAGE; - else if(have(LPREVPAGE)) - amount = CMPL_PREV_PAGE; - else if(have(LFIRST)) - amount = CMPL_FIRST; - else if(have(LLAST)) - amount = CMPL_LAST; + amount = ( + have(LNEXT) ? CMPL_NEXT : + have(LPREV) ? CMPL_PREV : + have(LNEXTPAGE) ? CMPL_NEXT_PAGE : + have(LPREVPAGE) ? CMPL_PREV_PAGE : + have(LFIRST) ? CMPL_FIRST : + have(LLAST) ? CMPL_LAST : + CMPL_NEXT); menu_cmd(amount, 0); break; case LFORWARD: diff --git a/cmd/wmii/Makefile b/cmd/wmii/Makefile index d5073717..7dd766ae 100644 --- a/cmd/wmii/Makefile +++ b/cmd/wmii/Makefile @@ -12,8 +12,7 @@ PACKAGES += $(X11PACKAGES) xext xrandr xrender xinerama LIB = $(LIBIXP) LDFLAGS += -lm $(LIBICONV) -lregexp9 -lbio -lfmt -lutf -CFLAGS += $(INCICONV) -DVERSION=\"$(VERSION)\" \ - -DIXP_NEEDAPI=97 +CFLAGS += $(INCICONV) -DIXP_NEEDAPI=97 OBJ = area \ bar \ client \ diff --git a/cmd/wmii/main.c b/cmd/wmii/main.c index bac6fb03..50215a63 100644 --- a/cmd/wmii/main.c +++ b/cmd/wmii/main.c @@ -16,7 +16,7 @@ #include "fns.h" static const char - version[] = "wmii-"VERSION", ©2009 Kris Maglione\n"; + version[] = "wmii-"VERSION", "COPYRIGHT"\n"; static char* address; static char* ns_path; diff --git a/cmd/wmiir.c b/cmd/wmiir.c index 0d583cab..7f82dde0 100644 --- a/cmd/wmiir.c +++ b/cmd/wmiir.c @@ -384,7 +384,7 @@ main(int argc, char *argv[]) { ARGBEGIN{ case 'v': - print("%s-" VERSION ", ©2009 Kris Maglione\n", argv0); + print("%s-" VERSION ", " COPYRIGHT "\n", argv0); exit(0); case 'a': address = EARGF(usage()); diff --git a/mk/wmii.mk b/mk/wmii.mk index e64c19ab..c5dd719e 100644 --- a/mk/wmii.mk +++ b/mk/wmii.mk @@ -4,4 +4,6 @@ VERSION = $(VERS) VERSION := $(shell echo $(VERS)) VERSION != echo $(VERS) CONFVERSION = -hg +COPYRIGHT = ©2009 Kris Maglione +CFLAGS += '-DVERSION=\"$(VERSION)\"' '-DCOPYRIGHT=\"$(COPYRIGHT)\"' diff --git a/util/compile b/util/compile index 16fd83f7..950de87f 100755 --- a/util/compile +++ b/util/compile @@ -9,7 +9,7 @@ xtmp=/tmp/cc.$$.$USER.out echo CC $($bin/cleanname ${BASE}$outfile) [ -n "$noisycc" ] && echo $CC -o $outfile $CFLAGS $@ -$CC -o $outfile $CFLAGS $@ >$xtmp 2>&1 +eval '$CC -o $outfile '"$CFLAGS"' $@ >$xtmp 2>&1' status=$? [ $? -eq 0 ] || echo $CC -o $outfile $CFLAGS $@ >&2