xserver: Branch 'master' - 2 commits

Peter Hutterer whot at kemper.freedesktop.org
Mon Jan 12 15:25:10 PST 2009


 dix/events.c    |   27 ++++++++++++++++-----------
 dix/getevents.c |   14 +++++++++++++-
 include/input.h |    1 +
 mi/mipointer.c  |    2 +-
 4 files changed, 31 insertions(+), 13 deletions(-)

New commits:
commit d36adf52a2b2711d22b11105f7bd907d4493fb9b
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Jan 12 15:29:36 2009 +1000

    dix: fix WarpPointer calls for devices with custom valuator ranges (#19297)
    
    If the MD's lastSlave was a devices with custom axes ranges, then a
    WarpPointer would position the cursor at the wrong location. A WarpPointer
    request provides screen coordinates and these coordinates were scaled to the
    device range before warping.
    
    This patch consists of two parts:
    1) in the WarpPointer handling, get the lastSlave and post the event through
       this device.
    2) assume that WarpPointer coordinates are always in screen coordinates and
       scale them to device coordinates in GPE before continuing. Note that this
       breaks device-coordinate based XWarpDevicePointer calls (for which the spec
       isn't nailed down yet anyway) until a better solution is found.
    
    X.Org Bug 19297 <http://bugs.freedesktop.org/show_bug.cgi?id=19297>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/events.c b/dix/events.c
index e6a3fbf..da57aa0 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3139,8 +3139,8 @@ ProcWarpPointer(ClientPtr client)
     WindowPtr	dest = NULL;
     int		x, y, rc;
     ScreenPtr	newScreen;
-    DeviceIntPtr dev = PickPointer(client);
-    SpritePtr   pSprite = dev->spriteInfo->sprite;
+    DeviceIntPtr dev;
+    SpritePtr   pSprite;
 
     REQUEST(xWarpPointerReq);
     REQUEST_SIZE_MATCH(xWarpPointerReq);
@@ -3153,6 +3153,12 @@ ProcWarpPointer(ClientPtr client)
 		return rc;
 	}
     }
+
+    dev = PickPointer(client);
+    if (dev->u.lastSlave)
+        dev = dev->u.lastSlave;
+    pSprite = dev->spriteInfo->sprite;
+
 #ifdef PANORAMIX
     if(!noPanoramiXExtension)
 	return XineramaWarpPointer(client);
@@ -3219,13 +3225,12 @@ ProcWarpPointer(ClientPtr client)
 	else if (y >= pSprite->physLimits.y2)
 	    y = pSprite->physLimits.y2 - 1;
 	if (pSprite->hotShape)
-	    ConfineToShape(PickPointer(client), pSprite->hotShape, &x, &y);
-        (*newScreen->SetCursorPosition)(PickPointer(client), newScreen, x, y,
-                                        TRUE);
+	    ConfineToShape(dev, pSprite->hotShape, &x, &y);
+        (*newScreen->SetCursorPosition)(dev, newScreen, x, y, TRUE);
     }
-    else if (!PointerConfinedToScreen(PickPointer(client)))
+    else if (!PointerConfinedToScreen(dev))
     {
-	NewCurrentScreen(PickPointer(client), newScreen, x, y);
+	NewCurrentScreen(dev, newScreen, x, y);
     }
     return Success;
 }
diff --git a/dix/getevents.c b/dix/getevents.c
index acc8a4f..672ff7d 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -999,8 +999,20 @@ GetPointerEvents(EventList *events, DeviceIntPtr pDev, int type, int buttons,
     events = updateFromMaster(events, pDev, &num_events);
 
     if (flags & POINTER_ABSOLUTE)
+    {
+        if (flags & POINTER_SCREEN) /* valuators are in screen coords */
+        {
+
+            valuators[0] = rescaleValuatorAxis(valuators[0], NULL,
+                                               pDev->valuator->axes + 0,
+                                               scr->width);
+            valuators[1] = rescaleValuatorAxis(valuators[1], NULL,
+                                               pDev->valuator->axes + 1,
+                                               scr->height);
+        }
+
         moveAbsolute(pDev, &x, &y, first_valuator, num_valuators, valuators);
-    else {
+    } else {
         if (flags & POINTER_ACCELERATE)
             accelPointer(pDev, first_valuator, num_valuators, valuators, ms);
         moveRelative(pDev, &x, &y, first_valuator, num_valuators, valuators);
diff --git a/include/input.h b/include/input.h
index 3a9bfa2..2dd29f8 100644
--- a/include/input.h
+++ b/include/input.h
@@ -62,6 +62,7 @@ SOFTWARE.
 #define POINTER_RELATIVE (1 << 1)
 #define POINTER_ABSOLUTE (1 << 2)
 #define POINTER_ACCELERATE (1 << 3)
+#define POINTER_SCREEN (1 << 4) /* Data in screen coordinates */
 
 /*int constants for pointer acceleration schemes*/
 #define PtrAccelNoOp            0
diff --git a/mi/mipointer.c b/mi/mipointer.c
index 83a355e..567790c 100644
--- a/mi/mipointer.c
+++ b/mi/mipointer.c
@@ -576,7 +576,7 @@ miPointerMove (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
         }
     }
 
-    nevents = GetPointerEvents(events, pDev, MotionNotify, 0, POINTER_ABSOLUTE, 0, 2, valuators);
+    nevents = GetPointerEvents(events, pDev, MotionNotify, 0, POINTER_SCREEN | POINTER_ABSOLUTE, 0, 2, valuators);
 
     OsBlockSignals();
 #ifdef XQUARTZ
commit 488d45295105daf10ccd17ca93ae6a6f4d0104f1
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Jan 12 16:16:24 2009 +1000

    dix: EnqueueEvent and PlayReleasedEvent need to handle DeviceMotionNotifies
    
    No MotionNotify events in the processing anymore, so let's have them treat DMN
    instead.
    
    Reported by Thomas Jaeger.

diff --git a/dix/events.c b/dix/events.c
index ba90ff1..e6a3fbf 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1157,14 +1157,14 @@ EnqueueEvent(xEvent *xE, DeviceIntPtr device, int count)
 	 *  the data that GetCurrentRootWindow relies on hasn't been
 	 *  updated yet.
 	 */
-	if (xE->u.u.type == MotionNotify)
+	if (xE->u.u.type == DeviceMotionNotify)
 	    XE_KBPTR.root =
 		WindowTable[pSprite->hotPhys.pScreen->myNum]->drawable.id;
 	eventinfo.events = xE;
 	eventinfo.count = count;
 	CallCallbacks(&DeviceEventCallback, (pointer)&eventinfo);
     }
-    if (xE->u.u.type == MotionNotify)
+    if (xE->u.u.type == DeviceMotionNotify)
     {
 #ifdef PANORAMIX
 	if(!noPanoramiXExtension) {
@@ -1178,7 +1178,7 @@ EnqueueEvent(xEvent *xE, DeviceIntPtr device, int count)
 	pSprite->hotPhys.y = XE_KBPTR.rootY;
 	/* do motion compression, but not if from different devices */
 	if (tail &&
-	    (tail->event->u.u.type == MotionNotify) &&
+	    (tail->event->u.u.type == DeviceMotionNotify) &&
             (tail->device == device) &&
 	    (tail->pScreen == pSprite->hotPhys.pScreen))
 	{
@@ -1245,7 +1245,7 @@ PlayReleasedEvents(void)
             pDev = qe->device;
 	    if (*syncEvents.pendtail == *prev)
 		syncEvents.pendtail = prev;
-	    if (qe->event->u.u.type == MotionNotify)
+	    if (qe->event->u.u.type == DeviceMotionNotify)
 		CheckVirtualMotion(pDev, qe, NullWindow);
 	    syncEvents.time.months = qe->months;
             /* XXX: Hack! We can't reliably get the time from GenericEvents,


More information about the xorg-commit mailing list