wmii

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

commit 23d83405b69390702fa2087a90e9e56da3a77028
parent 3694f5faa6ec323f8e56cc88070b431320b4c2b2
Author: Anselm R. Garbe <garbeam@wmii.de>
Date:   Sun, 12 Mar 2006 10:51:12 +0100

added fallback for stacking/equal mode if too many clients in a column, then max mode is used (without lossing that we're in equal/stacking mode), allowing writes to /event which are broadcasted to all reading consumers


Diffstat:
cmd/wm/area.c | 5+++++
cmd/wm/fs.c | 11++++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/cmd/wm/area.c b/cmd/wm/area.c @@ -272,6 +272,8 @@ arrange_area(Area *a) case Colequal: h = a->rect.height; h /= a->nframe; + if(h < 2 * bar_height()) + goto Fallthrough; for(i = 0; i < a->nframe; i++) { Frame *f = a->frame[i]; f->rect = a->rect; @@ -287,6 +289,8 @@ arrange_area(Area *a) case Colstack: yoff = a->rect.y; h = a->rect.height - (a->nframe - 1) * bar_height(); + if(h < 3 * bar_height()) + goto Fallthrough; for(i = 0; i < a->nframe; i++) { Frame *f = a->frame[i]; f->rect = a->rect; @@ -299,6 +303,7 @@ arrange_area(Area *a) resize_client(f->client, &f->rect, nil, True); } break; +Fallthrough: case Colmax: for(i = 0; i < a->nframe; i++) { Frame *f = a->frame[i]; diff --git a/cmd/wm/fs.c b/cmd/wm/fs.c @@ -479,7 +479,7 @@ type2stat(Stat *stat, char *wname, Qid *dir) return mkstat(stat, dir, wname, 0, DMWRITE); break; case FsFevent: - return mkstat(stat, dir, wname, 0, DMREAD); + return mkstat(stat, dir, wname, 0, DMREAD | DMWRITE); break; case FsFborder: snprintf(buf, sizeof(buf), "%d", def.border); @@ -1361,6 +1361,8 @@ xwrite(IXPConn *c, Fcall *fcall) case FsFmode: if(!i2) return Enofile; + if(fcall->count > sizeof(buf)) + return Ebadvalue; memcpy(buf, fcall->data, fcall->count); buf[fcall->count] = 0; if((i = str2mode(buf)) == -1) @@ -1368,6 +1370,13 @@ xwrite(IXPConn *c, Fcall *fcall) tag[i1]->area[i2]->mode = i; arrange_area(tag[i1]->area[i2]); break; + case FsFevent: + if(fcall->count > sizeof(buf)) + return Ebadvalue; + memcpy(buf, fcall->data, fcall->count); + buf[fcall->count] = 0; + write_event(buf); + break; default: return Enoperm; break;