Sorry, forgot the attachment again...

> Thanks, that makes sense.  I'm attaching an updated patch that should
> cleanly apply after cherry-picking commit
> a85f0d6b98237d8a196de624207acf1983a1859a.

>From 6b57285d2f0274c6ef634a074b3881773c3bcf88 Mon Sep 17 00:00:00 2001
From: Thomas Jaeger <[email protected]>
Date: Sun, 4 Jan 2009 11:22:40 -0500
Subject: [PATCH] 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.
---
 dix/devices.c |   32 +++++++++-----------------------
 1 files changed, 9 insertions(+), 23 deletions(-)

diff --git a/dix/devices.c b/dix/devices.c
index d84b57f..4b5ea94 100644
--- a/dix/devices.c
+++ b/dix/devices.c
@@ -1829,36 +1829,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;
 }
@@ -1915,7 +1902,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;
-- 
1.6.0.4

_______________________________________________
xorg mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/xorg

Reply via email to