[xorg-x11-server/f13/master] Add two more patches to xserver-1.8.2-XTEST-PointerKeys-fixes.patch.

Peter Hutterer whot at fedoraproject.org
Tue Aug 3 05:04:52 UTC 2010


commit 8be23b2851b956ab372187944726a182c58da1c6
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Tue Aug 3 13:26:50 2010 +1000

    Add two more patches to xserver-1.8.2-XTEST-PointerKeys-fixes.patch.
    
    fixes "Too many valuators" error message.

 xorg-x11-server.spec                        |    8 +-
 xserver-1.8.2-XTEST-PointerKeys-fixes.patch |  187 +++++++++++++++++++++++++++
 2 files changed, 193 insertions(+), 2 deletions(-)
---
diff --git a/xorg-x11-server.spec b/xorg-x11-server.spec
index 63e3a33..5ab516b 100644
--- a/xorg-x11-server.spec
+++ b/xorg-x11-server.spec
@@ -19,7 +19,7 @@
 Summary:   X.Org X11 X server
 Name:      xorg-x11-server
 Version:   1.8.2
-Release:   2%{?gitdate:.%{gitdate}}%{dist}
+Release:   3%{?gitdate:.%{gitdate}}%{dist}
 URL:       http://www.x.org
 License:   MIT
 Group:     User Interface/X
@@ -89,7 +89,7 @@ Patch6053: xserver-1.8-disable-vboxvideo.patch
 Patch6061: xserver-1.8-no-connected-outputs.patch
 Patch6062: xserver-1.8-randr-initial.patch
 
-# 5 patches, backports of the issues between XTEST devices and PointerKeys
+# 7 patches, backports of the issues between XTEST devices and PointerKeys
 # button events.
 Patch6063: xserver-1.8.2-XTEST-PointerKeys-fixes.patch
 
@@ -533,6 +533,10 @@ rm -rf $RPM_BUILD_ROOT
 %{xserver_source_dir}
 
 %changelog
+* Tue Aug 03 2010 Peter Hutterer <peter.hutterer at redhat.com> 1.8.2-3
+- Add two more patches to xserver-1.8.2-XTEST-PointerKeys-fixes.patch.
+  fixes "Too many valuators" error message.
+
 * Tue Jul 20 2010 Peter Hutterer <peter.hutterer at redhat.com> 1.8.2-2
 - xserver-1.8.2-XTEST-PointerKeys-fixes.patch: backport fixes for XTEST and
   PointerKeys issues. (#603953)
diff --git a/xserver-1.8.2-XTEST-PointerKeys-fixes.patch b/xserver-1.8.2-XTEST-PointerKeys-fixes.patch
index 8f5ad3e..ece8a6c 100644
--- a/xserver-1.8.2-XTEST-PointerKeys-fixes.patch
+++ b/xserver-1.8.2-XTEST-PointerKeys-fixes.patch
@@ -720,3 +720,190 @@ index 391c375..5d40199 100644
 -- 
 1.7.1
 
+From 7273832bcdc6f43e9a5a8fdbb56844466efb710a Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer at who-t.net>
+Date: Fri, 23 Jul 2010 11:46:30 +1000
+Subject: [PATCH 1/3] xkb: post-fix PointerKeys button events with a DeviceChangedEvent.
+
+commit 14327858391ebe929b806efb53ad79e789361883
+    xkb: release XTEST pointer buttons on physical releases. (#28808)
+revealed a bug with the XTEST/PointerKeys interaction.
+
+Events resulting from PointerKeys are injected into the event processing
+stream, not appended to the event queue. The events generated for the fake
+button press include a DeviceChangedEvent (DCE), a raw button event and the
+button event itself. The DCE causes the master to switch classes to the
+attached XTEST pointer device.
+
+Once the fake button is processed, normal event processing continues with
+events in the EQ. The master still contains the XTEST classes, causing some
+events to be dropped if e.g. the number of valuators of the event in the
+queue exceeds the XTEST device's number of valuators.
+
+Example: the EQ contains the following events, processed one-by-one, left to
+right.
+
+[DCE (dev)][Btn down][Btn up][Motion][Motion][...]
+                  ^ XkbFakeDeviceButton injects [DCE (XTEST)][Btn up]
+
+Thus the event sequence processed looks like this:
+
+[DCE (dev)][Btn down][Btn up][DCE (XTEST)][Btn up][Motion][Motion][...]
+
+The first DCE causes the master to switch to the device. The button up event
+injects a DCE to the XTEST device, causing the following Motion events to be
+processed with the master still being on XTEST classes.
+
+This patch post-fixes the injected event sequence with a DCE to restore the
+classes of the original slave device, resulting in an event sequence like
+this:
+[DCE (dev)][Btn down][Btn up][DCE (XTEST)][Btn up][DCE (dev)][Motion][Motion]
+
+Note that this is a simplified description. The event sequence injected by
+the PointerKeys code is injected for the master device only and the matching
+slave device that caused the injection has already finished processing on
+the slave. Furthermore, the injection happens as part of the the XKB layer,
+before the unwrapping of the processInputProc takes us into the DIX where
+the DCE is actually handled.
+
+Bug reproducible with a device that reports more than 2 valuators. Simply
+cause button releases on the device and wait for a "too many valuators"
+warning message.
+
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+---
+ xkb/xkbActions.c |   26 +++++++++++++++++++-------
+ 1 files changed, 19 insertions(+), 7 deletions(-)
+
+diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c
+index 5d40199..2afd46d 100644
+--- a/xkb/xkbActions.c
++++ b/xkb/xkbActions.c
+@@ -1365,34 +1365,46 @@ XkbFakeDeviceButton(DeviceIntPtr dev,Bool press,int button)
+ {
+     EventListPtr        events;
+     int                 nevents, i;
+-    DeviceIntPtr        ptr;
++    DeviceIntPtr        ptr, mpointer, lastSlave;
+ 
+     /* If dev is a slave device, and the SD is attached, do nothing. If we'd
+      * post through the attached master pointer we'd get duplicate events.
+      *
+      * if dev is a master keyboard, post through the XTEST device
+-     *
+      * if dev is a floating slave, post through the device itself.
++     *
++     * The event is injected into the event processing, not the EQ. Thus,
++     * ensure that we restore the master after the event sequence to the
++     * original set of classes. Otherwise, the master remains on the XTEST
++     * classes and drops events that don't fit into the XTEST layout (e.g.
++     * events with more than 2 valuators).
++     * To do so, we remember the lastSlave that posted through the master
++     * and add a DeviceChangedEvent to the end of the list.
+      */
+ 
+-    if (IsMaster(dev))
+-        ptr = GetXTestDevice(GetMaster(dev, MASTER_POINTER));
+-    else if (!dev->u.master)
++    if (IsMaster(dev)) {
++        mpointer = GetMaster(dev, MASTER_POINTER);
++        lastSlave = mpointer->u.lastSlave;
++        ptr = GetXTestDevice(mpointer);
++    } else if (!dev->u.master)
+         ptr = dev;
+     else
+         return;
+ 
+-    events = InitEventList(GetMaximumEventsNum());
++    events = InitEventList(GetMaximumEventsNum() + 1);
+     OsBlockSignals();
+     nevents = GetPointerEvents(events, ptr,
+                                press ? ButtonPress : ButtonRelease, button,
+                                0 /* flags */, 0 /* first */,
+                                0 /* num_val */, NULL);
++    if (IsMaster(dev) && (lastSlave && lastSlave != ptr))
++        CreateClassesChangedEvent(&events[nevents++], mpointer,
++                                  lastSlave, DEVCHANGE_POINTER_EVENT);
+     OsReleaseSignals();
+ 
+ 
+     for (i = 0; i < nevents; i++)
+         mieqProcessDeviceEvent(ptr, (InternalEvent*)events[i].event, NULL);
+ 
+-    FreeEventList(events, GetMaximumEventsNum());
++    FreeEventList(events, GetMaximumEventsNum() + 1);
+ }
+-- 
+1.7.2
+
+From 817e031a996a5f5aa16fc789d7e570cc589d96cb Mon Sep 17 00:00:00 2001
+From: Peter Hutterer <peter.hutterer at who-t.net>
+Date: Wed, 28 Jul 2010 14:24:59 +1000
+Subject: [PATCH 3/3] Xi: reset the unused classes pointer after copying
+
+After copying the unused_classes into the device, reset the original
+pointer. Otherwise we have two pointers pointing to the same field and both
+get freed on device removal.
+
+Some classes already have this behaviour since 51c8fd69.
+
+Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
+---
+ Xi/exevents.c |    6 ++++++
+ 1 files changed, 6 insertions(+), 0 deletions(-)
+
+diff --git a/Xi/exevents.c b/Xi/exevents.c
+index 566b0ef..a6160dd 100644
+--- a/Xi/exevents.c
++++ b/Xi/exevents.c
+@@ -227,6 +227,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
+             classes = dixLookupPrivate(&to->devPrivates,
+                                        UnusedClassesPrivateKey);
+             to->intfeed = classes->intfeed;
++            classes->intfeed = NULL;
+         }
+ 
+         i = &to->intfeed;
+@@ -263,6 +264,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
+             classes = dixLookupPrivate(&to->devPrivates,
+                                        UnusedClassesPrivateKey);
+             to->stringfeed = classes->stringfeed;
++            classes->stringfeed = NULL;
+         }
+ 
+         s = &to->stringfeed;
+@@ -299,6 +301,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
+             classes = dixLookupPrivate(&to->devPrivates,
+                                        UnusedClassesPrivateKey);
+             to->bell = classes->bell;
++            classes->bell = NULL;
+         }
+ 
+         b = &to->bell;
+@@ -336,6 +339,7 @@ DeepCopyFeedbackClasses(DeviceIntPtr from, DeviceIntPtr to)
+             classes = dixLookupPrivate(&to->devPrivates,
+                                        UnusedClassesPrivateKey);
+             to->leds = classes->leds;
++            classes->leds = NULL;
+         }
+ 
+         l = &to->leds;
+@@ -387,6 +391,7 @@ DeepCopyKeyboardClasses(DeviceIntPtr from, DeviceIntPtr to)
+             to->kbdfeed = classes->kbdfeed;
+             if (!to->kbdfeed)
+                 InitKeyboardDeviceStruct(to, NULL, NULL, NULL);
++            classes->kbdfeed = NULL;
+         }
+ 
+         k = &to->kbdfeed;
+@@ -517,6 +522,7 @@ DeepCopyPointerClasses(DeviceIntPtr from, DeviceIntPtr to)
+             classes = dixLookupPrivate(&to->devPrivates,
+                                        UnusedClassesPrivateKey);
+             to->ptrfeed = classes->ptrfeed;
++            classes->ptrfeed = NULL;
+         }
+ 
+         p = &to->ptrfeed;
+-- 
+1.7.2
+


More information about the scm-commits mailing list