Clamp window position on move

In non-compositing mode the x/y coordinate limts are [-32768; 32767] as
should be expected. If moving beyond these values the coordinates are
just set modulo 2^16 (like in a signed 16 bit integer) and most likely
this isn't noticed anywhere.

In compositing mode the coordinates apperently must be clamped some
more, but it is not clear why or where the limit is.
The problem manifests itself in that a window moved "too far" seems to
have disappeared when moving it back on screen, possibly because the
name pixmap is invalidated.
Shading/unshading the window makes it re-appear.

The problem can be seen when dragging a window far off a (small) pager.
This commit is contained in:
Kim Woelders 2022-04-30 19:34:59 +02:00
parent dc5db9e4a1
commit cf5927deb8
1 changed files with 11 additions and 0 deletions

View File

@ -320,6 +320,17 @@ doEwinMoveResize(EWin * ewin, Desk * dsk, int x, int y, int w, int h, int flags)
}
}
/* Clamp window position or weirdness may happen.
* Not sure where the exact limit is. */
if (x < -32000)
x = -32000;
else if (x > 32000 - w)
x = 32000 - w;
if (y < -32000)
y = -32000;
else if (y > 32000 - h)
y = 32000 - h;
dx = x - EoGetX(ewin);
dy = y - EoGetY(ewin);
if ((dx != 0) || (dy != 0))