wmii

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

commit c946b86cdf9cf9e588e99f895fed3556dcfd69fe
parent 6ce7eb4337ae054eef52a09ec217b25a12eff9bd
Author: Anselm R. Garbe <garbeam@wmii.de>
Date:   Mon, 27 Mar 2006 09:01:05 +0200

re-applying Sanders patches which I accidently overwrote


Diffstat:
cmd/wm/area.c | 39+++++++++++++++++++++++++--------------
cmd/wm/client.c | 2+-
cmd/wm/wm.h | 2+-
3 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/cmd/wm/area.c b/cmd/wm/area.c @@ -394,6 +394,7 @@ match_horiz(Area *a, XRectangle *r) } } + static void drop_resize(Frame *f, XRectangle *new) { @@ -402,7 +403,6 @@ drop_resize(Frame *f, XRectangle *new) Frame *north = nil, *south = nil; unsigned int i; unsigned int min = 2 * bar_height(); - Bool horiz_resize = False; for(i = 1; (i < v->narea) && (v->area[i] != a); i++); /* first managed area is indexed 1, thus (i > 1) ? ... */ @@ -413,36 +413,47 @@ drop_resize(Frame *f, XRectangle *new) north = i ? a->frame[i - 1] : nil; south = i + 1 < a->nframe ? a->frame[i + 1] : nil; - /* horizontal resize */ + /* validate (and trim if necessary) horizontal resize */ + if(new->width < MIN_COLWIDTH) { + if(new->x + new->width == f->rect.x + f->rect.width) + new->x = a->rect.x + a->rect.width - MIN_COLWIDTH; + new->width = MIN_COLWIDTH; + } if(west && (new->x != f->rect.x)) { - horiz_resize = True; if(new->x < 0 || new->x < (west->rect.x + MIN_COLWIDTH)) { new->width -= (west->rect.x + MIN_COLWIDTH) - new->x; new->x = west->rect.x + MIN_COLWIDTH; - } else if(new->width < MIN_COLWIDTH) { - new->x -= MIN_COLWIDTH - new->width; - new->width = MIN_COLWIDTH; } + } else { + new->width += new->x - a->rect.x; + new->x = a->rect.x; + } + if(east && (new->x + new->width != f->rect.x + f->rect.width)) { + if((new->x + new->width) > (east->rect.x + east->rect.width - MIN_COLWIDTH)) + new->width = (east->rect.x + east->rect.width - MIN_COLWIDTH) - new->x; + } else + new->width = (a->rect.x + a->rect.width) - new->x; + if(new->width < MIN_COLWIDTH) + goto AfterHorizontal; + + /* horizontal resize */ + if(west && (new->x != a->rect.x)) { west->rect.width = new->x - west->rect.x; a->rect.width += a->rect.x - new->x; a->rect.x = new->x; + match_horiz(a, &a->rect); match_horiz(west, &west->rect); relax_area(west); } - if(east && (new->x + new->width != f->rect.x + f->rect.width)) { - horiz_resize = True; - if((new->x + new->width) > (east->rect.x + east->rect.width - MIN_COLWIDTH)) - new->width = (east->rect.x + east->rect.width - MIN_COLWIDTH) - new->x; - else if(new->width < MIN_COLWIDTH) - new->width = MIN_COLWIDTH; + if(east && (new->x + new->width != a->rect.x + a->rect.width)) { east->rect.width -= new->x + new->width - east->rect.x; east->rect.x = new->x + new->width; a->rect.width = (new->x + new->width) - a->rect.x; + match_horiz(a, &a->rect); match_horiz(east, &east->rect); relax_area(east); } - if(horiz_resize) - match_horiz(a, &a->rect); +AfterHorizontal: if(a->mode != Colequal) goto AfterVertical; diff --git a/cmd/wm/client.c b/cmd/wm/client.c @@ -548,7 +548,7 @@ send2area_client(Client *c, char *arg) if(i == -1) return; if(!strncmp(arg, "new", 4) && i) { - if(a->nframe == 1 || v->narea - 1 >= rect.width / (2 * MIN_COLWIDTH)) + if(a->nframe == 1 || v->narea - 1 >= rect.width / MIN_COLWIDTH) return; to = alloc_area(v); arrange_view(v, True); diff --git a/cmd/wm/wm.h b/cmd/wm/wm.h @@ -67,7 +67,7 @@ enum { #define MAX_TAGS 8 #define MAX_TAGLEN 32 #define WM_PROTOCOL_DELWIN 1 -#define MIN_COLWIDTH 32 +#define MIN_COLWIDTH 64 typedef struct View View; typedef struct Area Area;