wmii

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

commit c422de344e3f6463450af3fabe706a1d0b6df878
parent edae9ff3eefe8f2d65160a3a422d88320cc3d2cf
Author: Kris Maglione <bsdaemon@wmii.de>
Date:   Mon, 26 Jun 2006 15:45:59 -0400

Fix column drawing on mode switch and in stacking mode (forgot to commit yesterday)


Diffstat:
cmd/wm/area.c | 31++++++++++++++++++-------------
cmd/wm/client.c | 12++++++------
cmd/wm/view.c | 17++++++-----------
libixp/client.c | 6+++---
rc/wmiirc | 2+-
5 files changed, 34 insertions(+), 34 deletions(-)

diff --git a/cmd/wm/area.c b/cmd/wm/area.c @@ -33,7 +33,8 @@ Area * area_of_id(View *v, unsigned short id) { Area *a; - for(a=v->area; a && a->id != id; a=a->next); + for(a=v->area; a; a=a->next) + if(a->id == id) break; return a; } @@ -87,12 +88,10 @@ void destroy_area(Area *a) { Client *c; - Area *t; + Area *ta; View *v = a->view; - if(a->frame) { - fprintf(stderr, "%s", "wmiiwm: fatal, destroying non-empty area\n"); - exit(1); - } + + cext_assert(!a->frame && "wmiiwm: fatal, destroying non-empty area"); if(v->revert == a) v->revert = nil; @@ -101,11 +100,11 @@ destroy_area(Area *a) if(c->revert == a) c->revert = nil; - for(t=v->area; t && t->next != a; t=t->next); - if(t) { - t->next = a->next; + for(ta=v->area; ta && ta->next != a; ta=ta->next); + if(ta) { + ta->next = a->next; if(v->sel == a) - v->sel = t == v->area ? t->next : t; + v->sel = ta->floating ? ta->next : ta; } free(a); } @@ -346,7 +345,10 @@ select_area(Area *a, char *arg) return Ebadvalue; for(p=a->frame; p->anext; p=p->anext) if(p->anext == f) break; - focus_client(p->client, True); + a->sel = p; + arrange_column(a, False); + if(v == sel) + focus_view(v); flush_masked_events(EnterWindowMask); return nil; } @@ -354,7 +356,10 @@ select_area(Area *a, char *arg) if(!f) return Ebadvalue; p = f->anext ? f->anext : a->frame; - focus_client(p->client, True); + a->sel = p; + arrange_column(a, False); + if(v == sel) + focus_view(v); flush_masked_events(EnterWindowMask); return nil; } @@ -366,7 +371,7 @@ select_area(Area *a, char *arg) if(new->sel) focus_client(new->sel->client, True); v->sel = new; - if(!a->floating) + if(a->floating != new->floating) v->revert = a; draw_frames(); return nil; diff --git a/cmd/wm/client.c b/cmd/wm/client.c @@ -486,7 +486,7 @@ resize_client(Client *c, XRectangle *r, Bool ignore_xcall) Frame *f = c->sel; Bool floating = f->area->floating; - BlitzAlign stickycorner = 0;; + BlitzAlign stickycorner = 0; if(f->rect.x != r->x && f->rect.x + f->rect.width == r->x + r->width) stickycorner |= EAST; else @@ -709,8 +709,8 @@ client_of_win(Window w) } static int -compare_tags(const void **a, const void **b) { - return strcmp(*a, *b); +compare_tags(const void *a, const void *b) { + return strcmp(*(char **)a, *(char **)b); } void @@ -765,15 +765,15 @@ apply_tags(Client *c, const char *tags) } c->tags[0] = '\0'; - qsort(toks, j, sizeof(char *), (void *)compare_tags); - for(i=0, n=0; i < j; i++) { + qsort(toks, j, sizeof(char *), compare_tags); + + for(i=0, n=0; i < j; i++) if(!n || strcmp(toks[i], toks[n-1])) { if(n) cext_strlcat(c->tags, "+", sizeof(c->tags) - strlen(c->tags) - 1); cext_strlcat(c->tags, toks[i], sizeof(c->tags) - strlen(c->tags) - 1); toks[n++] = toks[i]; } - } toks[i] = nil; update_client_views(c, toks); diff --git a/cmd/wm/view.c b/cmd/wm/view.c @@ -28,25 +28,18 @@ view_of_id(unsigned short id) { } View * -view_of_name(const char *name) +get_view(const char *name) { View *v; int cmp; for(v = view; v; v=v->next) - if(!(cmp=strcmp(name, v->name))) + if((cmp=strcmp(name, v->name)) >= 0) break; - else if(cmp > 0) - return nil; + if(!v || cmp != 0) + v = create_view(name); return v; } -View * -get_view(const char *name) -{ - View *v = view_of_name(name); - return v ? v : create_view(name); -} - static void assign_sel_view(View *v) { @@ -393,6 +386,8 @@ message_view(View *v, char *message) { a->mode = i; arrange_column(a, True); restack_view(v); + if(v == sel) + focus_view(v); draw_frames(); return nil; } diff --git a/libixp/client.c b/libixp/client.c @@ -45,12 +45,12 @@ ixp_client_dial(IXPClient *c, char *sockfile, unsigned int rootfid) c->fcall.msize = IXP_MAX_MSG; c->fcall.version = strdup(IXP_VERSION); if(ixp_client_do_fcall(c) == -1) { - fprintf(stderr, "error: %s\n", c->fcall.ename); + fprintf(stderr, "error: %s\n", c->errstr); ixp_client_hangup(c); return -1; } if(strncmp(c->fcall.version, IXP_VERSION, strlen(IXP_VERSION))) { - fprintf(stderr, "error: %s\n", c->fcall.ename); + fprintf(stderr, "error: %s\n", c->errstr); c->errstr = "9P versions differ"; ixp_client_hangup(c); return -1; /* we cannot handle this version */ @@ -64,7 +64,7 @@ ixp_client_dial(IXPClient *c, char *sockfile, unsigned int rootfid) c->fcall.uname = strdup(getenv("USER")); c->fcall.aname = strdup(""); if(ixp_client_do_fcall(c) == -1) { - fprintf(stderr, "error: %s\n", c->fcall.ename); + fprintf(stderr, "error: %s\n", c->errstr); ixp_client_hangup(c); return -1; } diff --git a/rc/wmiirc b/rc/wmiirc @@ -118,7 +118,7 @@ do wmiir remove /lbar/$bar done -seltag=`wmiir read /tag/sel/ctl` +seltag=`wmiir read /tag/sel/ctl 2>/dev/null` for tag in `wmiir ls /tag | sed -e 's,/$,,; /^sel$/d'` do if [ "X$tag" = "X$seltag" ]; then