[PATCH 6/6] Xi: send DeviceChangedEvents when the scroll valuators change value

Peter Hutterer peter.hutterer at who-t.net
Wed Oct 19 23:25:46 PDT 2011


Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 Xi/exevents.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 7afb69e..053c76f 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -1103,6 +1103,8 @@ SetScrollValuator(DeviceIntPtr dev, int axnum, enum ScrollType type, double incr
 {
     AxisInfoPtr ax;
     int *current_ax;
+    InternalEvent dce;
+    DeviceIntPtr master;
 
     if (!dev || !dev->valuator || axnum >= dev->valuator->numAxes)
         return FALSE;
@@ -1139,7 +1141,16 @@ SetScrollValuator(DeviceIntPtr dev, int axnum, enum ScrollType type, double incr
     ax->scroll.type = type;
     ax->scroll.increment = increment;
     ax->scroll.flags = flags;
-    /* FIXME: generate DeviceChanged Events */
+
+    master = GetMaster(dev, MASTER_ATTACHED);
+    CreateClassesChangedEvent(&dce, master, dev, DEVCHANGE_POINTER_EVENT | DEVCHANGE_DEVICE_CHANGE);
+    XISendDeviceChangedEvent(dev, &dce.changed_event);
+
+    /* if the current slave is us, update the master. If not, we'll update
+     * whenever the next slave switch happens anyway. CMDC sends the event
+     * for us */
+    if (master && master->lastSlave == dev)
+        ChangeMasterDeviceClasses(master, &dce.changed_event);
 
     return TRUE;
 }
-- 
1.7.6.4



More information about the xorg-devel mailing list