[PATCH 3/3] dix: Raise DCE on same slave if type changes

Daniel Martin consume.noise at gmail.com
Sun Mar 23 07:31:57 PDT 2014


When having a slave pointer with a XIKeyPress class and we touch the
pointer part before the keyboard part, we never get a DeviceChangedEvent
and therefore never trigger DeepCopyDeviceClasses() - never get a
pending keyboard layout change applied.

Track the last used type of the slave device and raise a
DeviceChangedEvent even if the slave didn't, but the type
(i.e. DEVCHANGE_KEYBOARD_EVENT or DEVCHANGE_POINTER_EVENT) changed.

Signed-off-by: Daniel Martin <consume.noise at gmail.com>
---
 dix/getevents.c    | 5 ++++-
 include/inputstr.h | 1 +
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/dix/getevents.c b/dix/getevents.c
index bab5ac3..131b15f 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -708,7 +708,9 @@ UpdateFromMaster(InternalEvent *events, DeviceIntPtr dev, int type,
 
     master = GetMaster(dev, MASTER_ATTACHED);
 
-    if (master && master->last.slave != dev) {
+    if (master &&
+        ((master->last.slave != dev) ||
+         (master->last.slave == dev && master->last.slave_type != type))) {
         CreateClassesChangedEvent(events, master, dev,
                                   type | DEVCHANGE_SLAVE_SWITCH);
         if (IsPointerDevice(master)) {
@@ -716,6 +718,7 @@ UpdateFromMaster(InternalEvent *events, DeviceIntPtr dev, int type,
             master->last.numValuators = dev->last.numValuators;
         }
         master->last.slave = dev;
+        master->last.slave_type = type;
         (*num_events)++;
         events++;
     }
diff --git a/include/inputstr.h b/include/inputstr.h
index f6cfb04..214e33c 100644
--- a/include/inputstr.h
+++ b/include/inputstr.h
@@ -577,6 +577,7 @@ typedef struct _DeviceIntRec {
         double valuators[MAX_VALUATORS];
         int numValuators;
         DeviceIntPtr slave;
+        int slave_type;
         ValuatorMask *scroll;
         int num_touches;        /* size of the touches array */
         DDXTouchPointInfoPtr touches;
-- 
1.9.1



More information about the xorg-devel mailing list