[RFC XI 2.1 - xserver 5/9 (master)] Input: Pass sprite instead of device to XYToWindow

Cyril Brulebois kibi at debian.org
Fri Nov 12 18:33:53 PST 2010


From: Daniel Stone <daniel at fooishbar.org>

XYToWindow calculates the position of the cursor and updates the sprite
trace, but does nothing else with the device.  Pass a SpritePtr instead
so we can update an alternate focus instead of hardcoding the device's
sprite.

Signed-off-by: Daniel Stone <daniel at fooishbar.org>

[KiBi: Fix 2 hunks failed, in ComputeFreezes(void), to apply on top of master]
---
 dix/events.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)

diff --git a/dix/events.c b/dix/events.c
index 2c90052..987abc2 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -335,7 +335,7 @@ IsMaster(DeviceIntPtr dev)
 }
 
 static WindowPtr XYToWindow(
-    DeviceIntPtr pDev,
+    SpritePtr pSprite,
     int x,
     int y
 );
@@ -1276,6 +1276,7 @@ static void
 ComputeFreezes(void)
 {
     DeviceIntPtr replayDev = syncEvents.replayDev;
+    SpritePtr pSprite = replayDev->spriteInfo->sprite;
     WindowPtr w;
     GrabPtr grab;
     DeviceIntPtr dev;
@@ -1292,7 +1293,7 @@ ComputeFreezes(void)
 
 	syncEvents.replayDev = (DeviceIntPtr)NULL;
 
-        w = XYToWindow(replayDev, event->root_x, event->root_y);
+        w = XYToWindow(pSprite, event->root_x, event->root_y);
         if (!CheckDeviceGrabs(replayDev, event, syncEvents.replayWin))
         {
             if (replayDev->focus && !IsPointerEvent((InternalEvent*)event))
@@ -2567,15 +2568,13 @@ PointInBorderSize(WindowPtr pWin, int x, int y)
  * @returns the window at the given coordinates.
  */
 static WindowPtr
-XYToWindow(DeviceIntPtr pDev, int x, int y)
+XYToWindow(SpritePtr pSprite, int x, int y)
 {
     WindowPtr  pWin;
     BoxRec		box;
-    SpritePtr pSprite;
 
-    pSprite = pDev->spriteInfo->sprite;
     pSprite->spriteTraceGood = 1;	/* root window still there */
-    pWin = RootWindow(pDev)->firstChild;
+    pWin = pSprite->spriteTrace[0]->firstChild;
     while (pWin)
     {
 	if ((pWin->mapped) &&
@@ -2787,7 +2786,7 @@ CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev)
 	ev->root_y = pSprite->hot.y;
     }
 
-    newSpriteWin = XYToWindow(pDev, pSprite->hot.x, pSprite->hot.y);
+    newSpriteWin = XYToWindow(pSprite, pSprite->hot.x, pSprite->hot.y);
 
     if (newSpriteWin != prevSpriteWin)
     {
-- 
1.7.2.3



More information about the xorg-devel mailing list