diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2011-10-03 12:49:49 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-10-10 14:49:40 +1000 |
commit | 3d8faecd1992f77d10c2a073bb10b932224b92a5 (patch) | |
tree | 8a4bc1f8575ae9f234e13e2160198df21f168829 | |
parent | 870cdcd871e8bad0ad6646aa9f769f6499c31c53 (diff) |
mi: return the screen from miPointerSetPosition
miPointerSetPosition may switch screens. Always return the screen the sprite
is on instead of relying on callers to call miPointerGetScreen().
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Jamey Sharp <jamey@minilop.net>
Reviewed-by: Daniel Stone <daniel@fooishbar.org>
(cherry picked from commit adb28f7103623fa640a300c4aa495024b343130c)
RHEL6: minor conflicts caused by _miPointerSetPosition
Conflicts:
dix/getevents.c
mi/mipointer.c
mi/mipointer.h
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | dix/getevents.c | 3 | ||||
-rw-r--r-- | mi/mipointer.c | 30 | ||||
-rw-r--r-- | mi/mipointer.h | 2 |
3 files changed, 25 insertions, 10 deletions
diff --git a/dix/getevents.c b/dix/getevents.c index 0d99f38b8..a05b8d20e 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -846,8 +846,7 @@ positionSprite(DeviceIntPtr dev, int mode, ValuatorMask *mask, * screenx back into device co-ordinates. */ isx = trunc(*screenx); isy = trunc(*screeny); - _miPointerSetPosition(dev, mode, &isx, &isy); - scr = miPointerGetScreen(dev); + scr = _miPointerSetPosition(dev, mode, &isx, &isy); if (isx != trunc(*screenx)) { *screenx -= trunc(*screenx) - isx; diff --git a/mi/mipointer.c b/mi/mipointer.c index 867c660b9..e805dfaa7 100644 --- a/mi/mipointer.c +++ b/mi/mipointer.c @@ -487,7 +487,23 @@ miPointerMoveNoEvent (DeviceIntPtr pDev, ScreenPtr pScreen, pPointer->pScreen = pScreen; } -void +/** + * Set the devices' cursor position to the given x/y position. + * + * This function is called during the pointer update path in + * GetPointerEvents and friends (and the same in the xwin DDX). + * + * The coordinates provided are always absolute. The parameter mode whether + * it was relative or absolute movement that landed us at those coordinates. + * + * @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) + */ +ScreenPtr _miPointerSetPosition(DeviceIntPtr pDev, int mode, int *x, int *y) { miPointerScreenPtr pScreenPriv; @@ -497,12 +513,12 @@ _miPointerSetPosition(DeviceIntPtr pDev, int mode, int *x, int *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 */ if (*x < 0 || *x >= pScreen->width || *y < 0 || *y >= pScreen->height) { @@ -535,11 +551,11 @@ _miPointerSetPosition(DeviceIntPtr pDev, int mode, int *x, int *y) if (pScreen->ConstrainCursorHarder) 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); - miPointerMoveNoEvent(pDev, pScreen, *x, *y); + return pScreen; } /* ABI hack */ diff --git a/mi/mipointer.h b/mi/mipointer.h index 6b6010cb1..507139518 100644 --- a/mi/mipointer.h +++ b/mi/mipointer.h @@ -131,7 +131,7 @@ extern _X_EXPORT void miPointerGetPosition( /* Moves the cursor to the specified position. May clip the co-ordinates: * x and y are modified in-place. */ -extern _X_EXPORT void _miPointerSetPosition( +extern _X_EXPORT ScreenPtr _miPointerSetPosition( DeviceIntPtr pDev, int mode, int *x, |