aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/mi
diff options
context:
space:
mode:
Diffstat (limited to 'xorg-server/mi')
-rw-r--r--xorg-server/mi/mipointer.c12
-rw-r--r--xorg-server/mi/mipointer.h1
-rw-r--r--xorg-server/mi/misprite.c41
3 files changed, 31 insertions, 23 deletions
diff --git a/xorg-server/mi/mipointer.c b/xorg-server/mi/mipointer.c
index bbb32f745..e8ed106ea 100644
--- a/xorg-server/mi/mipointer.c
+++ b/xorg-server/mi/mipointer.c
@@ -272,6 +272,9 @@ miPointerSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen,
pPointer->generateEvent = generateEvent;
+ if (pScreen->ConstrainCursorHarder)
+ pScreen->ConstrainCursorHarder(pDev, pScreen, Absolute, &x, &y);
+
/* device dependent - must pend signal and call miPointerWarpCursor */
(*pScreenPriv->screenFuncs->WarpCursor) (pDev, pScreen, x, y);
if (!generateEvent)
@@ -560,14 +563,18 @@ miPointerMoveNoEvent (DeviceIntPtr pDev, ScreenPtr pScreen,
* 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 coordiante in screen coordinates (in regards to total
* desktop size)
* @param[in,out] y The y coordiante in screen coordinates (in regards to total
* desktop size)
*/
void
-miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y)
+miPointerSetPosition(DeviceIntPtr pDev, int mode, int *x, int *y)
{
miPointerScreenPtr pScreenPriv;
ScreenPtr pScreen;
@@ -612,6 +619,9 @@ miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y)
if (*y >= pPointer->limits.y2)
*y = pPointer->limits.y2 - 1;
+ if (pScreen->ConstrainCursorHarder)
+ pScreen->ConstrainCursorHarder(pDev, pScreen, mode, x, y);
+
if (pPointer->x == *x && pPointer->y == *y &&
pPointer->pScreen == pScreen)
return;
diff --git a/xorg-server/mi/mipointer.h b/xorg-server/mi/mipointer.h
index caf505019..426ef1650 100644
--- a/xorg-server/mi/mipointer.h
+++ b/xorg-server/mi/mipointer.h
@@ -133,6 +133,7 @@ extern _X_EXPORT void miPointerGetPosition(
* x and y are modified in-place. */
extern _X_EXPORT void miPointerSetPosition(
DeviceIntPtr pDev,
+ int mode,
int *x,
int *y);
diff --git a/xorg-server/mi/misprite.c b/xorg-server/mi/misprite.c
index 9df6c1fb1..64c6ce47b 100644
--- a/xorg-server/mi/misprite.c
+++ b/xorg-server/mi/misprite.c
@@ -308,7 +308,7 @@ miSpriteInitialize (ScreenPtr pScreen,
if (!dixRegisterPrivateKey(&miSpriteScreenKeyRec, PRIVATE_SCREEN, 0))
return FALSE;
- if (!dixRegisterPrivateKey(&miSpriteDevPrivatesKeyRec, PRIVATE_DEVICE, 0))
+ if (!dixRegisterPrivateKey(&miSpriteDevPrivatesKeyRec, PRIVATE_DEVICE, sizeof(miCursorInfoRec)))
return FALSE;
pScreenPriv = malloc(sizeof (miSpriteScreenRec));
@@ -863,38 +863,35 @@ miSpriteMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
static Bool
miSpriteDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
{
- miCursorInfoPtr pCursorInfo;
- int ret = FALSE;
-
- pCursorInfo = malloc(sizeof(miCursorInfoRec));
- if (!pCursorInfo)
- return FALSE;
-
- pCursorInfo->pCursor = NULL;
- pCursorInfo->x = 0;
- pCursorInfo->y = 0;
- pCursorInfo->isUp = FALSE;
- pCursorInfo->shouldBeUp = FALSE;
- pCursorInfo->pCacheWin = NullWindow;
- pCursorInfo->isInCacheWin = FALSE;
- pCursorInfo->checkPixels = TRUE;
- pCursorInfo->pScreen = FALSE;
+ int ret = miDCDeviceInitialize(pDev, pScreen);
- ret = miDCDeviceInitialize(pDev, pScreen);
- if (!ret)
+ if (ret)
{
- free(pCursorInfo);
- pCursorInfo = NULL;
+ miCursorInfoPtr pCursorInfo;
+ pCursorInfo = dixLookupPrivate(&pDev->devPrivates, miSpriteDevPrivatesKey);
+ pCursorInfo->pCursor = NULL;
+ pCursorInfo->x = 0;
+ pCursorInfo->y = 0;
+ pCursorInfo->isUp = FALSE;
+ pCursorInfo->shouldBeUp = FALSE;
+ pCursorInfo->pCacheWin = NullWindow;
+ pCursorInfo->isInCacheWin = FALSE;
+ pCursorInfo->checkPixels = TRUE;
+ pCursorInfo->pScreen = FALSE;
}
- dixSetPrivate(&pDev->devPrivates, miSpriteDevPrivatesKey, pCursorInfo);
+
return ret;
}
static void
miSpriteDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
{
+ miCursorInfoPtr pCursorInfo = dixLookupPrivate(&pDev->devPrivates, miSpriteDevPrivatesKey);
+
if (DevHasCursor(pDev))
miDCDeviceCleanup(pDev, pScreen);
+
+ memset(pCursorInfo, 0, sizeof(miCursorInfoRec));
}
/*