commit 3e49d746e3b0582f9e7697a5be80456971b97fd5
parent 8199524d26e6f117d279ba73b7b4cc1c2d8f3eee
Author: Anselm R. Garbe <garbeam@wmii.de>
Date: Fri, 7 Apr 2006 16:50:08 +0200
implemented horizontal scaling for columns
Diffstat:
2 files changed, 14 insertions(+), 5 deletions(-)
diff --git a/cmd/wm/area.c b/cmd/wm/area.c
@@ -23,6 +23,8 @@ alloc_area(View *v)
a->id = id++;
a->rect = rect;
a->rect.height = rect.height - brect.height;
+ if(v->area.size > 2)
+ a->rect.width = rect.width / (v->area.size - 2);
cext_vattach(area2vector(&v->area), a);
v->sel = v->area.size -1;
return a;
diff --git a/cmd/wm/view.c b/cmd/wm/view.c
@@ -291,19 +291,26 @@ restack_view(View *v)
void
arrange_view(View *v, Bool dirty)
{
- unsigned int i;
- unsigned int width;
+ unsigned int i, xoff = 0;
+ unsigned int dx = 0;
+ float scale = 1.0;
if(v->area.size == 1)
return;
- width = rect.width / (v->area.size - 1);
+ if(dirty) {
+ for(i = 1; i < v->area.size; i++)
+ dx += v->area.data[i]->rect.width;
+ scale = (float)rect.width / (float)dx;
+ }
for(i = 1; i < v->area.size; i++) {
Area *a = v->area.data[i];
if(dirty) {
+ a->rect.x = xoff;
+ a->rect.y = 0;
a->rect.height = rect.height - brect.height;
- a->rect.x = (i - 1) * width;
- a->rect.width = width;
+ a->rect.width *= scale;
+ xoff += a->rect.width;
}
arrange_column(a, False);
}