wmii

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

commit a8d3c69f03d5ae650fe1f55b485ad7f45fe32924
parent c0cf389d846feb9794dc9754facffaf538fa7c39
Author: Anselm R. Garbe <garbeam@wmii.de>
Date:   Sat, 11 Mar 2006 22:14:04 +0100

fixed issues reported by DenisG and ality


Diffstat:
cmd/wm/mouse.c | 6++++--
cmd/wm/rule.c | 11++++++++---
cmd/wm/tag.c | 49+++++++++++++++++++++++++------------------------
cmd/wm/wm.h | 2+-
cmd/wm/wmii | 5+----
rc/wmiirc | 3+++
6 files changed, 42 insertions(+), 34 deletions(-)

diff --git a/cmd/wm/mouse.c b/cmd/wm/mouse.c @@ -305,7 +305,8 @@ mouse_move(Client *c) int snaph = rect.height * def.snap / 1000; unsigned int num; unsigned int dmask; - XRectangle *rects = rectangles(&num); + XRectangle *rects = rectangles(c->frame[c->sel]->area->tag, + area2index(c->frame[c->sel]->area) == 0, &num); XRectangle frect = c->frame[c->sel]->rect; XPoint pt; @@ -550,7 +551,8 @@ mouse_resize(Client *c, Align align) int snaph = rect.height * def.snap / 1000; unsigned int dmask; unsigned int num; - XRectangle *rects = rectangles(&num); + XRectangle *rects = rectangles(c->frame[c->sel]->area->tag, + area2index(c->frame[c->sel]->area) == 0, &num); XRectangle frect = c->frame[c->sel]->rect; XRectangle origin = frect; diff --git a/cmd/wm/rule.c b/cmd/wm/rule.c @@ -122,11 +122,16 @@ match_tags(Client *c) rules = parse(def.rules, &n); c->tags[0] = 0; tags = match(rules, n, c->name); - if(strlen(tags)) + if(strlen(tags)) { + if(strlen(c->tags)) + cext_strlcat(c->tags, " ", sizeof(c->tags)); cext_strlcat(c->tags, tags, sizeof(c->tags)); + } tags = match(rules, n, c->classinst); - if(strlen(tags)) + if(strlen(tags)) { + if(strlen(c->tags)) + cext_strlcat(c->tags, " ", sizeof(c->tags)); cext_strlcat(c->tags, tags, sizeof(c->tags)); - + } free(rules); } diff --git a/cmd/wm/tag.c b/cmd/wm/tag.c @@ -95,32 +95,33 @@ focus_tag(Tag *t) } XRectangle * -rectangles(unsigned int *num) +rectangles(Tag *t, Bool isfloat, unsigned int *num) { - XRectangle *result = 0; - int i, j = 0; - Window d1, d2; - Window *wins; - XWindowAttributes wa; - XRectangle r; - - if(XQueryTree(dpy, root, &d1, &d2, &wins, num)) { + XRectangle *result = nil; + unsigned int i; + + *num = 0; + if(isfloat) + *num = t->area[0]->nframe; + else { + for(i = 1; i < t->narea; i++) + *num += t->area[i]->nframe; + } + + if(*num) { result = cext_emallocz(*num * sizeof(XRectangle)); - for(i = 0; i < *num; i++) { - if(!XGetWindowAttributes(dpy, wins[i], &wa)) - continue; - if(wa.override_redirect && (wa.map_state == IsViewable)) { - r.x = wa.x; - r.y = wa.y; - r.width = wa.width; - r.height = wa.height; - result[j++] = r; - } - } - } - if(wins) - XFree(wins); - *num = j; + if(isfloat) { + for(i = 0; i < *num; i++) + result[i] = t->area[0]->frame[0]->rect; + } + else { + unsigned int j, n = 0; + for(i = 1; i < t->narea; i++) { + for(j = 0; j < t->area[i]->nframe; j++) + result[n++] = t->area[i]->frame[j]->rect; + } + } + } return result; } diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h @@ -292,7 +292,7 @@ void match_tags(Client *c); Tag *alloc_tag(char *name); char *destroy_tag(Tag *t); void focus_tag(Tag *t); -XRectangle *rectangles(unsigned int *num); +XRectangle *rectangles(Tag *t, Bool isfloat, unsigned int *num); int tid2index(unsigned short id); void select_tag(char *arg); int tag2index(Tag *t); diff --git a/cmd/wm/wmii b/cmd/wm/wmii @@ -8,9 +8,6 @@ PATH=$HOME/.wmii-3:CONFPREFIX/wmii-3:$PATH export PATH WMII_ADDRESS=unix!/tmp/ns.$USER.$DISPLAY/wmii export WMII_ADDRESS mkdir -m 700 /tmp/ns.$USER.$DISPLAY 2>/dev/null -wmiiwm -a $WMII_ADDRESS & -wmiiwmpid=$! mkdir $HOME/.wmii-3 2>/dev/null && welcome & -sleep 1 wmiirc & -wait $wmiiwmpid +exec wmiiwm -a $WMII_ADDRESS diff --git a/rc/wmiirc b/rc/wmiirc @@ -1,6 +1,9 @@ #!/bin/sh # configure wmii +# give wmiiwm a chance to start +sleep 1 + xwrite() { file="$1"; shift echo -n "$@" | wmiir write "$file"