From d4273f4e96244d425683894a31126ef5246f577b Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Fri, 22 Aug 2008 22:09:51 +0200 Subject: [PATCH] magnifier: implements mwfact as surface factor Signed-off-by: Julien Danjou --- layouts/magnifier.c | 6 ++++-- mouse.c | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/layouts/magnifier.c b/layouts/magnifier.c index 97439086..6485ef6e 100644 --- a/layouts/magnifier.c +++ b/layouts/magnifier.c @@ -19,6 +19,8 @@ * */ +#include + #include "client.h" #include "tag.h" #include "screen.h" @@ -46,8 +48,8 @@ layout_magnifier(int screen) if(!focus) goto bailout; - geometry.width = area.width * curtags[0]->mwfact; - geometry.height = area.height * curtags[0]->mwfact; + geometry.width = sqrt(area.width * area.width * curtags[0]->mwfact); + geometry.height = sqrt(area.height * area.height * curtags[0]->mwfact); geometry.x = area.x + (area.width - geometry.width) / 2; geometry.y = area.y + (area.height - geometry.height) / 2; client_resize(focus, geometry, focus->honorsizehints); diff --git a/mouse.c b/mouse.c index 6aa2f7f8..1f6ab69e 100644 --- a/mouse.c +++ b/mouse.c @@ -913,7 +913,7 @@ mouse_client_resize_magnified(client_t *c, bool infobox) dist = sqrt((dx*dx) + (dy*dy)); /* new master/rest ratio */ - mwfact = dist / maxdist; + mwfact = (dist * dist) / (maxdist * maxdist); /* keep mwfact within reasonable bounds */ mwfact = MIN(MAX( 0.01, mwfact), 0.99);