summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorJoel Bosveld <Joel.Bosveld@gmail.com>2009-08-15 13:34:28 +0800
committerJoel Bosveld <Joel.Bosveld@gmail.com>2009-08-15 13:34:28 +0800
commit0867820bd0df43348a38fc0228d73cdccf66add3 (patch)
treec9e172ca24ea8900791d10eb1d4624e8a0f18a39 /dix
parent0493c42811227b7946f527aff93986de147cbb89 (diff)
composite: ensure that cursor is correctly confined to transformed windows
Diffstat (limited to 'dix')
-rw-r--r--dix/events.c78
1 files changed, 75 insertions, 3 deletions
diff --git a/dix/events.c b/dix/events.c
index df512d589..87d2ef746 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -764,6 +764,13 @@ CheckPhysLimits(
}
/* constrain the pointer to those limits */
+#ifdef COMPOSITE
+ if (pSprite->confineTo)
+ /* Need the transformed root coordinates */
+ CompositeXYScreenToWindowRootCoordinate (pSprite->confineTo, pDev,
+ new.x, new.y,
+ &new.x, &new.y);
+#endif
if (new.x < pSprite->physLimits.x1)
new.x = pSprite->physLimits.x1;
else
@@ -776,6 +783,14 @@ CheckPhysLimits(
new.y = pSprite->physLimits.y2 - 1;
if (pSprite->hotShape)
ConfineToShape(pDev, pSprite->hotShape, &new.x, &new.y);
+#ifdef COMPOSITE
+ if (pSprite->confineTo)
+ /* Back to screen root coordinates */
+ CompositeXYScreenFromWindowRootCoordinate (pSprite->confineTo, pDev,
+ new.x, new.y,
+ &new.x, &new.y);
+#endif
+
if ((pScreen != pSprite->hotPhys.pScreen) ||
(new.x != pSprite->hotPhys.x) || (new.y != pSprite->hotPhys.y))
{
@@ -873,6 +888,11 @@ CheckVirtualMotion(
}
}
+#ifdef COMPOSITE
+ /* Need the transformed root coordinates */
+ CompositeXYScreenToWindowRootCoordinate (pWin, pDev,
+ pSprite->hot.x, pSprite->hot.y, &pSprite->hot.x, &pSprite->hot.y);
+#endif
lims = *REGION_EXTENTS(pWin->drawable.pScreen, &pWin->borderSize);
if (pSprite->hot.x < lims.x1)
pSprite->hot.x = lims.x1;
@@ -898,6 +918,11 @@ CheckVirtualMotion(
if (reg)
ConfineToShape(pDev, reg, &pSprite->hot.x, &pSprite->hot.y);
+#ifdef COMPOSITE
+ /* Back to screen root coordinates */
+ CompositeXYScreenFromWindowRootCoordinate (pWin, pDev,
+ pSprite->hot.x, pSprite->hot.y, &pSprite->hot.x, &pSprite->hot.y);
+#endif
if (qe && ev)
{
@@ -925,6 +950,10 @@ ConfineCursorToWindow(DeviceIntPtr pDev, WindowPtr pWin, Bool generateEvents, Bo
}
else
{
+#ifdef COMPOSITE
+ pSprite->confineTo = (pWin == WindowTable[pWin->drawable.pScreen->myNum])
+ ? NullWindow : pWin;
+#endif
#ifdef PANORAMIX
if(!noPanoramiXExtension) {
XineramaConfineCursorToWindow(pDev, pWin, generateEvents);
@@ -2829,6 +2858,13 @@ CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev)
pSprite->hot.x = ev->root_x;
pSprite->hot.y = ev->root_y;
+#ifdef COMPOSITE
+ if (pSprite->confineTo)
+ /* Need the transformed root coordinates */
+ CompositeXYScreenToWindowRootCoordinate (pSprite->confineTo, pDev,
+ pSprite->hot.x, pSprite->hot.y,
+ &pSprite->hot.x, &pSprite->hot.y);
+#endif
if (pSprite->hot.x < pSprite->physLimits.x1)
pSprite->hot.x = pSprite->physLimits.x1;
else if (pSprite->hot.x >= pSprite->physLimits.x2)
@@ -2839,6 +2875,13 @@ CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev)
pSprite->hot.y = pSprite->physLimits.y2 - 1;
if (pSprite->hotShape)
ConfineToShape(pDev, pSprite->hotShape, &pSprite->hot.x, &pSprite->hot.y);
+#ifdef COMPOSITE
+ if (pSprite->confineTo)
+ /* Back to screen root coordinates */
+ CompositeXYScreenFromWindowRootCoordinate (pSprite->confineTo,
+ pDev, pSprite->hot.x, pSprite->hot.y,
+ &pSprite->hot.x, &pSprite->hot.y);
+#endif
pSprite->hotPhys = pSprite->hot;
if ((pSprite->hotPhys.x != ev->root_x) ||
@@ -3068,6 +3111,10 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin)
REGION_NULL(pScreen, &pSprite->Reg2);
}
#endif
+
+#ifdef COMPOSITE
+ pSprite->confineTo = NullWindow;
+#endif
}
/**
@@ -3233,7 +3280,8 @@ XineramaWarpPointer(ClientPtr client)
{
WindowPtr dest = NULL;
int x, y, rc;
- SpritePtr pSprite = PickPointer(client)->spriteInfo->sprite;
+ DeviceIntPtr dev = PickPointer(client);
+ SpritePtr pSprite = dev->spriteInfo->sprite;
REQUEST(xWarpPointerReq);
@@ -3283,6 +3331,12 @@ XineramaWarpPointer(ClientPtr client)
x += stuff->dstX;
y += stuff->dstY;
+#ifdef COMPOSITE
+ /* Need the transformed root coordinates */
+ if (pSprite->confineTo)
+ CompositeXYScreenToWindowRootCoordinate (pSprite->confineTo, dev,
+ x, y, &x, &y);
+#endif
if (x < pSprite->physLimits.x1)
x = pSprite->physLimits.x1;
else if (x >= pSprite->physLimits.x2)
@@ -3292,9 +3346,15 @@ XineramaWarpPointer(ClientPtr client)
else if (y >= pSprite->physLimits.y2)
y = pSprite->physLimits.y2 - 1;
if (pSprite->hotShape)
- ConfineToShape(PickPointer(client), pSprite->hotShape, &x, &y);
+ ConfineToShape(dev, pSprite->hotShape, &x, &y);
+#ifdef COMPOSITE
+ /* Back to screen root coordinates */
+ if (pSprite->confineTo)
+ CompositeXYScreenFromWindowRootCoordinate (pSprite->confineTo, dev,
+ x, y, &x, &y);
+#endif
- XineramaSetCursorPosition(PickPointer(client), x, y, TRUE);
+ XineramaSetCursorPosition(dev, x, y, TRUE);
return Success;
}
@@ -3389,6 +3449,12 @@ ProcWarpPointer(ClientPtr client)
if (newScreen == pSprite->hotPhys.pScreen)
{
+#ifdef COMPOSITE
+ /* Need the transformed root coordinates */
+ if (pSprite->confineTo)
+ CompositeXYScreenToWindowRootCoordinate (pSprite->confineTo, dev,
+ x, y, &x, &y);
+#endif
if (x < pSprite->physLimits.x1)
x = pSprite->physLimits.x1;
else if (x >= pSprite->physLimits.x2)
@@ -3399,6 +3465,12 @@ ProcWarpPointer(ClientPtr client)
y = pSprite->physLimits.y2 - 1;
if (pSprite->hotShape)
ConfineToShape(dev, pSprite->hotShape, &x, &y);
+#ifdef COMPOSITE
+ /* Back to screen root coordinates */
+ if (pSprite->confineTo)
+ CompositeXYScreenFromWindowRootCoordinate (pSprite->confineTo,
+ dev, x, y, &x, &y);
+#endif
(*newScreen->SetCursorPosition)(dev, newScreen, x, y, TRUE);
}
else if (!PointerConfinedToScreen(dev))