[PATCH 5/7] XineramaSetCursorPosition: use screen bounds directly, not POINT_IN_REGION.

Jamey Sharp jamey at minilop.net
Sun May 23 16:22:11 PDT 2010


This hides a MAXSCREENS-sized array as an implementation detail of
panoramiX.c rather than an exported global.

Signed-off-by: Jamey Sharp <jamey at minilop.net>
---
This conflicts with Keith's change-region-api branch, but the merge is
trivial, since it's just deleting region calls.

 Xext/panoramiX.c    |    2 +-
 Xext/panoramiXsrv.h |    2 --
 dix/events.c        |   13 +++++++++----
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/Xext/panoramiX.c b/Xext/panoramiX.c
index b87da24..78728a9 100644
--- a/Xext/panoramiX.c
+++ b/Xext/panoramiX.c
@@ -119,7 +119,7 @@ typedef struct {
   CloseScreenProcPtr	CloseScreen;
 } PanoramiXScreenRec, *PanoramiXScreenPtr;
 
-RegionRec XineramaScreenRegions[MAXSCREENS];
+static RegionRec XineramaScreenRegions[MAXSCREENS];
 
 static void XineramaValidateGC(GCPtr, unsigned long, DrawablePtr);
 static void XineramaChangeGC(GCPtr, unsigned long);
diff --git a/Xext/panoramiXsrv.h b/Xext/panoramiXsrv.h
index af0017d..5b1a3a9 100644
--- a/Xext/panoramiXsrv.h
+++ b/Xext/panoramiXsrv.h
@@ -21,8 +21,6 @@ extern _X_EXPORT int XineramaDeleteResource(pointer, XID);
 
 extern _X_EXPORT void XineramaReinitData(ScreenPtr);
 
-extern _X_EXPORT RegionRec XineramaScreenRegions[MAXSCREENS];
-
 extern _X_EXPORT unsigned long XRC_DRAWABLE;
 extern _X_EXPORT unsigned long XRT_WINDOW;
 extern _X_EXPORT unsigned long XRT_PIXMAP;
diff --git a/dix/events.c b/dix/events.c
index e8e65e2..502eebd 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -486,6 +486,13 @@ SyntheticMotion(DeviceIntPtr dev, int x, int y) {
 static void PostNewCursor(DeviceIntPtr pDev);
 
 static Bool
+pointOnScreen(ScreenPtr pScreen, int x, int y)
+{
+    return x >= pScreen->x && x < pScreen->x + pScreen->width &&
+           y >= pScreen->y && y < pScreen->y + pScreen->height;
+}
+
+static Bool
 XineramaSetCursorPosition(
     DeviceIntPtr pDev,
     int x,
@@ -493,7 +500,6 @@ XineramaSetCursorPosition(
     Bool generateEvent
 ){
     ScreenPtr pScreen;
-    BoxRec box;
     int i;
     SpritePtr pSprite = pDev->spriteInfo->sprite;
 
@@ -505,14 +511,13 @@ XineramaSetCursorPosition(
     x += screenInfo.screens[0]->x;
     y += screenInfo.screens[0]->y;
 
-    if(!POINT_IN_REGION(pScreen, &XineramaScreenRegions[pScreen->myNum],
-								x, y, &box))
+    if(!pointOnScreen(pScreen, x, y))
     {
 	FOR_NSCREENS(i)
 	{
 	    if(i == pScreen->myNum)
 		continue;
-	    if(POINT_IN_REGION(pScreen, &XineramaScreenRegions[i], x, y, &box))
+	    if(pointOnScreen(screenInfo.screens[i], x, y))
 	    {
 		pScreen = screenInfo.screens[i];
 		break;
-- 
1.7.0



More information about the xorg-devel mailing list