Skip to content

Commit

Permalink
FvwmPager: Add option HideSmallWindows
Browse files Browse the repository at this point in the history
This option allows the user to tell FvwmPager to not show windows that
are the minimum size. Useful for tiny pagers in which small windows
will appear out of place when set to the minimum size. Fixes #542.
  • Loading branch information
somiaj authored and ThomasAdam committed Jun 20, 2021
1 parent 5de7dde commit ae0e7e2
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 5 deletions.
3 changes: 3 additions & 0 deletions doc/modules/FvwmPager.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,9 @@ done about this - except not using SloppyFocus in the pager.
Specifies the width of the border drawn around the mini windows. This
also affects the minimum size of the mini windows, which will be
2 * _WindowBorderWidth_ + _WindowMinSize_. The default is 1.
*FvwmPager: HideSmallWindows::
Tells FvwmPager to not show windows that are the minimum size. Useful
for tiny pagers where small windows will appear out of place.
*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
6 changes: 6 additions & 0 deletions modules/FvwmPager/FvwmPager.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ Bool WindowBorders3d = False;

Bool UseSkipList = False;

Bool HideSmallWindows = False;

FvwmPicture *PixmapBack = NULL;

char *ImagePath = NULL;
Expand Down Expand Up @@ -2306,6 +2308,10 @@ void ParseOptions(void)
else
MinSize = 2 * WindowBorderWidth + DEFAULT_PAGER_WINDOW_MIN_SIZE;
}
else if (StrEquals(resource, "HideSmallWindows"))
{
HideSmallWindows = true;
}
else if (StrEquals(resource, "Window3dBorders"))
{
WindowBorders3d = True;
Expand Down
43 changes: 38 additions & 5 deletions modules/FvwmPager/x_pager.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ extern unsigned int WindowBorderWidth;
extern unsigned int MinSize;
extern Bool WindowBorders3d;
extern Bool UseSkipList;
extern Bool HideSmallWindows;
extern FvwmPicture *PixmapBack;
extern FvwmPicture *HilightPixmap;
extern int HilightDesks;
Expand Down Expand Up @@ -1739,10 +1740,13 @@ void ReConfigureIcons(Bool do_reconfigure_desk_only)
t->icon_view_y = rec.y;
t->icon_view_width = rec.width;
t->icon_view_height = rec.height;
if(mon->virtual_scr.CurrentDesk == t->desk)
XMoveResizeWindow(dpy, t->IconView, rec.x, rec.y, rec.width, rec.height);
else
XMoveResizeWindow(dpy, t->IconView, -32768, -32768, rec.width, rec.height);
if ((mon->virtual_scr.CurrentDesk != t->desk) ||
(HideSmallWindows && (rec.width == MinSize || rec.height == MinSize)))
{
rec.x = -32768;
rec.y = -32768;
}
XMoveResizeWindow(dpy, t->IconView, rec.x, rec.y, rec.width, rec.height);
}
}

Expand Down Expand Up @@ -2059,6 +2063,12 @@ void AddNewWindow(PagerWindow *t)
attributes.background_pixel = t->back;
attributes.event_mask = ExposureMask;

if (HideSmallWindows && (rec.width == MinSize || rec.height == MinSize))
{
rec.x = -32768;
rec.y = -32768;
}

/* [email protected] -- added Enter and Leave events for
popping up balloon window */
attributes.event_mask =
Expand Down Expand Up @@ -2101,7 +2111,9 @@ void AddNewWindow(PagerWindow *t)
t->icon_view_y = rec.y;
t->icon_view_width = rec.width;
t->icon_view_height = rec.height;
if(mon->virtual_scr.CurrentDesk != t->desk)
if((mon->virtual_scr.CurrentDesk != t->desk) ||
(HideSmallWindows && (rec.width == MinSize ||
rec.height == MinSize)))
{
rec.x = -32768;
rec.y = -32768;
Expand Down Expand Up @@ -2168,6 +2180,12 @@ void ChangeDeskForWindow(PagerWindow *t,long newdesk)
t->pager_view_width = rec.width;
t->pager_view_height = rec.height;

if (HideSmallWindows && (rec.width == MinSize || rec.height == MinSize))
{
rec.x = -32768;
rec.y = -32768;
}

if ((i >= 0) && (i < ndesks))
{
int cset;
Expand Down Expand Up @@ -2197,6 +2215,11 @@ void ChangeDeskForWindow(PagerWindow *t,long newdesk)
t->icon_view_y = rec.y;
t->icon_view_width = rec.width;
t->icon_view_height = rec.height;
if (HideSmallWindows && (rec.width == MinSize || rec.height == MinSize))
{
rec.x = -32768;
rec.y = -32768;
}
if(mon->virtual_scr.CurrentDesk != t->desk)
XMoveResizeWindow(dpy,t->IconView,-32768,-32768,rec.width,rec.height);
else
Expand Down Expand Up @@ -2252,6 +2275,11 @@ void MoveResizePagerView(PagerWindow *t, Bool do_force_redraw)
{
int cset;

if (HideSmallWindows && (rec.width == MinSize || rec.height == MinSize))
{
rec.x = -32768;
rec.y = -32768;
}
XMoveResizeWindow(dpy, t->PagerView, rec.x, rec.y, rec.width, rec.height);
cset = (t != FocusWin) ? windowcolorset : activecolorset;
if (cset > -1 && (size_changed || CSET_IS_TRANSPARENT(cset)))
Expand Down Expand Up @@ -2281,6 +2309,11 @@ void MoveResizePagerView(PagerWindow *t, Bool do_force_redraw)
{
int cset;

if (HideSmallWindows && (rec.width == MinSize || rec.height == MinSize))
{
rec.x = -32768;
rec.y = -32768;
}
XMoveResizeWindow(dpy, t->IconView, rec.x, rec.y, rec.width, rec.height);
cset = (t != FocusWin) ? windowcolorset : activecolorset;
if (cset > -1 && (size_changed || CSET_IS_TRANSPARENT(cset)))
Expand Down

0 comments on commit ae0e7e2

Please sign in to comment.