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. */
|
* screenx back into device co-ordinates. */
|
||||||
isx = trunc(*screenx);
|
isx = trunc(*screenx);
|
||||||
isy = trunc(*screeny);
|
isy = trunc(*screeny);
|
||||||
miPointerSetPosition(dev, mode, &isx, &isy);
|
scr = miPointerSetPosition(dev, mode, &isx, &isy);
|
||||||
scr = miPointerGetScreen(dev);
|
|
||||||
if (isx != trunc(*screenx))
|
if (isx != trunc(*screenx))
|
||||||
{
|
{
|
||||||
*screenx -= trunc(*screenx) - isx;
|
*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
|
* @param[in,out] y The y coordinate in screen coordinates (in regards to total
|
||||||
* desktop size)
|
* desktop size)
|
||||||
*/
|
*/
|
||||||
void
|
ScreenPtr
|
||||||
miPointerSetPosition(DeviceIntPtr pDev, int mode, int *x, int *y)
|
miPointerSetPosition(DeviceIntPtr pDev, int mode, int *x, int *y)
|
||||||
{
|
{
|
||||||
miPointerScreenPtr pScreenPriv;
|
miPointerScreenPtr pScreenPriv;
|
||||||
|
@ -584,12 +584,12 @@ miPointerSetPosition(DeviceIntPtr pDev, int mode, int *x, int *y)
|
||||||
miPointerPtr pPointer;
|
miPointerPtr pPointer;
|
||||||
|
|
||||||
if (!pDev || !pDev->coreEvents)
|
if (!pDev || !pDev->coreEvents)
|
||||||
return;
|
return NULL;
|
||||||
|
|
||||||
pPointer = MIPOINTER(pDev);
|
pPointer = MIPOINTER(pDev);
|
||||||
pScreen = pPointer->pScreen;
|
pScreen = pPointer->pScreen;
|
||||||
if (!pScreen)
|
if (!pScreen)
|
||||||
return; /* called before ready */
|
return NULL; /* called before ready */
|
||||||
|
|
||||||
if (*x < 0 || *x >= pScreen->width || *y < 0 || *y >= pScreen->height)
|
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)
|
if (pScreen->ConstrainCursorHarder)
|
||||||
pScreen->ConstrainCursorHarder(pDev, pScreen, mode, x, y);
|
pScreen->ConstrainCursorHarder(pDev, pScreen, mode, x, y);
|
||||||
|
|
||||||
if (pPointer->x == *x && pPointer->y == *y &&
|
if (pPointer->x != *x || pPointer->y != *y ||
|
||||||
pPointer->pScreen == pScreen)
|
pPointer->pScreen != pScreen)
|
||||||
return;
|
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:
|
/* Moves the cursor to the specified position. May clip the co-ordinates:
|
||||||
* x and y are modified in-place. */
|
* x and y are modified in-place. */
|
||||||
extern _X_EXPORT void miPointerSetPosition(
|
extern _X_EXPORT ScreenPtr miPointerSetPosition(
|
||||||
DeviceIntPtr pDev,
|
DeviceIntPtr pDev,
|
||||||
int mode,
|
int mode,
|
||||||
int *x,
|
int *x,
|
||||||
|
|
Loading…
Reference in New Issue