Re: FvwmPager aspect ratio breaks FvwmButtons panel sliding
Dominik Vogt <[email protected]> Sat, 4 Dec 2021 14:52:02 +0100
| Newsgroups | gmane.comp.window-managers.fvwm.devel |
|---|---|
| Message-ID | <[email protected]> |
--s8SgmGUpTGVl2TN1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Dec 04, 2021 at 02:13:06PM +0100, Dominik Vogt wrote: > On Sat, Dec 04, 2021 at 02:03:46PM +0100, Dominik Vogt wrote: > > Maybe the scaling argument can be set to "auto" or something to > > keep the desktopscale within reasonable limits? (The example with > > desktopsize 50x1 earlkier in the discussion showed that the pager > > currently does not have a reasonable scaling algorithm). > > Maybe something like this by default? > > desktopscale auto [max%] > > "auto" means to make the pager consume "max%" of the desktop width > and height. The default would be "auto 10" or something, so (a) > by default the pager autoscales and (b) it always consumes 10% of > the screen size in one direction and no more than 10% in the other > direction. Experimental patch attached (only initial size calculation; no live resizing yet). Ciao Dominik ^_^ ^_^ =2D- Dominik Vogt --s8SgmGUpTGVl2TN1 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0001-Pager-autoscale-draft.patch" Content-Transfer-Encoding: quoted-printable =46rom f82e4ce6df30513d8073f8cda02525aa36ba3464 Mon Sep 17 00:00:00 2001 From: Dominik Vogt <[email protected]> Date: Sat, 4 Dec 2021 14:49:58 +0100 Subject: [PATCH] Pager autoscale draft. =2D-- modules/FvwmPager/FvwmPager.c | 11 +++++++++-- modules/FvwmPager/FvwmPager.h | 3 ++- modules/FvwmPager/x_pager.c | 26 ++++++++++++++++++++++++-- 3 files changed, 35 insertions(+), 5 deletions(-) diff --git a/modules/FvwmPager/FvwmPager.c b/modules/FvwmPager/FvwmPager.c index 52199ce9..f0a60dd1 100644 =2D-- a/modules/FvwmPager/FvwmPager.c +++ b/modules/FvwmPager/FvwmPager.c @@ -1792,7 +1792,8 @@ void ParseOptions(void) FvwmPictureAttributes fpa; Scr.FvwmRoot =3D NULL; Scr.Hilite =3D NULL; - Scr.VScale =3D 32; + Scr.Scale =3D 10; + Scr.do_autoscale =3D 1; fpa.mask =3D 0; if (Pdepth <=3D 8) @@ -2257,7 +2258,13 @@ void ParseOptions(void) } else if (StrEquals(resource, "DeskTopScale")) { - sscanf(arg1,"%d",&Scr.VScale); + sscanf(arg1,"%d",&Scr.Scale); + Scr.do_autoscale =3D 0; + } + else if (StrEquals(resource, "AutoScale")) + { + sscanf(arg1,"%d",&Scr.Scale); + Scr.do_autoscale =3D 1; } else if (StrEquals(resource, "WindowColors")) { diff --git a/modules/FvwmPager/FvwmPager.h b/modules/FvwmPager/FvwmPager.h index 85805240..e371d4ed 100644 =2D-- a/modules/FvwmPager/FvwmPager.h +++ b/modules/FvwmPager/FvwmPager.h @@ -70,7 +70,8 @@ typedef struct ScreenInfo char *Hilite; /* the fvwm window that is highlighted * except for networking delays, this is the * window which REALLY has the focus */ - unsigned VScale; /* Panner scale factor */ + unsigned Scale; /* Panner scale factor */ + int do_autoscale : 1; Pixmap sticky_gray_pixmap; Pixmap light_gray_pixmap; Pixmap gray_pixmap; diff --git a/modules/FvwmPager/x_pager.c b/modules/FvwmPager/x_pager.c index b2f22a62..a30fcf4f 100644 =2D-- a/modules/FvwmPager/x_pager.c +++ b/modules/FvwmPager/x_pager.c @@ -695,10 +695,32 @@ void initialize_pager(void) } else if (pwindow.height > label_h * Rows) { pwindow.width =3D ((pwindow.height - label_h * Rows + Rows) * vWidth) / vHeight + Columns; + } else if (Scr.do_autoscale) { + int w_raw; + float wf; + int h_raw; + float hf; + rectangle screen_g; + float f; + + FScreenGetScrRect( + NULL, FSCREEN_CURRENT, &screen_g.x, &screen_g.y, + &screen_g.width, &screen_g.height); + w_raw =3D VxPages * vWidth * Columns + Columns; + h_raw =3D VyPages * vHeight * Rows + Rows; + wf =3D + ((float)w_raw) / + (screen_g.width * ((float)Scr.Scale) / 100.0); + hf =3D + ((float)h_raw) / + (screen_g.height * ((float)Scr.Scale) / 100.0); + f =3D (wf > hf) ? wf : hf; + pwindow.width =3D ((float)w_raw) / f; + pwindow.height =3D ((float)h_raw) / f; } else { - pwindow.width =3D (VxPages * vWidth * Columns) / Scr.VScale + + pwindow.width =3D (VxPages * vWidth * Columns) / Scr.Scale + Columns; - pwindow.height =3D (VyPages * vHeight * Rows) / Scr.VScale + + pwindow.height =3D (VyPages * vHeight * Rows) / Scr.Scale + label_h * Rows + Rows; } } =2D- 2.30.2 --s8SgmGUpTGVl2TN1--