xserver: Branch 'server-1.6-branch' - 9 commits

Keith Packard keithp at kemper.freedesktop.org
Fri Jan 30 17:35:56 PST 2009


 Xext/xtest.c       |    2 +-
 Xi/exevents.c      |   20 ++++++++------------
 Xi/queryst.c       |    3 +--
 dix/devices.c      |   32 +++++++++-----------------------
 dix/events.c       |   29 +++++++++++++++++------------
 dix/getevents.c    |   14 +++++++++++++-
 include/input.h    |    1 +
 include/inputstr.h |    9 +++++----
 mi/mi.h            |    4 ++++
 mi/mieq.c          |   26 ++++++++++++++++++++++++--
 mi/mipointer.c     |    2 +-
 xkb/ddxDevBtn.c    |    2 +-
 xkb/xkbActions.c   |    4 ++--
 13 files changed, 87 insertions(+), 61 deletions(-)

New commits:
commit b893dc59da9f5a7afb59ea0b2cd794872fc5727f
Author: Thomas Jaeger <ThJaeger at gmail.com>
Date:   Sat Dec 20 16:17:02 2008 +0100

    Don't release grabs unless all buttons are up
    
    Previously, only buttons <= 5 would count here, but the core protocol
    allows for 255 buttons.
    
    http://lists.freedesktop.org/archives/xorg/2009-January/042092.html
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 717a961528ec69a6e630d536e15568670e0b398a)
    
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/Xi/exevents.c b/Xi/exevents.c
index b4359a8..482041f 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1069,7 +1069,7 @@ ProcessOtherEvent(xEventPtr xE, DeviceIntPtr device, int count)
 	    xE->u.u.detail = key;
 	    return;
 	}
-        if (!b->state && device->deviceGrab.fromPassiveGrab)
+        if (!b->buttonsDown && device->deviceGrab.fromPassiveGrab)
             deactivateDeviceGrab = TRUE;
     }
 
diff --git a/dix/events.c b/dix/events.c
index 768a33e..6743cae 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3848,7 +3848,7 @@ ProcessPointerEvent (xEvent *xE, DeviceIntPtr mouse, int count)
 	    if (xE->u.u.detail == 0)
 		return;
             filters[mouse->id][Motion_Filter(butc)] = MotionNotify;
-	    if (!butc->state && mouse->deviceGrab.fromPassiveGrab)
+	    if (!butc->buttonsDown && mouse->deviceGrab.fromPassiveGrab)
 		deactivateGrab = TRUE;
 	    break;
 	default:
commit 191161a24a80dc553b11f829c12cfffb76ec7185
Author: Thomas Jaeger <ThJaeger at gmail.com>
Date:   Mon Dec 22 00:55:09 2008 +0100

    Count the number of logically down buttons in buttonsDown
    
    This fixes the following bug.  Assuming your window manager grabs
    Alt+Button1 to move windows, map Button3 to 0 via XSetPointerMapping,
    then press the physical button 3 (this shouldn't have any effect), press
    Alt and then button 1.  The press event is delivered to the application
    instead of firing the grab.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit f7f85f696570541e2dd43462675de9e6ee46f545)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 2aa3161..b4359a8 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -895,10 +895,10 @@ UpdateDeviceState(DeviceIntPtr device, xEvent* xE, int count)
         *kptr |= bit;
 	if (device->valuator)
 	    device->valuator->motionHintWindow = NullWindow;
-        b->buttonsDown++;
-	b->motionMask = DeviceButtonMotionMask;
         if (!b->map[key])
             return DONT_PROCESS;
+        b->buttonsDown++;
+	b->motionMask = DeviceButtonMotionMask;
         if (b->map[key] <= 5)
 	    b->state |= (Button1Mask >> 1) << b->map[key];
 	SetMaskForEvent(device->id, Motion_Filter(b), DeviceMotionNotify);
@@ -927,10 +927,10 @@ UpdateDeviceState(DeviceIntPtr device, xEvent* xE, int count)
         *kptr &= ~bit;
 	if (device->valuator)
 	    device->valuator->motionHintWindow = NullWindow;
-        if (b->buttonsDown >= 1 && !--b->buttonsDown)
-	    b->motionMask = 0;
         if (!b->map[key])
             return DONT_PROCESS;
+        if (b->buttonsDown >= 1 && !--b->buttonsDown)
+	    b->motionMask = 0;
 	if (b->map[key] <= 5)
 	    b->state &= ~((Button1Mask >> 1) << b->map[key]);
 	SetMaskForEvent(device->id, Motion_Filter(b), DeviceMotionNotify);
diff --git a/include/inputstr.h b/include/inputstr.h
index 4719d37..a6f823c 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -185,7 +185,11 @@ typedef struct _ValuatorClassRec {
 
 typedef struct _ButtonClassRec {
     CARD8		numButtons;
-    CARD8		buttonsDown;	/* number of buttons currently down */
+    CARD8		buttonsDown;	/* number of buttons currently down
+                                           This counts logical buttons, not
+					   physical ones, i.e if some buttons
+					   are mapped to 0, they're not counted
+					   here */
     unsigned short	state;
     Mask		motionMask;
     CARD8		down[DOWN_LENGTH];
commit fe0abdceb483ec0bb2977016b00aef57033aa449
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Jan 8 11:53:30 2009 +1000

    mi: ensure chained button mappings from SD -> MD (#19282)
    
    After copying the master event, flip the detail field to the mapped button of
    the SD, not the physical button. This way if the SD has a mapping 1:3 and the
    MD has a mapping of 3:4, a press on button 1 on the SD results in a core event
    on button 4.
    
    X.Org Bug 19282 <http://bugs.freedesktop.org/show_bug.cgi?id=19282>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    Signed-off-by: Keith Packard <keithp at keithp.com>

diff --git a/mi/mi.h b/mi/mi.h
index 444d3ad..6e8b89e 100644
--- a/mi/mi.h
+++ b/mi/mi.h
@@ -175,6 +175,10 @@ extern void mieqProcessInputEvents(
 typedef void (*mieqHandler)(int, xEventPtr, DeviceIntPtr, int);
 void mieqSetHandler(int event, mieqHandler handler);
 
+void
+CopyGetMasterEvent(DeviceIntPtr mdev, DeviceIntPtr sdev, xEvent* original,
+                   EventListPtr master, int count);
+
 /* miexpose.c */
 
 extern RegionPtr miHandleExposures(
diff --git a/mi/mieq.c b/mi/mieq.c
index 8d68ca1..226caa6 100644
--- a/mi/mieq.c
+++ b/mi/mieq.c
@@ -327,15 +327,32 @@ ChangeDeviceID(DeviceIntPtr dev, xEvent* event)
         DebugF("[mi] Unknown event type (%d), cannot change id.\n", type);
 }
 
+static void
+FixUpEventForMaster(DeviceIntPtr mdev, DeviceIntPtr sdev, xEvent* original,
+                    EventListPtr master, int count)
+{
+    /* Ensure chained button mappings, i.e. that the detail field is the
+     * value of the mapped button on the SD, not the physical button */
+    if (original->u.u.type == DeviceButtonPress || original->u.u.type == DeviceButtonRelease)
+    {
+        int btn = original->u.u.detail;
+        if (!sdev->button)
+            return; /* Should never happen */
+
+        master->event->u.u.detail = sdev->button->map[btn];
+    }
+}
+
 /**
  * Copy the given event into master.
  * @param mdev The master device
+ * @param sdev The slave device the original event comes from
  * @param original The event as it came from the EQ
  * @param master The event after being copied
  * @param count Number of events in original.
  */
 void
-CopyGetMasterEvent(DeviceIntPtr mdev, xEvent* original,
+CopyGetMasterEvent(DeviceIntPtr mdev, DeviceIntPtr sdev, xEvent* original,
                    EventListPtr master, int count)
 {
     int len = count * sizeof(xEvent);
@@ -350,11 +367,16 @@ CopyGetMasterEvent(DeviceIntPtr mdev, xEvent* original,
 
     memcpy(master->event, original, len);
     while (count--)
+    {
         ChangeDeviceID(mdev, &master->event[count]);
+        FixUpEventForMaster(mdev, sdev, original, master, count);
+    }
 }
 extern void
 CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master);
 
+
+
 /* Call this from ProcessInputEvents(). */
 void
 mieqProcessInputEvents(void)
@@ -431,7 +453,7 @@ mieqProcessInputEvents(void)
                     event->u.u.type == DeviceKeyRelease)
 		    CopyKeyClass(dev, master);
 
-                CopyGetMasterEvent(master, event, masterEvents, nevents);
+                CopyGetMasterEvent(master, dev, event, masterEvents, nevents);
             }
 
             /* If someone's registered a custom event handler, let them
diff --git a/xkb/ddxDevBtn.c b/xkb/ddxDevBtn.c
index 585ad19..44ee75f 100644
--- a/xkb/ddxDevBtn.c
+++ b/xkb/ddxDevBtn.c
@@ -117,7 +117,7 @@ DeviceIntPtr		master = NULL;
         if (!IsPointerDevice(master))
             master = GetPairedDevice(dev->u.master);
 
-        CopyGetMasterEvent(master, &events, masterEvents, count);
+        CopyGetMasterEvent(master, dev, &events, masterEvents, count);
     }
 
     (*dev->public.processInputProc)((xEventPtr)btn, dev, count);
commit 3441917008021fb13cf86fa619970859d927e17a
Author: Thomas Jaeger <thjaeger at gmail.com>
Date:   Mon Jan 5 01:26:42 2009 -0500

    Don't alter device button maps in DoSetPointerMapping
    
    Currently, if a device map differs from the core pointer map, then the
    request may return MappingBusy, even though all the affected core
    buttons are in the up state.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 3d549438c29004d78032ecc50ab45ca0e3f49623)

diff --git a/dix/devices.c b/dix/devices.c
index 47e07f9..0858f20 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -1831,36 +1831,23 @@ static int
 DoSetPointerMapping(ClientPtr client, DeviceIntPtr device, BYTE *map, int n)
 {
     int rc, i = 0;
-    DeviceIntPtr dev = NULL;
 
     if (!device || !device->button)
         return BadDevice;
 
-    for (dev = inputInfo.devices; dev; dev = dev->next) {
-        if ((dev->coreEvents || dev == inputInfo.pointer) && dev->button) {
-	    rc = XaceHook(XACE_DEVICE_ACCESS, client, dev, DixManageAccess);
-	    if (rc != Success)
-		return rc;
-	}
-    }
+    rc = XaceHook(XACE_DEVICE_ACCESS, client, device, DixManageAccess);
+    if (rc != Success)
+        return rc;
 
-    for (dev = inputInfo.devices; dev; dev = dev->next) {
-        if ((dev->coreEvents || dev == inputInfo.pointer) && dev->button) {
-            for (i = 0; i < n; i++) {
-                if ((device->button->map[i + 1] != map[i]) &&
-                        BitIsOn(device->button->down, i + 1)) {
-                    return MappingBusy;
-                }
-            }
+    for (i = 0; i < n; i++) {
+        if ((device->button->map[i + 1] != map[i]) &&
+            BitIsOn(device->button->down, i + 1)) {
+            return MappingBusy;
         }
     }
 
-    for (dev = inputInfo.devices; dev; dev = dev->next) {
-        if ((dev->coreEvents || dev == inputInfo.pointer) && dev->button) {
-            for (i = 0; i < n; i++)
-                dev->button->map[i + 1] = map[i];
-        }
-    }
+    for (i = 0; i < n; i++)
+        device->button->map[i + 1] = map[i];
 
     return Success;
 }
@@ -1917,7 +1904,6 @@ ProcSetPointerMapping(ClientPtr client)
         return Success;
     }
 
-    /* FIXME: Send mapping notifies for all the extended devices as well. */
     SendMappingNotify(ptr, MappingPointer, 0, 0, client);
     WriteReplyToClient(client, sizeof(xSetPointerMappingReply), &rep);
     return Success;
commit 364bcbea48d5e49bef8d36f6724e2702cbb4b1af
Author: Thomas Jaeger <ThJaeger at gmail.com>
Date:   Fri Jan 9 02:02:38 2009 -0500

    Xext: Send out correct events in ProcXTestFakeInput
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit b2756a71a432f7cf7c870a48676c98625512558d)

diff --git a/Xext/xtest.c b/Xext/xtest.c
index 1290a23..a7f3830 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -396,7 +396,7 @@ ProcXTestFakeInput(client)
 
     OsBlockSignals();
     for (i = 0; i < nevents; i++)
-        mieqEnqueue(dev, events->event);
+        mieqEnqueue(dev, (events+i)->event);
     OsReleaseSignals();
 
     return client->noClientException;
commit e789789196db8271a83c751fdf990ceb70164cb1
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Jan 5 15:48:45 2009 +1000

    xkb: fix typo - missing negation when checking button state.
    
    Introduced with a85f0d6b98237d8a196de624207acf1983a1859a.
    
    Reported by Thomas Jaeger.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
    (cherry picked from commit 515ce3e4ba42605a1ee9979e8bb5acd3cf6470a3)

diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 64e17e9..aea479c 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -1075,7 +1075,7 @@ int		button;
 	switch (filter->upAction.type) {
 	    case XkbSA_LockDeviceBtn:
 		if ((filter->upAction.devbtn.flags&XkbSA_LockNoUnlock)||
-		    BitIsOn(dev->button->down, button))
+		    !BitIsOn(dev->button->down, button))
 		    return 0;
 		XkbDDXFakeDeviceButton(dev,False,button);
 		break;
commit ebb3872925315d705e47e1ccd7f193ac90ac33dc
Author: Peter Hutterer <peter.hutterer at redhat.com>
Date:   Wed Nov 26 11:15:05 2008 +1000

    Xi: fix use of button->down - bitflags instead of int arrays.
    
    The device's button down state array was changed to use DOWN_LENGTH and thus
    bitflags for each button in cfcb3da7.
    
    Update the DBSN events to copy this bit-wise state.
    Update xkb and Xi to check for the bit flag instead of the array value.
    
    Reported by ajax.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at redhat.com>
    (cherry picked from commit a85f0d6b98237d8a196de624207acf1983a1859a)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 083bb2f..2aa3161 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1138,11 +1138,9 @@ FixDeviceStateNotify(DeviceIntPtr dev, deviceStateNotify * ev, KeyClassPtr k,
     ev->num_valuators = 0;
 
     if (b) {
-	int i;
 	ev->classes_reported |= (1 << ButtonClass);
 	ev->num_buttons = b->numButtons;
-	for (i = 0; i < 32; i++)
-	    SetBitIf(ev->buttons, b->down, i);
+	memcpy((char*)ev->buttons, (char*)b->down, 4);
     } else if (k) {
 	ev->classes_reported |= (1 << KeyClass);
 	ev->num_keys = k->curKeySyms.maxKeyCode - k->curKeySyms.minKeyCode;
@@ -1257,13 +1255,11 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail,
 	    first += 3;
 	    nval -= 3;
 	    if (nbuttons > 32) {
-		int i;
 		(ev - 1)->deviceid |= MORE_EVENTS;
 		bev = (deviceButtonStateNotify *) ev++;
 		bev->type = DeviceButtonStateNotify;
 		bev->deviceid = dev->id;
-		for (i = 32; i < MAP_LENGTH; i++)
-		    SetBitIf(bev->buttons, b->down, i);
+		memcpy((char*)&bev->buttons[4], (char*)&b->down[4], DOWN_LENGTH - 4);
 	    }
 	    if (nval > 0) {
 		(ev - 1)->deviceid |= MORE_EVENTS;
@@ -1678,7 +1674,7 @@ SetButtonMapping(ClientPtr client, DeviceIntPtr dev, int nElts, BYTE * map)
     if (BadDeviceMap(&map[0], nElts, 1, 255, &client->errorValue))
 	return BadValue;
     for (i = 0; i < nElts; i++)
-	if ((b->map[i + 1] != map[i]) && (b->down[i + 1]))
+	if ((b->map[i + 1] != map[i]) && BitIsOn(b->down, i + 1))
 	    return MappingBusy;
     for (i = 0; i < nElts; i++)
 	b->map[i + 1] = map[i];
diff --git a/Xi/queryst.c b/Xi/queryst.c
index 268bdd7..21de843 100644
--- a/Xi/queryst.c
+++ b/Xi/queryst.c
@@ -139,8 +139,7 @@ ProcXQueryDeviceState(ClientPtr client)
 	tb->class = ButtonClass;
 	tb->length = sizeof(xButtonState);
 	tb->num_buttons = b->numButtons;
-	for (i = 0; i < MAP_LENGTH; i++)
-            SetBitIf(tb->buttons, b->down, i);
+	memcpy(tb->buttons, b->down, sizeof(b->down));
 	buf += sizeof(xButtonState);
     }
 
diff --git a/dix/devices.c b/dix/devices.c
index bf79024..47e07f9 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -1848,7 +1848,7 @@ DoSetPointerMapping(ClientPtr client, DeviceIntPtr device, BYTE *map, int n)
         if ((dev->coreEvents || dev == inputInfo.pointer) && dev->button) {
             for (i = 0; i < n; i++) {
                 if ((device->button->map[i + 1] != map[i]) &&
-                        device->button->down[i + 1]) {
+                        BitIsOn(device->button->down, i + 1)) {
                     return MappingBusy;
                 }
             }
diff --git a/include/inputstr.h b/include/inputstr.h
index 9591d2f..4719d37 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -57,9 +57,6 @@ SOFTWARE.
 #include "privates.h"
 
 #define BitIsOn(ptr, bit) (((BYTE *) (ptr))[(bit)>>3] & (1 << ((bit) & 7)))
-/* If byte[i] in src is non-zero, set bit i in dst, otherwise set bit to 0 */
-#define SetBitIf(dst, src, i) \
-    (src[i]) ? (dst[i/8] |= (1 << (i % 8))) : (dst[i/8] &= ~(1 << (i % 8)));
 
 #define SameClient(obj,client) \
 	(CLIENT_BITS((obj)->resource) == (client)->clientAsMask)
diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
index 94420cf..64e17e9 100644
--- a/xkb/xkbActions.c
+++ b/xkb/xkbActions.c
@@ -1043,7 +1043,7 @@ int		button;
 	switch (pAction->type) {
 	    case XkbSA_LockDeviceBtn:
 		if ((pAction->devbtn.flags&XkbSA_LockNoLock)||
-		    (dev->button->down[button]))
+		    BitIsOn(dev->button->down, button))
 		    return 0;
 		XkbDDXFakeDeviceButton(dev,True,button);
 		filter->upAction.type= XkbSA_NoAction;
@@ -1075,7 +1075,7 @@ int		button;
 	switch (filter->upAction.type) {
 	    case XkbSA_LockDeviceBtn:
 		if ((filter->upAction.devbtn.flags&XkbSA_LockNoUnlock)||
-		    ((dev->button->down[button])==0))
+		    BitIsOn(dev->button->down, button))
 		    return 0;
 		XkbDDXFakeDeviceButton(dev,False,button);
 		break;
commit 50d80c25525a691472e3fc5859fb303a3ffe1ef2
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>
    (cherry picked from commit d36adf52a2b2711d22b11105f7bd907d4493fb9b)

diff --git a/dix/events.c b/dix/events.c
index 498616f..768a33e 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -3073,8 +3073,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);
@@ -3087,6 +3087,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);
@@ -3153,13 +3159,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 16e23dc..279f49e 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -973,8 +973,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 cf7f824..2ab815b 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 9b2a1b2..8c8af6e 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 b19f12712a0762f20065282fd055fe9bc3ca975f
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.
    (cherry picked from commit 488d45295105daf10ccd17ca93ae6a6f4d0104f1)

diff --git a/dix/events.c b/dix/events.c
index 122ce6a..498616f 100644
--- a/dix/events.c
+++ b/dix/events.c
@@ -1160,14 +1160,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) {
@@ -1181,7 +1181,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))
 	{
@@ -1248,7 +1248,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