From 3e49d746e3b0582f9e7697a5be80456971b97fd5 Mon Sep 17 00:00:00 2001 From: "Anselm R. Garbe" Date: Fri, 7 Apr 2006 16:50:08 +0200 Subject: [PATCH] implemented horizontal scaling for columns --- cmd/wm/area.c | 2 ++ cmd/wm/view.c | 17 ++++++++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/cmd/wm/area.c b/cmd/wm/area.c index 5c81c66d..872c17f1 100644 --- 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 index 07590953..b06567fd 100644 --- 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); }