aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/mi/mipointer.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2011-10-19 12:11:26 +0200
committermarha <marha@users.sourceforge.net>2011-10-19 12:11:26 +0200
commit1e90ede4237374dfbb2c8c506a906233bcfd3c5d (patch)
tree13b59b0ab2715fd0bb9eea788c73b08f3b07c01e /xorg-server/mi/mipointer.c
parentbaf98f9bb36f956245d83ecd04f90625d6d68d2b (diff)
parent9f986778bd4393c5a9108426969d45aa7f10f334 (diff)
downloadvcxsrv-1e90ede4237374dfbb2c8c506a906233bcfd3c5d.tar.gz
vcxsrv-1e90ede4237374dfbb2c8c506a906233bcfd3c5d.tar.bz2
vcxsrv-1e90ede4237374dfbb2c8c506a906233bcfd3c5d.zip
Merge remote-tracking branch 'origin/released'
Conflicts: xorg-server/include/os.h
Diffstat (limited to 'xorg-server/mi/mipointer.c')
-rw-r--r--xorg-server/mi/mipointer.c57
1 files changed, 34 insertions, 23 deletions
diff --git a/xorg-server/mi/mipointer.c b/xorg-server/mi/mipointer.c
index 670f63b6e..55e4081f2 100644
--- a/xorg-server/mi/mipointer.c
+++ b/xorg-server/mi/mipointer.c
@@ -569,35 +569,37 @@ miPointerMoveNoEvent (DeviceIntPtr pDev, ScreenPtr pScreen,
*
* @param pDev The device to move
* @param mode Movement mode (Absolute or Relative)
- * @param[in,out] x The x coordinate in screen coordinates (in regards to total
- * desktop size)
- * @param[in,out] y The y coordinate in screen coordinates (in regards to total
- * desktop size)
+ * @param[in,out] screenx The x coordinate in screen coordinates
+ * @param[in,out] screeny The y coordinate in screen coordinates
*/
-void
-miPointerSetPosition(DeviceIntPtr pDev, int mode, int *x, int *y)
+ScreenPtr
+miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx, double *screeny)
{
miPointerScreenPtr pScreenPriv;
ScreenPtr pScreen;
ScreenPtr newScreen;
+ int x, y;
miPointerPtr pPointer;
if (!pDev || !pDev->coreEvents)
- return;
+ return NULL;
pPointer = MIPOINTER(pDev);
pScreen = pPointer->pScreen;
if (!pScreen)
- return; /* called before ready */
+ return NULL; /* called before ready */
+
+ x = trunc(*screenx);
+ y = trunc(*screeny);
- if (*x < 0 || *x >= pScreen->width || *y < 0 || *y >= pScreen->height)
+ if (x < 0 || x >= pScreen->width || y < 0 || y >= pScreen->height)
{
pScreenPriv = GetScreenPrivate (pScreen);
if (!pPointer->confined)
{
newScreen = pScreen;
- (*pScreenPriv->screenFuncs->CursorOffScreen) (&newScreen, x, y);
+ (*pScreenPriv->screenFuncs->CursorOffScreen) (&newScreen, &x, &y);
if (newScreen != pScreen)
{
pScreen = newScreen;
@@ -610,23 +612,32 @@ miPointerSetPosition(DeviceIntPtr pDev, int mode, int *x, int *y)
}
}
/* Constrain the sprite to the current limits. */
- if (*x < pPointer->limits.x1)
- *x = pPointer->limits.x1;
- if (*x >= pPointer->limits.x2)
- *x = pPointer->limits.x2 - 1;
- if (*y < pPointer->limits.y1)
- *y = pPointer->limits.y1;
- if (*y >= pPointer->limits.y2)
- *y = pPointer->limits.y2 - 1;
+ if (x < pPointer->limits.x1)
+ x = pPointer->limits.x1;
+ if (x >= pPointer->limits.x2)
+ x = pPointer->limits.x2 - 1;
+ if (y < pPointer->limits.y1)
+ y = pPointer->limits.y1;
+ if (y >= pPointer->limits.y2)
+ y = pPointer->limits.y2 - 1;
if (pScreen->ConstrainCursorHarder)
- pScreen->ConstrainCursorHarder(pDev, pScreen, mode, x, y);
+ pScreen->ConstrainCursorHarder(pDev, pScreen, mode, &x, &y);
- if (pPointer->x == *x && pPointer->y == *y &&
- pPointer->pScreen == pScreen)
- return;
+ if (pPointer->x != x || pPointer->y != y ||
+ pPointer->pScreen != pScreen)
+ miPointerMoveNoEvent(pDev, pScreen, x, y);
+
+ /* In the event we actually change screen or we get confined, we just
+ * drop the float component on the floor
+ * FIXME: only drop remainder for ConstrainCursorHarder, not for screen
+ * crossings */
+ if (x != trunc(*screenx))
+ *screenx = x;
+ if (y != trunc(*screeny))
+ *screeny = y;
- miPointerMoveNoEvent(pDev, pScreen, *x, *y);
+ return pScreen;
}
/**