[PATCH 2/5] dix: reduce redunancy in XineramaConfineCursorToWindow.

Peter Hutterer peter.hutterer at who-t.net
Thu Jan 29 23:05:29 PST 2009


---
 dix/events.c |   75 +++++++++++++++++++++++++--------------------------------
 1 files changed, 33 insertions(+), 42 deletions(-)

diff --git a/dix/events.c b/dix/events.c
index 5024237..f42bf63 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -549,52 +549,44 @@ XineramaConfineCursorToWindow(DeviceIntPtr pDev,
 {
     SpritePtr pSprite = pDev->spriteInfo->sprite;
 
-    if (syncEvents.playingEvents)
-    {
-	CheckVirtualMotion(pDev, (QdEventPtr)NULL, pWin);
-	SyntheticMotion(pDev, pSprite->hot.x, pSprite->hot.y);
-    }
-    else
-    {
-	int x, y, off_x, off_y, i;
+    int x, y, off_x, off_y, i;
 
-	if(!XineramaSetWindowPntrs(pDev, pWin))
-	    return;
+    if(!XineramaSetWindowPntrs(pDev, pWin))
+        return;
 
-	i = PanoramiXNumScreens - 1;
+    i = PanoramiXNumScreens - 1;
 
-	REGION_COPY(pSprite->screen, &pSprite->Reg1,
-					&pSprite->windows[i]->borderSize);
-	off_x = panoramiXdataPtr[i].x;
-	off_y = panoramiXdataPtr[i].y;
+    REGION_COPY(pSprite->screen, &pSprite->Reg1,
+            &pSprite->windows[i]->borderSize);
+    off_x = panoramiXdataPtr[i].x;
+    off_y = panoramiXdataPtr[i].y;
 
-	while(i--) {
-	    x = off_x - panoramiXdataPtr[i].x;
-	    y = off_y - panoramiXdataPtr[i].y;
+    while(i--) {
+        x = off_x - panoramiXdataPtr[i].x;
+        y = off_y - panoramiXdataPtr[i].y;
 
-	    if(x || y)
-		REGION_TRANSLATE(pSprite->screen, &pSprite->Reg1, x, y);
+        if(x || y)
+            REGION_TRANSLATE(pSprite->screen, &pSprite->Reg1, x, y);
 
-	    REGION_UNION(pSprite->screen, &pSprite->Reg1, &pSprite->Reg1,
-					&pSprite->windows[i]->borderSize);
+        REGION_UNION(pSprite->screen, &pSprite->Reg1, &pSprite->Reg1,
+                &pSprite->windows[i]->borderSize);
 
-	    off_x = panoramiXdataPtr[i].x;
-	    off_y = panoramiXdataPtr[i].y;
-	}
+        off_x = panoramiXdataPtr[i].x;
+        off_y = panoramiXdataPtr[i].y;
+    }
 
-	pSprite->hotLimits = *REGION_EXTENTS(pSprite->screen, &pSprite->Reg1);
+    pSprite->hotLimits = *REGION_EXTENTS(pSprite->screen, &pSprite->Reg1);
 
-	if(REGION_NUM_RECTS(&pSprite->Reg1) > 1)
-	   pSprite->hotShape = &pSprite->Reg1;
-	else
-	   pSprite->hotShape = NullRegion;
+    if(REGION_NUM_RECTS(&pSprite->Reg1) > 1)
+        pSprite->hotShape = &pSprite->Reg1;
+    else
+        pSprite->hotShape = NullRegion;
 
-	pSprite->confined = FALSE;
-	pSprite->confineWin = (pWin == WindowTable[0]) ? NullWindow : pWin;
+    pSprite->confined = FALSE;
+    pSprite->confineWin = (pWin == WindowTable[0]) ? NullWindow : pWin;
 
-        XineramaCheckPhysLimits(pDev, pSprite->current,
-                                generateEvents);
-    }
+    XineramaCheckPhysLimits(pDev, pSprite->current,
+            generateEvents);
 }
 
 
@@ -835,13 +827,6 @@ ConfineCursorToWindow(DeviceIntPtr pDev, WindowPtr pWin, Bool generateEvents, Bo
     ScreenPtr pScreen = pWin->drawable.pScreen;
     SpritePtr pSprite = pDev->spriteInfo->sprite;
 
-#ifdef PANORAMIX
-    if(!noPanoramiXExtension) {
-	XineramaConfineCursorToWindow(pDev, pWin, generateEvents);
-	return;
-    }
-#endif
-
     if (syncEvents.playingEvents)
     {
 	CheckVirtualMotion(pDev, (QdEventPtr)NULL, pWin);
@@ -849,6 +834,12 @@ ConfineCursorToWindow(DeviceIntPtr pDev, WindowPtr pWin, Bool generateEvents, Bo
     }
     else
     {
+#ifdef PANORAMIX
+        if(!noPanoramiXExtension) {
+            XineramaConfineCursorToWindow(pDev, pWin, generateEvents);
+            return;
+        }
+#endif
 	pSprite->hotLimits = *REGION_EXTENTS( pScreen, &pWin->borderSize);
 	pSprite->hotShape = wBoundingShape(pWin) ? &pWin->borderSize
 					       : NullRegion;
-- 
1.6.0.6




More information about the xorg mailing list