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-11 12:06:53 +1000 |
commit | 81cfe44b1ed0de84ad1941fe2ca74bebef3fc58d (patch) | |
tree | bd42f257e2fd338c6ce059c8add6c364768161c1 | |
parent | 88dfe5366d9855e0ebf8bbff74967b793ede57d1 (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>
-rw-r--r-- | dix/getevents.c | 3 | ||||
-rw-r--r-- | mi/mipointer.c | 14 | ||||
-rw-r--r-- | mi/mipointer.h | 2 |
3 files changed, 9 insertions, 10 deletions
diff --git a/dix/getevents.c b/dix/getevents.c index 4206ca9e1..bb1f5c96d 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -833,8 +833,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 670f63b6e..4901d139b 100644 --- a/mi/mipointer.c +++ b/mi/mipointer.c @@ -574,7 +574,7 @@ miPointerMoveNoEvent (DeviceIntPtr pDev, ScreenPtr pScreen, * @param[in,out] y The y coordinate in screen coordinates (in regards to total * desktop size) */ -void +ScreenPtr miPointerSetPosition(DeviceIntPtr pDev, int mode, int *x, int *y) { miPointerScreenPtr pScreenPriv; @@ -584,12 +584,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) { @@ -622,11 +622,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; } /** diff --git a/mi/mipointer.h b/mi/mipointer.h index c4265f9d8..35428df32 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, |