Skip to content

Commit

Permalink
FvwmPager: Snap small windows to page boundaries.
Browse files Browse the repository at this point in the history
FvwmPager windows that are smaller than the minimum size dimensions are
set to the minimum size length. This can make windows appear in incorrect
positions since their size is relatively larger than other windows and the
page size. This makes it so small windows near a page boundary will snap
to the boundary and not appear they are on the wrong page. Fixes #541.
  • Loading branch information
somiaj committed Jun 19, 2021
1 parent ef5ef5f commit 4313fad
Showing 1 changed file with 29 additions and 2 deletions.
31 changes: 29 additions & 2 deletions modules/FvwmPager/x_pager.c
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,35 @@ static rectangle CalcGeom(PagerWindow *t, bool is_icon)

fvwmrec_to_pager(&rec, is_icon);

rec.width = max(MinSize, rec.width);
rec.height = max(MinSize, rec.height);
/* Set geometry to MinSize and snap to page boundary if needed */
if (rec.width < MinSize)
{
int page_w = desk_w;
if (is_icon)
page_w = icon.width;
page_w = page_w / m->virtual_scr.VxPages;

rec.width = MinSize;
if (rec.x > page_w - MinSize &&
(rec.x + rec.width)%page_w < MinSize)
{
rec.x = ((rec.x / page_w) + 1)*page_w - MinSize + 1;
}
}
if (rec.height < MinSize)
{
int page_h = desk_h;
if (is_icon)
page_h = icon.height;
page_h = page_h / m->virtual_scr.VyPages;

rec.height = MinSize;
if (rec.y > page_h - MinSize &&
(rec.y + rec.height)%page_h < MinSize)
{
rec.y = ((rec.y / page_h) + 1)*page_h - MinSize + 1;
}
}
return rec;
}

Expand Down

0 comments on commit 4313fad

Please sign in to comment.