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>
This commit is contained in:
parent
88dfe5366d
commit
81cfe44b1e
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue
Block a user