Skip to content

Commit

Permalink
Paging: warp pointer to screen edge
Browse files Browse the repository at this point in the history
When handling paging, seaprate out the logic more distinctly for where
the pointer should end up when panning; sometimes, the cursor would end
up near the middle of two displays which is fine for per-monitor mode,
but not for global.

Fixes #459
  • Loading branch information
ThomasAdam committed Mar 7, 2021
1 parent c919957 commit 64fe4b0
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions fvwm/virtual.c
Original file line number Diff line number Diff line change
Expand Up @@ -902,24 +902,29 @@ int HandlePaging(
return 0;
}


/* make sure the pointer isn't warped into the panframes */
if (*xl <= (m->si->x + edge_thickness))
{
*xl = m->si->x + edge_thickness;
}
if (*yt <= (m->si->y + edge_thickness))
{
*yt = edge_thickness;
}
if (*xl >= (m->si->x + m->si->w) - edge_thickness)
{
*xl = (m->si->x + m->si->w) - edge_thickness -1;
}
if (*yt >= (m->si->y + m->si->h) - edge_thickness)
{
*yt = (m->si->y + m->si->h) - edge_thickness -1;
/* Handle global/per-monitor separately.*/
if (monitor_mode == MONITOR_TRACKING_G) {
if (*xl < edge_thickness)
*xl = edge_thickness;
if (*yt < edge_thickness)
*yt = edge_thickness;
if (*xl >= mwidth - edge_thickness)
*xl = mwidth - edge_thickness -1;
if (*yt >= mheight - edge_thickness)
*yt = mheight - edge_thickness -1;
} else {
/* Per-monitor warping of the cursor. */
if (*xl <= (m->si->x + edge_thickness))
*xl = m->si->x + edge_thickness;
if (*yt <= (m->si->y + edge_thickness))
*yt = edge_thickness;
if (*xl >= (m->si->x + m->si->w) - edge_thickness)
*xl = (m->si->x + m->si->w) - edge_thickness -1;
if (*yt >= (m->si->y + m->si->h) - edge_thickness)
*yt = (m->si->y + m->si->h) - edge_thickness -1;
}

if (Grab)
{
MyXGrabServer(dpy);
Expand Down

0 comments on commit 64fe4b0

Please sign in to comment.