Skip to content

Commit

Permalink
FvwmPager: Add option WindowMinSize
Browse files Browse the repository at this point in the history
Allow an option to configure the minimum size of the mini windows in
FvwmPager. Set the default minimum window size to 3. Fixes #542.
  • Loading branch information
somiaj authored and ThomasAdam committed Jun 20, 2021
1 parent 5bb370d commit 5de7dde
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
8 changes: 6 additions & 2 deletions doc/modules/FvwmPager.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,14 @@ done about this - except not using SloppyFocus in the pager.
Uses colorsets in the same way as *FvwmPager: WindowColors. The shadow
and hilight colors of the colorset are only used for the window
borders if the *FvwmPager: Window3DBorders is specified too.
*FvwmPager: WindowMinSize n::
Specifies the minimum size as _n_ pixels of the mini windows. This does
not include the width of the border, so the actual minimum size is
2 * _WindowBorderWidth_ + _WindowMinSize_. The default is 3.
*FvwmPager: WindowBorderWidth n::
Specifies the width of the border drawn around the mini windows. This
also sets the minimum size of the mini windows to (2 * _n_ + 1). The
default is 1.
also affects the minimum size of the mini windows, which will be
2 * _WindowBorderWidth_ + _WindowMinSize_. The default is 1.
*FvwmPager: Window3DBorders::
Specifies that the mini windows should have a 3d borders based on the
mini window background. This option only works if *FvwmPager:
Expand Down
4 changes: 0 additions & 4 deletions libs/defaults.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,6 @@
#define DEFAULT_CURSOR_FORE_COLOR "black"
#define DEFAULT_CURSOR_BACK_COLOR "white"

/*** pager ***/
#define DEFAULT_MOVE_THRESHOLD 3 /* pixels */
#define DEFAULT_PAGER_WINDOW_BORDER_WIDTH 1 /* pixels */

/*** fonts ***/
#define EXTRA_TITLE_FONT_HEIGHT 3 /* pixels */
#define EXTRA_TITLE_FONT_WIDTH 3 /* pixels */
Expand Down
18 changes: 15 additions & 3 deletions modules/FvwmPager/FvwmPager.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@ char *WindowHiFore = NULL;
char *WindowLabelFormat = NULL;

unsigned int WindowBorderWidth = DEFAULT_PAGER_WINDOW_BORDER_WIDTH;
unsigned int MinSize = 2 * DEFAULT_PAGER_WINDOW_BORDER_WIDTH + 5;
unsigned int MinSize = (2 * DEFAULT_PAGER_WINDOW_BORDER_WIDTH +
DEFAULT_PAGER_WINDOW_MIN_SIZE);
Bool WindowBorders3d = False;

Bool UseSkipList = False;
Expand All @@ -96,7 +97,6 @@ FvwmPicture *PixmapBack = NULL;

char *ImagePath = NULL;

#define DEFAULT_PAGER_MOVE_THRESHOLD 3
int MoveThreshold = DEFAULT_PAGER_MOVE_THRESHOLD;

int ShowBalloons = 0, ShowPagerBalloons = 0, ShowIconBalloons = 0;
Expand Down Expand Up @@ -2291,8 +2291,20 @@ void ParseOptions(void)
}
else if (StrEquals(resource, "WindowBorderWidth"))
{
MinSize = MinSize - 2*WindowBorderWidth;
sscanf(arg1, "%d", &WindowBorderWidth);
MinSize = 2 * WindowBorderWidth + 5;
if (WindowBorderWidth > 0)
MinSize = 2 * WindowBorderWidth + MinSize;
else
MinSize = 2 * DEFAULT_PAGER_WINDOW_BORDER_WIDTH + MinSize;
}
else if (StrEquals(resource, "WindowMinSize"))
{
sscanf(arg1, "%d", &MinSize);
if (MinSize > 0)
MinSize = 2 * WindowBorderWidth + MinSize;
else
MinSize = 2 * WindowBorderWidth + DEFAULT_PAGER_WINDOW_MIN_SIZE;
}
else if (StrEquals(resource, "Window3dBorders"))
{
Expand Down
4 changes: 4 additions & 0 deletions modules/FvwmPager/FvwmPager.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
#include "libs/Flocale.h"
#include "libs/Module.h"

#define DEFAULT_PAGER_WINDOW_BORDER_WIDTH 1
#define DEFAULT_PAGER_WINDOW_MIN_SIZE 3
#define DEFAULT_PAGER_MOVE_THRESHOLD 3

struct fpmonitor {
char *name;
int is_primary, output;
Expand Down

0 comments on commit 5de7dde

Please sign in to comment.