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 ^_^ ^_^ -- Dominik Vogt
From f82e4ce6df30513d8073f8cda02525aa36ba3464 Mon Sep 17 00:00:00 2001 From: Dominik Vogt <dominik.v...@gmx.de> Date: Sat, 4 Dec 2021 14:49:58 +0100 Subject: [PATCH] Pager autoscale draft. --- 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 --- a/modules/FvwmPager/FvwmPager.c +++ b/modules/FvwmPager/FvwmPager.c @@ -1792,7 +1792,8 @@ void ParseOptions(void) FvwmPictureAttributes fpa; Scr.FvwmRoot = NULL; Scr.Hilite = NULL; - Scr.VScale = 32; + Scr.Scale = 10; + Scr.do_autoscale = 1; fpa.mask = 0; if (Pdepth <= 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 = 0; + } + else if (StrEquals(resource, "AutoScale")) + { + sscanf(arg1,"%d",&Scr.Scale); + Scr.do_autoscale = 1; } else if (StrEquals(resource, "WindowColors")) { diff --git a/modules/FvwmPager/FvwmPager.h b/modules/FvwmPager/FvwmPager.h index 85805240..e371d4ed 100644 --- 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 --- 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 = ((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 = VxPages * vWidth * Columns + Columns; + h_raw = VyPages * vHeight * Rows + Rows; + wf = + ((float)w_raw) / + (screen_g.width * ((float)Scr.Scale) / 100.0); + hf = + ((float)h_raw) / + (screen_g.height * ((float)Scr.Scale) / 100.0); + f = (wf > hf) ? wf : hf; + pwindow.width = ((float)w_raw) / f; + pwindow.height = ((float)h_raw) / f; } else { - pwindow.width = (VxPages * vWidth * Columns) / Scr.VScale + + pwindow.width = (VxPages * vWidth * Columns) / Scr.Scale + Columns; - pwindow.height = (VyPages * vHeight * Rows) / Scr.VScale + + pwindow.height = (VyPages * vHeight * Rows) / Scr.Scale + label_h * Rows + Rows; } } -- 2.30.2