magnifier: implements mwfact as surface factor
Signed-off-by: Julien Danjou <julien@danjou.info>
This commit is contained in:
parent
d518873461
commit
d4273f4e96
|
@ -19,6 +19,8 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "tag.h"
|
#include "tag.h"
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
|
@ -46,8 +48,8 @@ layout_magnifier(int screen)
|
||||||
if(!focus)
|
if(!focus)
|
||||||
goto bailout;
|
goto bailout;
|
||||||
|
|
||||||
geometry.width = area.width * curtags[0]->mwfact;
|
geometry.width = sqrt(area.width * area.width * curtags[0]->mwfact);
|
||||||
geometry.height = area.height * curtags[0]->mwfact;
|
geometry.height = sqrt(area.height * area.height * curtags[0]->mwfact);
|
||||||
geometry.x = area.x + (area.width - geometry.width) / 2;
|
geometry.x = area.x + (area.width - geometry.width) / 2;
|
||||||
geometry.y = area.y + (area.height - geometry.height) / 2;
|
geometry.y = area.y + (area.height - geometry.height) / 2;
|
||||||
client_resize(focus, geometry, focus->honorsizehints);
|
client_resize(focus, geometry, focus->honorsizehints);
|
||||||
|
|
2
mouse.c
2
mouse.c
|
@ -913,7 +913,7 @@ mouse_client_resize_magnified(client_t *c, bool infobox)
|
||||||
dist = sqrt((dx*dx) + (dy*dy));
|
dist = sqrt((dx*dx) + (dy*dy));
|
||||||
|
|
||||||
/* new master/rest ratio */
|
/* new master/rest ratio */
|
||||||
mwfact = dist / maxdist;
|
mwfact = (dist * dist) / (maxdist * maxdist);
|
||||||
|
|
||||||
/* keep mwfact within reasonable bounds */
|
/* keep mwfact within reasonable bounds */
|
||||||
mwfact = MIN(MAX( 0.01, mwfact), 0.99);
|
mwfact = MIN(MAX( 0.01, mwfact), 0.99);
|
||||||
|
|
Loading…
Reference in New Issue