wmii

git clone git://oldgit.suckless.org/wmii/
Log | Files | Refs | README | LICENSE

commit 717e770e72abcf5bbfa0c8d0d790b8120f5d5134
parent 3ee60cd19c70e9e05f9ab7a7df5072916d513edb
Author: Kris Maglione <jg@suckless.org>
Date:   Sat, 19 Jan 2008 22:47:05 -0500

Hg sucks at merging.

Diffstat:
DISTRIBUTORS | 2+-
Makefile | 1-
cmd/wmii/area.c | 7+++----
cmd/wmii/client.c | 3++-
cmd/wmii/column.c | 14++------------
cmd/wmii/dat.h | 16++++++++++++++++
cmd/wmii/fns.h | 1+
cmd/wmii/fs.c | 2+-
cmd/wmii/geom.c | 29+++++++++++++++++++++++++++++
cmd/wmii/message.c | 41+++++++++++++++++++++++++++++++++++++++++
cmd/wmii/mouse.c | 2+-
cmd/wmii/rule.c | 6++++++
cmd/wmii/utf.c | 2+-
cmd/wmiistartrc.sh | 9+++++----
config.mk | 1-
include/util.h | 3+++
include/x11.h | 3+++
mk/gcc.mk | 9+++++++++
18 files changed, 124 insertions(+), 27 deletions(-)

diff --git a/DISTRIBUTORS b/DISTRIBUTORS @@ -5,7 +5,7 @@ name, and not to its source code or any other materials. When in doubt about any of these conditions or other matters of packaging or distrobution, , please contact the wmii mailing lists <wmii-hackers@suckless.org> or -<wmii@suckless.org>. +<wmii@suckless.org>, or Kris Maglione <fbsdaemon@gmail.com>. Any binary distribution of wmii MUST have a properly set version string. This string may normally be set in diff --git a/Makefile b/Makefile @@ -24,6 +24,5 @@ deb: dpkg-buildpackage -rfakeroot include ${ROOT}/mk/dir.mk -include ${ROOT}/mk/common.mk INSTDIRS = ${PDIRS} diff --git a/cmd/wmii/area.c b/cmd/wmii/area.c @@ -1,14 +1,12 @@ -/* Copyright ©2004-2006 Anselm R. Garbe <garbeam at gmail dot com> - * Copyright ©2006-2007 Kris Maglione <fbsdaemon@gmail.com> +/* Copyright ©2006-2008 Kris Maglione <fbsdaemon@gmail.com> * See LICENSE file for license details. */ #include "dat.h" #include <assert.h> #include <math.h> +#include <sys/limits.h> #include "fns.h" -static void place_frame(Frame *f); - Client* area_selclient(Area *a) { if(a && a->sel) @@ -249,3 +247,4 @@ area_focus(Area *a) { event("ColumnFocus %d\n", area_idx(a)); } } + diff --git a/cmd/wmii/client.c b/cmd/wmii/client.c @@ -983,7 +983,8 @@ apply_tags(Client *c, const char *tags) { else if(!strcmp(buf+n, "!") || !strcmp(buf+n, "sel")) cur = screen->sel->name; - else if(!Mbsearch(buf+n, badtags, bsstrcmp)) + else + if(!Mbsearch(buf+n, badtags, bsstrcmp)) cur = buf+n; n = i + 1; diff --git a/cmd/wmii/column.c b/cmd/wmii/column.c @@ -108,18 +108,8 @@ column_remove(Frame *f, bool arrange) { } } -static Handlers divhandler = { - .bdown = bdown_event, - .expose = expose_event, -}; - -Area* -column_new(View *v, Area *pos, uint w) { - Area *a; - - a = area_create(v, pos, w); - if(!a) - return nil; +void +column_detach(Frame *f) { column_remove(f, true); } diff --git a/cmd/wmii/dat.h b/cmd/wmii/dat.h @@ -235,6 +235,22 @@ struct View { Rectangle r; }; +/* Yuck. */ +#define VECTOR(type, nam, c) \ +typedef struct Vector_##nam Vector_##nam; \ +struct Vector_##nam { \ + type* ary; \ + long n; \ + long size; \ +}; \ +void vector_##c##free(Vector_##nam*); \ +void vector_##c##init(Vector_##nam*); \ +void vector_##c##push(Vector_##nam*, type); \ + +VECTOR(long, long, l) +VECTOR(Rectangle, rect, r) +#undef VECTOR + #ifndef EXTERN # define EXTERN extern #endif diff --git a/cmd/wmii/fns.h b/cmd/wmii/fns.h @@ -38,6 +38,7 @@ Client* client_create(XWindow, XWindowAttributes*); void client_destroy(Client*); bool client_floats_p(Client*); void client_focus(Client*); +Frame* client_groupframe(Client*, View*); void client_kill(Client*, bool); void client_manage(Client*); void client_map(Client*); diff --git a/cmd/wmii/fs.c b/cmd/wmii/fs.c @@ -659,7 +659,7 @@ fs_read(Ixp9Req *r) { respond(r, nil); return; case FsFRctl: - buf = root_readctl(); + buf = readctl_root(); write_buf(r, buf, strlen(buf)); respond(r, nil); return; diff --git a/cmd/wmii/geom.c b/cmd/wmii/geom.c @@ -88,3 +88,32 @@ get_sticky(Rectangle src, Rectangle dst) { return stickycorner; } + +/* XXX: These don't belong here. */ +/* Blech. */ +#define VECTOR(type, nam, c) \ +void \ +vector_##c##init(Vector_##nam *v) { \ + memset(v, 0, sizeof *v); \ +} \ + \ +void \ +vector_##c##free(Vector_##nam *v) { \ + free(v->ary); \ + memset(v, 0, sizeof *v); \ +} \ + \ +void \ +vector_##c##push(Vector_##nam *v, type val) { \ + if(v->n == v->size) { \ + if(v->size == 0) \ + v->size = 2; \ + v->size <<= 2; \ + v->ary = erealloc(v->ary, v->size * sizeof *v->ary); \ + } \ + v->ary[v->n++] = val; \ +} \ + +VECTOR(long, long, l) +VECTOR(Rectangle, rect, r) + diff --git a/cmd/wmii/message.c b/cmd/wmii/message.c @@ -705,3 +705,44 @@ msg_sendframe(Frame *f, int sym, bool swap) { view_update_all(); return nil; } + +char* +readctl_root(void) { + bufclear(); + bufprint("view %s\n", screen->sel->name); + bufprint("focuscolors %s\n", def.focuscolor.colstr); + bufprint("normcolors %s\n", def.normcolor.colstr); + bufprint("font %s\n", def.font->name); + bufprint("grabmod %s\n", def.grabmod); + bufprint("border %d\n", def.border); + if(debug) { + bufprint("debug "); + printdebug(); + bufprint("\n"); + } + return buffer; +} + +char* +readctl_view(View *v) { + Area *a; + uint i; + + bufclear(); + bufprint("%s\n", v->name); + + /* select <area>[ <frame>] */ + bufprint("select %s", area_name(v->sel)); + if(v->sel->sel) + bufprint(" %d", frame_idx(v->sel->sel)); + bufprint("\n"); + + /* select client <client> */ + if(v->sel->sel) + bufprint("select client %C\n", v->sel->sel->client); + + for(a = v->area->next, i = 1; a; a = a->next, i++) + bufprint("colmode %d %s\n", i, colmode2str(a->mode)); + return buffer; +} + diff --git a/cmd/wmii/mouse.c b/cmd/wmii/mouse.c @@ -299,7 +299,7 @@ horiz: r = fw->fprev_r; if(f->aprev) { - f->aprev->r.max.y = fw->fr.min.y; + f->aprev->r.max.y = r.min.y; frame_resize(f->aprev, f->aprev->r); }else r.min.y = f->area->r.min.y; diff --git a/cmd/wmii/rule.c b/cmd/wmii/rule.c @@ -42,6 +42,7 @@ update_rules(Rule **rule, const char *data) { char *value_end = value + sizeof(value) - 1; char *r, *v; const char *p; + char c; SET(r); SET(v); @@ -56,6 +57,10 @@ update_rules(Rule **rule, const char *data) { state = IGNORE; for(p = data; (c = *p); p++) switch(state) { + case COMMENT: + if(c == '\n') + state = IGNORE; + break; case IGNORE: if(c == '#') state = COMMENT; @@ -75,6 +80,7 @@ update_rules(Rule **rule, const char *data) { else if(c == '/') { *r = 0; state = IGNORE; + break; } if(r < regex_end) *r++ = c; diff --git a/cmd/wmii/utf.c b/cmd/wmii/utf.c @@ -47,7 +47,7 @@ toutf8n(char *str, size_t nstr) { } char* -toutf8(char *str) { +toutf8(const char *str) { return toutf8n(str, strlen(str)); } diff --git a/cmd/wmiistartrc.sh b/cmd/wmiistartrc.sh @@ -3,15 +3,16 @@ export home="$HOME" lconf="$home/.wmii-CONFVERSION" -gconf="CONFPREFIX/.wmii-CONFVERSION" +gconf="CONFPREFIX/wmii-CONFVERSION" -export WMII_CONFPATH="$conf:$gconf" +export WMII_CONFPATH="$lconf:$gconf" export POSIXLY_CORRECT=gnu_hippies +which="`which which`" if wmii9rc; then - WMIIRC=`PATH="$WMII_CONFPATH:$PATH" which rc.wmii` + WMIIRC=`PATH="$WMII_CONFPATH:$PATH" $which rc.wmii` else - WMIIRC=`PATH="$WMII_CONFPATH:$PATH" which wmiirc` + WMIIRC=`PATH="$WMII_CONFPATH:$PATH" $which wmiirc` fi mkdir $conf 2>/dev/null && $gconf/welcome & diff --git a/config.mk b/config.mk @@ -18,7 +18,6 @@ CFLAGS += $(DEBUGCFLAGS) LDFLAGS += -g $(LIBS) SOLDFLAGS += $(LDFLAGS) STATIC = -static -MKDEP = cpp -M # Compiler, Linker. Linker should usually *not* be ld. CC = cc -c diff --git a/include/util.h b/include/util.h @@ -1,3 +1,6 @@ +/* Copyright ©2007-2008 Kris Maglione <fbsdaemon@gmail.com> + * See LICENSE file for license details. + */ #define nil ((void*)0) #define nelem(ary) (sizeof(ary) / sizeof(*ary)) diff --git a/include/x11.h b/include/x11.h @@ -1,3 +1,6 @@ +/* Copyright ©2007-2008 Kris Maglione <fbsdaemon@gmail.com> + * See LICENSE file for license details. + */ #define Window XWindow #define Font XFont #define Screen XScreen diff --git a/mk/gcc.mk b/mk/gcc.mk @@ -1,3 +1,12 @@ +DEBUGCFLAGS = \ + -g \ + -O1 \ + -fno-builtin \ + -fno-inline \ + -fno-omit-frame-pointer \ + -fno-optimize-sibling-calls \ + -fno-unroll-loops \ + -DIXPlint CFLAGS += \ -std=c99 \ -pedantic \