wmii

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

commit d293339496d9a1d862a7635d7e644959430842fa
parent dd58d76ccee321d5f7381af31684ef508b2afb1e
Author: Kris Maglione <bsdaemon@wmii.de>
Date:   Fri,  9 Jun 2006 19:57:00 -0400

Fixed resizing first column, possible null pointer exception, and some whitespace changes.


Diffstat:
cmd/wm/area.c | 4++--
cmd/wm/client.c | 16++++++++--------
cmd/wm/column.c | 4++--
cmd/wm/frame.c | 1+
cmd/wm/view.c | 5+++--
5 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/cmd/wm/area.c b/cmd/wm/area.c @@ -264,8 +264,8 @@ detach_from_area(Area *a, Client *c) Frame *f; for(f=c->frame; f && f->area != a; f=f->cnext); - if(f) - destroy_frame(f); + cext_assert(f->area == a); + destroy_frame(f); if(a != a->view->area) { if(a->frame) diff --git a/cmd/wm/client.c b/cmd/wm/client.c @@ -443,7 +443,7 @@ void destroy_client(Client *c) { View *v; - Client *tc; + Client **tc; XGrabServer(dpy); XSetErrorHandler(dummy_error_handler); @@ -461,13 +461,11 @@ destroy_client(Client *c) reparent_client(c, root, c->rect.x, c->rect.y); XFreeGC(dpy, c->gc); XDestroyWindow(dpy, c->framewin); - if(c==client) - client = c->next; - else { - for(tc=client; tc && tc->next != c; tc=tc->next); - if(tc) - tc->next = c->next; - } + + for(tc=&client; *tc && *tc != c; tc=&(*tc)->next); + cext_assert(*tc == c); + *tc = c->next; + update_views(); free(c); @@ -555,6 +553,7 @@ resize_client(Client *c, XRectangle *r, Bool ignore_xcall) { Frame *f = c->sel; Bool floating = (f->area == f->area->view->area); + BlitzAlign stickycorner = 0;; if(f->rect.x != r->x && f->rect.x + f->rect.width == r->x + r->width) stickycorner |= EAST; @@ -564,6 +563,7 @@ resize_client(Client *c, XRectangle *r, Bool ignore_xcall) stickycorner |= SOUTH; else stickycorner |= NORTH; + f->rect = *r; if((f->area->mode != Colstack) || (f->area->sel == f)) diff --git a/cmd/wm/column.c b/cmd/wm/column.c @@ -227,10 +227,10 @@ drop_resize(Frame *f, XRectangle *new) for(west=v->area->next; west && west->next != a; west=west->next); /* first managed area is indexed 1, thus (i > 1) ? ... */ - east = (west && west->next && west->next->next) ? west->next->next : nil; + east = a->next; for(north=a->frame; north && north->anext != f; north=north->anext); - south = (north && north->anext && north->anext->anext) ? north->anext->anext : nil; + south = f->anext; /* validate (and trim if necessary) horizontal resize */ if(new->width < MIN_COLWIDTH) { diff --git a/cmd/wm/frame.c b/cmd/wm/frame.c @@ -37,6 +37,7 @@ remove_frame(Frame *f) { Area *a = f->area; Frame **ft = &a->frame; + for(; *ft && *ft != f; ft=&(*ft)->anext); cext_assert(*ft == f); *ft = f->anext; diff --git a/cmd/wm/view.c b/cmd/wm/view.c @@ -178,9 +178,10 @@ is_of_view(View *v, Client *c) void detach_from_view(View *v, Client *c) { - Area *a; + Area *a, *next; - for(a=v->area; a; a=a->next) { + for(a=v->area; a; a=next) { + next=a->next; if(is_of_area(a, c)) { detach_from_area(a, c); XMoveWindow(dpy, c->framewin, 2 * rect.width, 0);