summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam Spilsbury <Sam@XPS-SUSE.site>2008-11-18 11:26:36 +0900
committerSam Spilsbury <Sam@XPS-SUSE.site>2008-11-18 11:26:36 +0900
commitcd454ff13dbfd2e09c6353f14cb300e85ba7a103 (patch)
tree3cb1d132cd33f9f4560547d06bf2c81eb058a677
parent251a9272fdd331fded1441e365bc9c4c17333279 (diff)
downloadlazypointer-cd454ff13dbfd2e09c6353f14cb300e85ba7a103.tar.gz
lazypointer-cd454ff13dbfd2e09c6353f14cb300e85ba7a103.tar.bz2
* Prevent the pointer from getting stuck to one side of the screen if the destination target was offscreen
-rw-r--r--lazypointer.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/lazypointer.c b/lazypointer.c
index ada207e..fca7209 100644
--- a/lazypointer.c
+++ b/lazypointer.c
@@ -80,6 +80,16 @@ lpPreparePaintScreen (CompScreen *s,
if (ls->needsWarp)
{
+
+ if (ls->destX >= s->width)
+ ls->destX = s->width - 1;
+ if (ls->destX <= 0)
+ ls->destX = 1;
+ if (ls->destY >= s->height)
+ ls->destY = s->height -1;
+ if (ls->destY <= 0)
+ ls->destY = 1;
+
int dx = ceilf(steps * (ls->destX - pointerX) * speed);
int dy = ceilf(steps * (ls->destY - pointerY) * speed);