xserver: Branch 'master' - 13 commits

Peter Hutterer whot at kemper.freedesktop.org
Wed Aug 12 18:28:33 PDT 2009


 Xext/sync.c                      |    1 
 Xext/xtest.c                     |   17 -
 Xi/exevents.c                    |   69 ++++
 Xi/extinit.c                     |  102 +++++-
 dix/eventconvert.c               |    8 
 include/eventstr.h               |    2 
 include/exevents.h               |    4 
 test/xi2/Makefile.am             |    4 
 test/xi2/protocol-common.c       |    8 
 test/xi2/protocol-eventconvert.c |  640 +++++++++++++++++++++++++++++++++++++++
 10 files changed, 819 insertions(+), 36 deletions(-)

New commits:
commit 36e24a6d93bd5aced4e566b80bf2d03555fab9ca
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Thu Aug 13 10:50:26 2009 +1000

    Xext: add missing return code check to ProcSyncDestroyAlarm
    
    Introduced with 57aff88c7d0761e590806d07bee1c9410680c89f.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xext/sync.c b/Xext/sync.c
index 0bcf805..5f4ce56 100644
--- a/Xext/sync.c
+++ b/Xext/sync.c
@@ -1770,6 +1770,7 @@ ProcSyncDestroyAlarm(ClientPtr client)
 
     rc = dixLookupResourceByType((pointer *)&pAlarm, stuff->alarm, RTAlarm,
 				 client, DixDestroyAccess);
+    if (rc != Success)
 	return (rc == BadValue) ? SyncErrorBase + XSyncBadAlarm : rc;
 
     FreeResource(stuff->alarm, RT_NONE);
commit ce69a06aff934b2dcded8606cab079ac6465007c
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Tue Aug 11 16:16:54 2009 +1000

    Xi: fix up broken DeviceChangedEvent swapping code

diff --git a/Xi/extinit.c b/Xi/extinit.c
index 2b75b3d..e359083 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -676,20 +676,11 @@ SDeviceChangedEvent(xXIDeviceChangedEvent* from, xXIDeviceChangedEvent* to)
     *to = *from;
     memcpy(&to[1], &from[1], from->length * 4);
 
-    swaps(&to->sequenceNumber, n);
-    swapl(&to->length, n);
-    swaps(&to->evtype, n);
-    swaps(&to->deviceid, n);
-    swapl(&to->time, n);
-    swaps(&to->num_classes, n);
-    swaps(&to->sourceid, n);
-
-    /* now swap the actual classes */
     any = (xXIAnyInfo*)&to[1];
     for (i = 0; i < to->num_classes; i++)
     {
-        swaps(&any->type, n);
-        swaps(&any->length, n);
+        int length = any->length;
+
         switch(any->type)
         {
             case KeyClass:
@@ -704,8 +695,10 @@ SDeviceChangedEvent(xXIDeviceChangedEvent* from, xXIDeviceChangedEvent* to)
             case ButtonClass:
                 {
                     xXIButtonInfo *bi = (xXIButtonInfo*)any;
+                    Atom *labels = (Atom*)((char*)bi + sizeof(xXIButtonInfo) +
+                                           pad_to_int32(bits_to_bytes(bi->num_buttons)));
                     for (j = 0; j < bi->num_buttons; j++)
-                        swapl(&bi[1 + j], n);
+                        swapl(&labels[j], n);
                     swaps(&bi->num_buttons, n);
                 }
                 break;
@@ -722,8 +715,22 @@ SDeviceChangedEvent(xXIDeviceChangedEvent* from, xXIDeviceChangedEvent* to)
                 }
                 break;
         }
-        any = (xXIAnyInfo*)((char*)any + any->length * 4);
+
+        swaps(&any->type, n);
+        swaps(&any->length, n);
+        swaps(&any->sourceid, n);
+
+        any = (xXIAnyInfo*)((char*)any + length * 4);
     }
+
+    swaps(&to->sequenceNumber, n);
+    swapl(&to->length, n);
+    swaps(&to->evtype, n);
+    swaps(&to->deviceid, n);
+    swapl(&to->time, n);
+    swaps(&to->num_classes, n);
+    swaps(&to->sourceid, n);
+
 }
 
 static void SDeviceEvent(xXIDeviceEvent *from, xXIDeviceEvent *to)
commit b44d34d5fd0d8aaacb89121e8b4afba04f1dcc80
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Aug 10 15:32:59 2009 +1000

    include: correct a copy/paste error in a comment.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/include/eventstr.h b/include/eventstr.h
index 06a57e3..b7611a5 100644
--- a/include/eventstr.h
+++ b/include/eventstr.h
@@ -145,7 +145,7 @@ struct _DeviceChangedEvent
     /** If flags & HAS_OLD_SLAVE is set, old_slaveid specifies SD previously
      * attached to this device. */
     int old_slaveid;
-    /** If flags & HAS_OLD_SLAVE is set, old_slaveid specifies device now
+    /** If flags & HAS_NEW_SLAVE is set, new_slaveid specifies device now
      * attached to this device. */
     int new_slaveid;
 
commit c477ac8a151a28ba23f5c87e8f7affd6e82cfaa9
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Aug 10 15:15:02 2009 +1000

    dix: re-name internal eventToClassesChanged to eventToDeviceChanged
    
    DeviceClassesChangedEvents (where this name comes from) have been replaced
    with DeviceChangedEvents.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index 98ae1a2..cd292a9 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -52,7 +52,7 @@
 static int countValuators(DeviceEvent *ev, int *first);
 static int getValuatorEvents(DeviceEvent *ev, deviceValuator *xv);
 static int eventToKeyButtonPointer(DeviceEvent *ev, xEvent **xi, int *count);
-static int eventToClassesChanged(DeviceChangedEvent *ev, xEvent **dcce);
+static int eventToDeviceChanged(DeviceChangedEvent *ev, xEvent **dcce);
 static int eventToDeviceEvent(DeviceEvent *ev, xEvent **xi);
 static int eventToRawEvent(RawDeviceEvent *ev, xEvent **xi);
 /**
@@ -191,7 +191,7 @@ EventToXI2(InternalEvent *ev, xEvent **xi)
             *xi = NULL;
             return BadMatch;
         case ET_DeviceChanged:
-            return eventToClassesChanged((DeviceChangedEvent*)ev, xi);
+            return eventToDeviceChanged((DeviceChangedEvent*)ev, xi);
         case ET_RawKeyPress:
         case ET_RawKeyRelease:
         case ET_RawButtonPress:
@@ -341,7 +341,7 @@ getValuatorEvents(DeviceEvent *ev, deviceValuator *xv)
 }
 
 static int
-eventToClassesChanged(DeviceChangedEvent *ev, xEvent **xi)
+eventToDeviceChanged(DeviceChangedEvent *ev, xEvent **xi)
 {
     int len = sizeof(xEvent);
     DeviceIntPtr slave;
commit af38f6790c4c8ba1e70f5c5ba3530ded85d6e372
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Aug 10 14:08:59 2009 +1000

    test: add event conversion tests for XIDeviceEvents

diff --git a/test/xi2/protocol-eventconvert.c b/test/xi2/protocol-eventconvert.c
index e9ca68b..d7fe22e 100644
--- a/test/xi2/protocol-eventconvert.c
+++ b/test/xi2/protocol-eventconvert.c
@@ -267,6 +267,366 @@ static void test_convert_XIRawEvent(void)
     }
 }
 
+static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out,
+                                      BOOL swap)
+{
+    int buttons, valuators;
+    int i;
+    unsigned char *ptr;
+    FP3232 *values;
+
+    if (swap) {
+        char n;
+
+        swaps(&out->sequenceNumber, n);
+        swapl(&out->length, n);
+        swaps(&out->evtype, n);
+        swaps(&out->deviceid, n);
+        swaps(&out->sourceid, n);
+        swapl(&out->time, n);
+        swapl(&out->detail, n);
+        swapl(&out->root, n);
+        swapl(&out->event, n);
+        swapl(&out->child, n);
+        swapl(&out->root_x, n);
+        swapl(&out->root_y, n);
+        swapl(&out->event_x, n);
+        swapl(&out->event_y, n);
+        swaps(&out->buttons_len, n);
+        swaps(&out->valuators_len, n);
+        swapl(&out->mods.base_mods, n);
+        swapl(&out->mods.latched_mods, n);
+        swapl(&out->mods.locked_mods, n);
+        swapl(&out->mods.effective_mods, n);
+    }
+
+    g_assert(out->extension == 0); /* IReqCode defaults to 0 */
+    g_assert(out->evtype == GetXI2Type((InternalEvent*)in));
+    g_assert(out->time == in->time);
+    g_assert(out->detail == in->detail.button);
+    g_assert(out->length >= 12);
+
+    g_assert(out->deviceid == in->deviceid);
+    g_assert(out->sourceid == in->sourceid);
+
+    g_assert(out->flags == 0); /* FIXME: we don't set the flags yet */
+
+    g_assert(out->root == in->root);
+    g_assert(out->event == None); /* set in FixUpEventFromWindow */
+    g_assert(out->child == None); /* set in FixUpEventFromWindow */
+
+    g_assert(out->mods.base_mods == in->mods.base);
+    g_assert(out->mods.latched_mods == in->mods.latched);
+    g_assert(out->mods.locked_mods == in->mods.locked);
+    g_assert(out->mods.effective_mods == in->mods.effective);
+
+    g_assert(out->group.base_group == in->group.base);
+    g_assert(out->group.latched_group == in->group.latched);
+    g_assert(out->group.locked_group == in->group.locked);
+    g_assert(out->group.effective_group == in->group.effective);
+
+    g_assert(out->event_x == 0); /* set in FixUpEventFromWindow */
+    g_assert(out->event_y == 0); /* set in FixUpEventFromWindow */
+
+    g_assert(out->root_x == FP1616(in->root_x, in->root_x_frac));
+    g_assert(out->root_y == FP1616(in->root_y, in->root_y_frac));
+
+    buttons = 0;
+    for (i = 0; i < bits_to_bytes(sizeof(in->buttons)); i++)
+    {
+        if (XIMaskIsSet(in->buttons, i))
+        {
+            g_assert(out->buttons_len >= bytes_to_int32(bits_to_bytes(i)));
+            buttons++;
+        }
+    }
+
+    ptr = (unsigned char*)&out[1];
+    for (i = 0; i < sizeof(in->buttons) * 8; i++)
+        g_assert(XIMaskIsSet(in->buttons, i) == XIMaskIsSet(ptr, i));
+
+
+    valuators = 0;
+    for (i = 0; i < sizeof(in->valuators.mask) * 8; i++)
+        if (XIMaskIsSet(in->valuators.mask, i))
+            valuators++;
+
+    g_assert(out->valuators_len >= bytes_to_int32(bits_to_bytes(valuators)));
+
+    ptr += out->buttons_len * 4;
+    values = (FP3232*)(ptr + out->valuators_len * 4);
+    for (i = 0; i < sizeof(in->valuators.mask) * 8 ||
+                i < (out->valuators_len * 4) * 8; i++)
+    {
+        if (i > sizeof(in->valuators.mask) * 8)
+            g_assert(!XIMaskIsSet(ptr, i));
+        else if (i > out->valuators_len * 4 * 8)
+            g_assert(!XIMaskIsSet(in->valuators.mask, i));
+        else {
+            g_assert(XIMaskIsSet(in->valuators.mask, i) ==
+                     XIMaskIsSet(ptr, i));
+
+            if (XIMaskIsSet(ptr, i))
+            {
+                FP3232 vi, vo;
+
+                vi.integral = in->valuators.data[i];
+                vi.frac = in->valuators.data_frac[i];
+
+                vo = *values;
+
+                if (swap)
+                {
+                    char n;
+                    swapl(&vo.integral, n);
+                    swapl(&vo.frac, n);
+                }
+
+
+                g_assert(vi.integral == vo.integral);
+                g_assert(vi.frac == vo.frac);
+                values++;
+            }
+        }
+    }
+}
+
+static void test_XIDeviceEvent(DeviceEvent *in)
+{
+    xXIDeviceEvent *out, *swapped;
+    int rc;
+
+    rc = EventToXI2((InternalEvent*)in, (xEvent**)&out);
+    g_assert(rc == Success);
+
+    test_values_XIDeviceEvent(in, out, FALSE);
+
+    swapped = xcalloc(1, sizeof(xEvent) + out->length * 4);
+    XI2EventSwap(out, swapped);
+    test_values_XIDeviceEvent(in, swapped, TRUE);
+
+    xfree(out);
+    xfree(swapped);
+}
+
+static void test_convert_XIDeviceEvent(void)
+{
+    DeviceEvent in;
+    int i;
+
+    memset(&in, 0, sizeof(in));
+
+    g_test_message("Testing simple field values");
+    in.header = ET_Internal;
+    in.type = ET_Motion;
+    in.length = sizeof(DeviceEvent);
+    in.time             = 0;
+    in.deviceid         = 1;
+    in.sourceid         = 2;
+    in.root             = 3;
+    in.root_x           = 4;
+    in.root_x_frac      = 5;
+    in.root_y           = 6;
+    in.root_y_frac      = 7;
+    in.detail.button    = 8;
+    in.mods.base        = 9;
+    in.mods.latched     = 10;
+    in.mods.locked      = 11;
+    in.mods.effective   = 11;
+    in.group.base       = 12;
+    in.group.latched    = 13;
+    in.group.locked     = 14;
+    in.group.effective  = 15;
+
+    test_XIDeviceEvent(&in);
+
+    g_test_message("Testing field ranges");
+    /* 32 bit */
+    in.detail.button = 1L;
+    test_XIDeviceEvent(&in);
+    in.detail.button = 1L << 8;
+    test_XIDeviceEvent(&in);
+    in.detail.button = 1L << 16;
+    test_XIDeviceEvent(&in);
+    in.detail.button = 1L << 24;
+    test_XIDeviceEvent(&in);
+    in.detail.button = ~0L;
+    test_XIDeviceEvent(&in);
+
+    /* 32 bit */
+    in.time = 1L;
+    test_XIDeviceEvent(&in);
+    in.time = 1L << 8;
+    test_XIDeviceEvent(&in);
+    in.time = 1L << 16;
+    test_XIDeviceEvent(&in);
+    in.time = 1L << 24;
+    test_XIDeviceEvent(&in);
+    in.time = ~0L;
+    test_XIDeviceEvent(&in);
+
+    /* 16 bit */
+    in.deviceid = 1;
+    test_XIDeviceEvent(&in);
+    in.deviceid = 1 << 8;
+    test_XIDeviceEvent(&in);
+    in.deviceid = ~0 & 0xFF;
+    test_XIDeviceEvent(&in);
+
+    /* 16 bit */
+    in.sourceid = 1;
+    test_XIDeviceEvent(&in);
+    in.deviceid = 1 << 8;
+    test_XIDeviceEvent(&in);
+    in.deviceid = ~0 & 0xFF;
+    test_XIDeviceEvent(&in);
+
+    /* 32 bit */
+    in.root = 1L;
+    test_XIDeviceEvent(&in);
+    in.root = 1L << 8;
+    test_XIDeviceEvent(&in);
+    in.root = 1L << 16;
+    test_XIDeviceEvent(&in);
+    in.root = 1L << 24;
+    test_XIDeviceEvent(&in);
+    in.root = ~0L;
+    test_XIDeviceEvent(&in);
+
+    /* 16 bit */
+    in.root_x = 1;
+    test_XIDeviceEvent(&in);
+    in.root_x = 1 << 8;
+    test_XIDeviceEvent(&in);
+    in.root_x = ~0 & 0xFF;
+    test_XIDeviceEvent(&in);
+
+    in.root_x_frac = 1;
+    test_XIDeviceEvent(&in);
+    in.root_x_frac = 1 << 8;
+    test_XIDeviceEvent(&in);
+    in.root_x_frac = ~0 & 0xFF;
+    test_XIDeviceEvent(&in);
+
+    in.root_y = 1;
+    test_XIDeviceEvent(&in);
+    in.root_y = 1 << 8;
+    test_XIDeviceEvent(&in);
+    in.root_y = ~0 & 0xFF;
+    test_XIDeviceEvent(&in);
+
+    in.root_y_frac = 1;
+    test_XIDeviceEvent(&in);
+    in.root_y_frac = 1 << 8;
+    test_XIDeviceEvent(&in);
+    in.root_y_frac = ~0 & 0xFF;
+    test_XIDeviceEvent(&in);
+
+    /* 32 bit */
+    in.mods.base = 1L;
+    test_XIDeviceEvent(&in);
+    in.mods.base = 1L << 8;
+    test_XIDeviceEvent(&in);
+    in.mods.base = 1L << 16;
+    test_XIDeviceEvent(&in);
+    in.mods.base = 1L << 24;
+    test_XIDeviceEvent(&in);
+    in.mods.base = ~0L;
+    test_XIDeviceEvent(&in);
+
+    in.mods.latched = 1L;
+    test_XIDeviceEvent(&in);
+    in.mods.latched = 1L << 8;
+    test_XIDeviceEvent(&in);
+    in.mods.latched = 1L << 16;
+    test_XIDeviceEvent(&in);
+    in.mods.latched = 1L << 24;
+    test_XIDeviceEvent(&in);
+    in.mods.latched = ~0L;
+    test_XIDeviceEvent(&in);
+
+    in.mods.locked = 1L;
+    test_XIDeviceEvent(&in);
+    in.mods.locked = 1L << 8;
+    test_XIDeviceEvent(&in);
+    in.mods.locked = 1L << 16;
+    test_XIDeviceEvent(&in);
+    in.mods.locked = 1L << 24;
+    test_XIDeviceEvent(&in);
+    in.mods.locked = ~0L;
+    test_XIDeviceEvent(&in);
+
+    in.mods.effective = 1L;
+    test_XIDeviceEvent(&in);
+    in.mods.effective = 1L << 8;
+    test_XIDeviceEvent(&in);
+    in.mods.effective = 1L << 16;
+    test_XIDeviceEvent(&in);
+    in.mods.effective = 1L << 24;
+    test_XIDeviceEvent(&in);
+    in.mods.effective = ~0L;
+    test_XIDeviceEvent(&in);
+
+    /* 8 bit */
+    in.group.base = 1;
+    test_XIDeviceEvent(&in);
+    in.group.base = ~0 & 0xFF;
+    test_XIDeviceEvent(&in);
+
+    in.group.latched = 1;
+    test_XIDeviceEvent(&in);
+    in.group.latched = ~0 & 0xFF;
+    test_XIDeviceEvent(&in);
+
+    in.group.locked = 1;
+    test_XIDeviceEvent(&in);
+    in.group.locked = ~0 & 0xFF;
+    test_XIDeviceEvent(&in);
+
+    in.mods.effective = 1;
+    test_XIDeviceEvent(&in);
+    in.mods.effective = ~0 & 0xFF;
+    test_XIDeviceEvent(&in);
+
+    g_test_message("Testing button masks");
+    for (i = 0; i < sizeof(in.buttons) * 8; i++)
+    {
+        XISetMask(in.buttons, i);
+        test_XIDeviceEvent(&in);
+        XIClearMask(in.buttons, i);
+    }
+
+    for (i = 0; i < sizeof(in.buttons) * 8; i++)
+    {
+        XISetMask(in.buttons, i);
+        test_XIDeviceEvent(&in);
+    }
+
+    g_test_message("Testing valuator masks");
+    for (i = 0; i < sizeof(in.valuators.mask) * 8; i++)
+    {
+        XISetMask(in.valuators.mask, i);
+        test_XIDeviceEvent(&in);
+        XIClearMask(in.valuators.mask, i);
+    }
+
+    for (i = 0; i < sizeof(in.valuators.mask) * 8; i++)
+    {
+        XISetMask(in.valuators.mask, i);
+
+        in.valuators.data[i] = i;
+        in.valuators.data_frac[i] = i + 20;
+        test_XIDeviceEvent(&in);
+        XIClearMask(in.valuators.mask, i);
+    }
+
+    for (i = 0; i < sizeof(in.valuators.mask) * 8; i++)
+    {
+        XISetMask(in.valuators.mask, i);
+        test_XIDeviceEvent(&in);
+    }
+}
+
 int main(int argc, char** argv)
 {
     g_test_init(&argc, &argv,NULL);
@@ -274,6 +634,7 @@ int main(int argc, char** argv)
 
     g_test_add_func("/xi2/eventconvert/XIRawEvent", test_convert_XIRawEvent);
     g_test_add_func("/xi2/eventconvert/XIFocusEvent", test_convert_XIFocusEvent);
+    g_test_add_func("/xi2/eventconvert/XIDeviceEvent", test_convert_XIDeviceEvent);
 
     return g_test_run();
 }
commit 3f2e4b9867b6877ee7be32b151fcaf221ef0812f
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Aug 10 14:07:54 2009 +1000

    Xi: add event swapping for XIRawEvents.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/extinit.c b/Xi/extinit.c
index 4c8857d..2b75b3d 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -810,6 +810,48 @@ static void SXIPropertyEvent(xXIPropertyEvent *from, xXIPropertyEvent *to)
     swapl(&to->property, n);
 }
 
+static void SRawEvent(xXIRawEvent *from, xXIRawEvent *to)
+{
+    char n;
+    int i;
+    FP3232 *values;
+    unsigned char *mask;
+
+    memcpy(to, from, sizeof(xEvent) + from->length * 4);
+
+    swaps(&to->sequenceNumber, n);
+    swapl(&to->length, n);
+    swaps(&to->evtype, n);
+    swaps(&to->deviceid, n);
+    swapl(&to->time, n);
+    swapl(&to->detail, n);
+
+
+    mask = (unsigned char*)&to[1];
+    values = (FP3232*)(mask + from->valuators_len * 4);
+
+    for (i = 0; i < from->valuators_len * 4 * 8; i++)
+    {
+        if (BitIsOn(mask, i))
+        {
+            /* for each bit set there are two FP3232 values on the wire, in
+             * the order abcABC for data and data_raw. Here we swap as if
+             * they were in aAbBcC order because it's easier and really
+             * doesn't matter.
+             */
+            swapl(&values->integral, n);
+            swapl(&values->frac, n);
+            values++;
+            swapl(&values->integral, n);
+            swapl(&values->frac, n);
+            values++;
+        }
+    }
+
+    swaps(&to->valuators_len, n);
+}
+
+
 /** Event swapping function for XI2 events. */
 void
 XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
@@ -838,6 +880,13 @@ XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
         case XI_ButtonRelease:
             SDeviceEvent((xXIDeviceEvent*)from, (xXIDeviceEvent*)to);
             break;
+        case XI_RawMotion:
+        case XI_RawKeyPress:
+        case XI_RawKeyRelease:
+        case XI_RawButtonPress:
+        case XI_RawButtonRelease:
+            SRawEvent((xXIRawEvent*)from, (xXIRawEvent*)to);
+            break;
         default:
             ErrorF("[Xi] Unknown event type to swap. This is a bug.\n");
             break;
commit f3b2f9fb734ecfff6db9ae85b0d247856ede8112
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Aug 10 13:12:40 2009 +1000

    Xi: fix event swapping for XIDeviceEvents.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/extinit.c b/Xi/extinit.c
index 1e7b51e..4c8857d 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -733,14 +733,14 @@ static void SDeviceEvent(xXIDeviceEvent *from, xXIDeviceEvent *to)
     char *ptr;
     char *vmask;
 
-    *to = *from;
-    memcpy(&to[1], &from[1], from->length * 4);
+    memcpy(to, from, sizeof(xEvent) + from->length * 4);
 
     swaps(&to->sequenceNumber, n);
     swapl(&to->length, n);
     swaps(&to->evtype, n);
     swaps(&to->deviceid, n);
     swapl(&to->time, n);
+    swapl(&to->detail, n);
     swapl(&to->root, n);
     swapl(&to->event, n);
     swapl(&to->child, n);
@@ -754,11 +754,12 @@ static void SDeviceEvent(xXIDeviceEvent *from, xXIDeviceEvent *to)
     swapl(&to->mods.base_mods, n);
     swapl(&to->mods.latched_mods, n);
     swapl(&to->mods.locked_mods, n);
+    swapl(&to->mods.effective_mods, n);
 
     ptr = (char*)(&to[1]);
-    ptr += from->buttons_len;
+    ptr += from->buttons_len * 4;
     vmask = ptr; /* valuator mask */
-    ptr += from->valuators_len;
+    ptr += from->valuators_len * 4;
     for (i = 0; i < from->valuators_len * 32; i++)
     {
         if (BitIsOn(vmask, i))
@@ -830,9 +831,16 @@ XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
             SXIPropertyEvent((xXIPropertyEvent*)from,
                            (xXIPropertyEvent*)to);
             break;
-        default:
+        case XI_Motion:
+        case XI_KeyPress:
+        case XI_KeyRelease:
+        case XI_ButtonPress:
+        case XI_ButtonRelease:
             SDeviceEvent((xXIDeviceEvent*)from, (xXIDeviceEvent*)to);
             break;
+        default:
+            ErrorF("[Xi] Unknown event type to swap. This is a bug.\n");
+            break;
     }
 }
 
commit e46f02fa2de79261221b42ab73f9daa2ce8ac650
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Aug 10 09:50:16 2009 +1000

    Xext: allocate a separate event list for XTest events (#23100)
    
    XTest event processing may be interrupted by a SIGIO. If Xtest uses the same
    event list as the rest of the server, this list may be overwritten
    in-flight.
    
    X.Org Bug 23100 <http://bugs.freedesktop.org/show_bug.cgi?id=23100>
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xext/xtest.c b/Xext/xtest.c
index 5eddffa..6248732 100644
--- a/Xext/xtest.c
+++ b/Xext/xtest.c
@@ -55,6 +55,11 @@
 extern int DeviceValuator;
 extern int DeviceMotionNotify;
 
+/* XTest events are sent during request processing and may be interruped by
+ * a SIGIO. We need a separate event list to avoid events overwriting each
+ * other's memory */
+static EventListPtr xtest_evlist;
+
 #ifdef PANORAMIX
 #include "panoramiX.h"
 #include "panoramiXsrv.h"
@@ -82,6 +87,8 @@ XTestExtensionInit(INITARGS)
     AddExtension(XTestExtensionName, 0, 0,
             ProcXTestDispatch, SProcXTestDispatch,
             NULL, StandardMinorOpcode);
+
+    xtest_evlist = InitEventList(GetMaximumEventsNum());
 }
 
 static int
@@ -155,7 +162,6 @@ ProcXTestFakeInput(ClientPtr client)
     int valuators[MAX_VALUATORS] = {0};
     int numValuators = 0;
     int firstValuator = 0;
-    EventListPtr events;
     int nevents = 0;
     int i;
     int base = 0;
@@ -407,26 +413,25 @@ ProcXTestFakeInput(ClientPtr client)
     if (screenIsSaved == SCREEN_SAVER_ON)
         dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
 
-    GetEventList(&events);
     switch(type) {
         case MotionNotify:
-            nevents = GetPointerEvents(events, dev, type, 0, flags,
+            nevents = GetPointerEvents(xtest_evlist, dev, type, 0, flags,
                             firstValuator, numValuators, valuators);
             break;
         case ButtonPress:
         case ButtonRelease:
-            nevents = GetPointerEvents(events, dev, type, ev->u.u.detail,
+            nevents = GetPointerEvents(xtest_evlist, dev, type, ev->u.u.detail,
                                        flags, firstValuator,
                                        numValuators, valuators);
             break;
         case KeyPress:
         case KeyRelease:
-            nevents = GetKeyboardEvents(events, dev, type, ev->u.u.detail);
+            nevents = GetKeyboardEvents(xtest_evlist, dev, type, ev->u.u.detail);
             break;
     }
 
     for (i = 0; i < nevents; i++)
-        mieqProcessDeviceEvent(dev, (InternalEvent*)(events+i)->event, NULL);
+        mieqProcessDeviceEvent(dev, (InternalEvent*)(xtest_evlist+i)->event, NULL);
 
     miPointerUpdateSprite(dev);
     return client->noClientException;
commit 8483b08152104dc619d9e44f877d2687d866355e
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Aug 7 16:11:37 2009 +1000

    test: add focus and enter conversion testing.
    
    Doesn't actually convert anything, but verify the expected behaviour.

diff --git a/test/xi2/protocol-eventconvert.c b/test/xi2/protocol-eventconvert.c
index ce20158..e9ca68b 100644
--- a/test/xi2/protocol-eventconvert.c
+++ b/test/xi2/protocol-eventconvert.c
@@ -150,6 +150,35 @@ static void test_XIRawEvent(RawDeviceEvent *in)
 
 }
 
+static void test_convert_XIFocusEvent(void)
+{
+    xEvent *out;
+    DeviceEvent in;
+    int rc;
+
+    in.header = ET_Internal;
+    in.type = ET_Enter;
+    rc = EventToXI2((InternalEvent*)&in, &out);
+    g_assert(rc == Success);
+    g_assert(out == NULL);
+
+    in.header = ET_Internal;
+    in.type = ET_FocusIn;
+    rc = EventToXI2((InternalEvent*)&in, &out);
+    g_assert(rc == Success);
+    g_assert(out == NULL);
+
+    in.header = ET_Internal;
+    in.type = ET_FocusOut;
+    rc = EventToXI2((InternalEvent*)&in, &out);
+    g_assert(rc == BadImplementation);
+
+    in.header = ET_Internal;
+    in.type = ET_Leave;
+    rc = EventToXI2((InternalEvent*)&in, &out);
+    g_assert(rc == BadImplementation);
+}
+
 
 static void test_convert_XIRawEvent(void)
 {
@@ -244,6 +273,7 @@ int main(int argc, char** argv)
     g_test_bug_base("https://bugzilla.freedesktop.org/show_bug.cgi?id=");
 
     g_test_add_func("/xi2/eventconvert/XIRawEvent", test_convert_XIRawEvent);
+    g_test_add_func("/xi2/eventconvert/XIFocusEvent", test_convert_XIFocusEvent);
 
     return g_test_run();
 }
commit 59dc59a72ffd4cbc4df207bc688c92bb4863e8a9
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Aug 7 11:23:33 2009 +1000

    test: add XI2 eventconversion test for raw events.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index 866fa29..98ae1a2 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -473,7 +473,7 @@ eventToRawEvent(RawDeviceEvent *ev, xEvent **xi)
     char *ptr;
     FP3232 *axisval;
 
-    nvals = count_bits(ev->valuators.mask, sizeof(ev->valuators.mask)/sizeof(ev->valuators.mask[0]));
+    nvals = count_bits(ev->valuators.mask, sizeof(ev->valuators.mask));
     len += nvals * sizeof(FP3232) * 2; /* 8 byte per valuator, once
                                     raw, once processed */
     vallen = bytes_to_int32(bits_to_bytes(MAX_VALUATORS));
diff --git a/test/xi2/Makefile.am b/test/xi2/Makefile.am
index c565442..b12e0e2 100644
--- a/test/xi2/Makefile.am
+++ b/test/xi2/Makefile.am
@@ -5,7 +5,8 @@ check_PROGRAMS =  \
 	protocol-xiselectevents \
 	protocol-xigetselectedevents \
         protocol-xisetclientpointer \
-        protocol-xigetclientpointer
+        protocol-xigetclientpointer \
+        protocol-eventconvert
 
 TESTS=$(check_PROGRAMS)
 
@@ -20,6 +21,7 @@ protocol_xiselectevents_LDADD=$(TEST_LDADD)
 protocol_xigetselectedevents_LDADD=$(TEST_LDADD)
 protocol_xisetclientpointer_LDADD=$(TEST_LDADD)
 protocol_xigetclientpointer_LDADD=$(TEST_LDADD)
+protocol_eventconvert_LDADD=$(TEST_LDADD)
 
 protocol_xiqueryversion_CFLAGS=$(AM_CFLAGS) -Wl,-wrap,WriteToClient
 protocol_xiquerydevice_CFLAGS=$(AM_CFLAGS) -Wl,-wrap,WriteToClient
diff --git a/test/xi2/protocol-eventconvert.c b/test/xi2/protocol-eventconvert.c
new file mode 100644
index 0000000..ce20158
--- /dev/null
+++ b/test/xi2/protocol-eventconvert.c
@@ -0,0 +1,249 @@
+/**
+ * Copyright © 2009 Red Hat, Inc.
+ *
+ *  Permission is hereby granted, free of charge, to any person obtaining a
+ *  copy of this software and associated documentation files (the "Software"),
+ *  to deal in the Software without restriction, including without limitation
+ *  the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ *  and/or sell copies of the Software, and to permit persons to whom the
+ *  Software is furnished to do so, subject to the following conditions:
+ *
+ *  The above copyright notice and this permission notice (including the next
+ *  paragraph) shall be included in all copies or substantial portions of the
+ *  Software.
+ *
+ *  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ *  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ *  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+ *  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ *  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ *  DEALINGS IN THE SOFTWARE.
+ */
+
+#ifdef HAVE_DIX_CONFIG_H
+#include <dix-config.h>
+#endif
+
+#include <stdint.h>
+#include <glib.h>
+
+#include "inputstr.h"
+#include "eventstr.h"
+#include "eventconvert.h"
+#include <X11/extensions/XI2proto.h>
+
+
+static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out,
+                                   BOOL swap)
+{
+    int i;
+    unsigned char *ptr;
+    FP3232 *value, *raw_value;
+    int nvals = 0;
+    int bits_set;
+    int len;
+
+    if (swap)
+    {
+        char n;
+
+        swaps(&out->sequenceNumber, n);
+        swapl(&out->length, n);
+        swaps(&out->evtype, n);
+        swaps(&out->deviceid, n);
+        swapl(&out->time, n);
+        swapl(&out->detail, n);
+        swaps(&out->valuators_len, n);
+    }
+
+
+    g_assert(out->type == GenericEvent);
+    g_assert(out->extension == 0); /* IReqCode defaults to 0 */
+    g_assert(out->evtype == GetXI2Type((InternalEvent*)in));
+    g_assert(out->time == in->time);
+    g_assert(out->detail == in->detail.button);
+    g_assert(out->deviceid == in->deviceid);
+    g_assert(out->valuators_len >= bytes_to_int32(bits_to_bytes(sizeof(in->valuators.mask))));
+    g_assert(out->flags == 0); /* FIXME: we don't set the flags yet */
+
+    ptr = (unsigned char*)&out[1];
+    bits_set = 0;
+
+    for (i = 0; out->valuators_len && i < sizeof(in->valuators.mask) * 8; i++)
+    {
+        g_assert (XIMaskIsSet(in->valuators.mask, i) == XIMaskIsSet(ptr, i));
+        if (XIMaskIsSet(in->valuators.mask, i))
+            bits_set++;
+    }
+
+    /* length is len of valuator mask (in 4-byte units) + the number of bits
+     * set. Each bit set represents 2 8-byte values, hence the
+     * 'bits_set * 4' */
+    len = out->valuators_len + bits_set * 4;
+    g_assert(out->length == len);
+
+    nvals = 0;
+
+    for (i = 0; out->valuators_len && i < MAX_VALUATORS; i++)
+    {
+        g_assert (XIMaskIsSet(in->valuators.mask, i) == XIMaskIsSet(ptr, i));
+        if (XIMaskIsSet(in->valuators.mask, i))
+        {
+            FP3232 vi, vo;
+            value = (FP3232*)(((unsigned char*)&out[1]) + out->valuators_len * 4);
+            value += nvals;
+
+            vi.integral = in->valuators.data[i];
+            vi.frac = in->valuators.data_frac[i];
+
+            vo.integral = value->integral;
+            vo.frac = value->frac;
+            if (swap)
+            {
+                char n;
+                swapl(&vo.integral, n);
+                swapl(&vo.frac, n);
+            }
+
+            g_assert(vi.integral == vo.integral);
+            g_assert(vi.frac == vo.frac);
+
+            raw_value = value + bits_set;
+
+            vi.integral = in->valuators.data_raw[i];
+            vi.frac = in->valuators.data_raw_frac[i];
+
+            vo.integral = raw_value->integral;
+            vo.frac = raw_value->frac;
+            if (swap)
+            {
+                char n;
+                swapl(&vo.integral, n);
+                swapl(&vo.frac, n);
+            }
+
+            g_assert(vi.integral == vo.integral);
+            g_assert(vi.frac == vo.frac);
+
+            nvals++;
+        }
+    }
+}
+
+static void test_XIRawEvent(RawDeviceEvent *in)
+{
+    xXIRawEvent *out, *swapped;
+    int rc;
+
+    rc = EventToXI2((InternalEvent*)in, (xEvent**)&out);
+    g_assert(rc == Success);
+
+    test_values_XIRawEvent(in, out, FALSE);
+
+    swapped = xcalloc(1, sizeof(xEvent) + out->length * 4);
+    XI2EventSwap(out, swapped);
+    test_values_XIRawEvent(in, swapped, TRUE);
+
+    xfree(out);
+    xfree(swapped);
+
+}
+
+
+static void test_convert_XIRawEvent(void)
+{
+    RawDeviceEvent in;
+    int i;
+
+    memset(&in, 0, sizeof(in));
+
+    g_test_message("Testing all event types");
+    in.header = ET_Internal;
+    in.type = ET_RawMotion;
+    test_XIRawEvent(&in);
+
+    in.header = ET_Internal;
+    in.type = ET_RawKeyPress;
+    test_XIRawEvent(&in);
+
+    in.header = ET_Internal;
+    in.type = ET_RawKeyRelease;
+    test_XIRawEvent(&in);
+
+    in.header = ET_Internal;
+    in.type = ET_RawButtonPress;
+    test_XIRawEvent(&in);
+
+    in.header = ET_Internal;
+    in.type = ET_RawButtonRelease;
+    test_XIRawEvent(&in);
+
+    g_test_message("Testing details and other fields");
+    in.detail.button = 1L;
+    test_XIRawEvent(&in);
+    in.detail.button = 1L << 8;
+    test_XIRawEvent(&in);
+    in.detail.button = 1L << 16;
+    test_XIRawEvent(&in);
+    in.detail.button = 1L << 24;
+    test_XIRawEvent(&in);
+    in.detail.button = ~0L;
+    test_XIRawEvent(&in);
+
+    in.detail.button = 0;
+
+    in.time = 1L;
+    test_XIRawEvent(&in);
+    in.time = 1L << 8;
+    test_XIRawEvent(&in);
+    in.time = 1L << 16;
+    test_XIRawEvent(&in);
+    in.time = 1L << 24;
+    test_XIRawEvent(&in);
+    in.time = ~0L;
+    test_XIRawEvent(&in);
+
+    in.deviceid = 1;
+    test_XIRawEvent(&in);
+    in.deviceid = 1 << 8;
+    test_XIRawEvent(&in);
+    in.deviceid = ~0 & 0xFF;
+    test_XIRawEvent(&in);
+
+    g_test_message("Testing valuator masks");
+    for (i = 0; i < sizeof(in.valuators.mask) * 8; i++)
+    {
+        XISetMask(in.valuators.mask, i);
+        test_XIRawEvent(&in);
+        XIClearMask(in.valuators.mask, i);
+    }
+
+    for (i = 0; i < sizeof(in.valuators.mask) * 8; i++)
+    {
+        XISetMask(in.valuators.mask, i);
+
+        in.valuators.data[i] = i;
+        in.valuators.data_raw[i] = i + 10;
+        in.valuators.data_frac[i] = i + 20;
+        in.valuators.data_raw_frac[i] = i + 30;
+        test_XIRawEvent(&in);
+        XIClearMask(in.valuators.mask, i);
+    }
+
+    for (i = 0; i < sizeof(in.valuators.mask) * 8; i++)
+    {
+        XISetMask(in.valuators.mask, i);
+        test_XIRawEvent(&in);
+    }
+}
+
+int main(int argc, char** argv)
+{
+    g_test_init(&argc, &argv,NULL);
+    g_test_bug_base("https://bugzilla.freedesktop.org/show_bug.cgi?id=");
+
+    g_test_add_func("/xi2/eventconvert/XIRawEvent", test_convert_XIRawEvent);
+
+    return g_test_run();
+}
commit 10d7948e0360860e1e9633dca39f646d492e73bf
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Fri Aug 7 10:17:14 2009 +1000

    test: fix build error introduced by new AllocDevicePair API
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/test/xi2/protocol-common.c b/test/xi2/protocol-common.c
index 1a4ad24..fc10698 100644
--- a/test/xi2/protocol-common.c
+++ b/test/xi2/protocol-common.c
@@ -37,6 +37,8 @@ WindowRec window;
 
 void *userdata;
 
+extern int CorePointerProc(DeviceIntPtr pDev, int what);
+extern int CoreKeyboardProc(DeviceIntPtr pDev, int what);
 /**
  * Create and init 2 master devices (VCP + VCK) and two slave devices, one
  * default mouse, one default keyboard.
@@ -48,7 +50,8 @@ struct devices init_devices(void)
 
     client = init_client(0, NULL);
 
-    AllocDevicePair(&client, "Virtual core", &devices.vcp, &devices.vck, TRUE);
+    AllocDevicePair(&client, "Virtual core", &devices.vcp, &devices.vck,
+                    CorePointerProc, CoreKeyboardProc, TRUE);
     inputInfo.pointer = devices.vcp;
     inputInfo.keyboard = devices.vck;
     ActivateDevice(devices.vcp, FALSE);
@@ -56,7 +59,8 @@ struct devices init_devices(void)
     EnableDevice(devices.vcp, FALSE);
     EnableDevice(devices.vck, FALSE);
 
-    AllocDevicePair(&client, "", &devices.mouse, &devices.kbd, FALSE);
+    AllocDevicePair(&client, "", &devices.mouse, &devices.kbd,
+                    CorePointerProc, CoreKeyboardProc, FALSE);
     ActivateDevice(devices.mouse, FALSE);
     ActivateDevice(devices.kbd, FALSE);
     EnableDevice(devices.mouse, FALSE);
commit 3f161a0aac39fbdeef393a17269486b8dace4672
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Aug 10 14:14:35 2009 +1000

    Xi: un-statify XI2EventSwap, it is needed for tests.
    
    Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>

diff --git a/Xi/extinit.c b/Xi/extinit.c
index 1376f4f..1e7b51e 100644
--- a/Xi/extinit.c
+++ b/Xi/extinit.c
@@ -810,7 +810,7 @@ static void SXIPropertyEvent(xXIPropertyEvent *from, xXIPropertyEvent *to)
 }
 
 /** Event swapping function for XI2 events. */
-static void
+void
 XI2EventSwap(xGenericEvent *from, xGenericEvent *to)
 {
     switch(from->evtype)
diff --git a/include/exevents.h b/include/exevents.h
index f58488d..8d4b80b 100644
--- a/include/exevents.h
+++ b/include/exevents.h
@@ -193,6 +193,10 @@ extern _X_EXPORT void SendEventToAllWindows(
         xEvent *               /* ev */,
         int                    /* count */);
 
+extern _X_HIDDEN void XI2EventSwap(
+        xGenericEvent  *              /* from */,
+        xGenericEvent  *              /* to */);
+
 /* Input device properties */
 extern _X_EXPORT void XIDeleteAllDeviceProperties(
         DeviceIntPtr            /* device */
commit 55e1ea08d03d89ecc0f2db7652a4d15567204696
Author: Peter Hutterer <peter.hutterer at who-t.net>
Date:   Mon Aug 3 16:46:11 2009 +1000

    Xi: get device changed data from DeviceChangedEvents, not the device (#23100)
    
    If a new device posts an event while the DCE is in the queue, getting the
    data from the device may result in invalid memory access.
    
    X.Org Bug 23100 <http://bugs.freedesktop.org/show_bug.cgi?id=23100>

diff --git a/Xi/exevents.c b/Xi/exevents.c
index 85d14b0..49eacb4 100644
--- a/Xi/exevents.c
+++ b/Xi/exevents.c
@@ -674,6 +674,69 @@ DeepCopyDeviceClasses(DeviceIntPtr from, DeviceIntPtr to, DeviceChangedEvent *dc
 }
 
 
+static int
+AppendKeyInfo(DeviceChangedEvent *dce, xXIKeyInfo* info)
+{
+    uint32_t *kc;
+    int i;
+
+    info->type = KeyClass;
+    info->num_keycodes = dce->keys.max_keycode - dce->keys.min_keycode + 1;
+    info->length = sizeof(xXIKeyInfo)/4 + info->num_keycodes;
+    info->sourceid = dce->deviceid;
+
+    kc = (uint32_t*)&info[1];
+    for (i = 0; i < info->num_keycodes; i++)
+        *kc++ = i + dce->keys.min_keycode;
+
+    return info->length * 4;
+}
+
+static int
+AppendButtonInfo(DeviceChangedEvent *dce, xXIButtonInfo *info)
+{
+    unsigned char *bits;
+    int mask_len;
+
+    mask_len = bytes_to_int32(bits_to_bytes(dce->buttons.num_buttons));
+
+    info->type = ButtonClass;
+    info->num_buttons = dce->buttons.num_buttons;
+    info->length = bytes_to_int32(sizeof(xXIButtonInfo)) +
+                   info->num_buttons + mask_len;
+    info->sourceid = dce->deviceid;
+
+    bits = (unsigned char*)&info[1];
+    memset(bits, 0, mask_len * 4);
+    /* FIXME: is_down? */
+
+    bits += mask_len * 4;
+    memcpy(bits, dce->buttons.names, dce->buttons.num_buttons * sizeof(Atom));
+
+    return info->length * 4;
+}
+
+static int
+AppendValuatorInfo(DeviceChangedEvent *dce, xXIValuatorInfo *info, int axisnumber)
+{
+    info->type = ValuatorClass;
+    info->length = sizeof(xXIValuatorInfo)/4;
+    info->label = dce->valuators[axisnumber].name;
+    info->min.integral = dce->valuators[axisnumber].min;
+    info->min.frac = 0;
+    info->max.integral = dce->valuators[axisnumber].max;
+    info->max.frac = 0;
+    /* FIXME: value */
+    info->value.integral = 0;
+    info->value.frac = 0;
+    info->resolution = dce->valuators[axisnumber].resolution;
+    info->number = axisnumber;
+    info->mode = dce->valuators[axisnumber].mode; /* Server doesn't have per-axis mode yet */
+    info->sourceid = dce->deviceid;
+
+    return info->length * 4;
+}
+
 /**
  * Send an XI2 DeviceChangedEvent to all interested clients.
  */
@@ -723,13 +786,13 @@ XISendDeviceChangedEvent(DeviceIntPtr device, DeviceIntPtr master, DeviceChanged
     if (dce->buttons.num_buttons)
     {
         dcce->num_classes++;
-        ptr += ListButtonInfo(device, (xXIButtonInfo*)ptr);
+        ptr += AppendButtonInfo(dce, (xXIButtonInfo*)ptr);
     }
 
     if (nkeys)
     {
         dcce->num_classes++;
-        ptr += ListKeyInfo(device, (xXIKeyInfo*)ptr);
+        ptr += AppendKeyInfo(dce, (xXIKeyInfo*)ptr);
     }
 
     if (dce->num_valuators)
@@ -738,7 +801,7 @@ XISendDeviceChangedEvent(DeviceIntPtr device, DeviceIntPtr master, DeviceChanged
 
         dcce->num_classes += dce->num_valuators;
         for (i = 0; i < dce->num_valuators; i++)
-            ptr += ListValuatorInfo(device, (xXIValuatorInfo*)ptr, i);
+            ptr += AppendValuatorInfo(dce, (xXIValuatorInfo*)ptr, i);
     }
 
     /* we don't actually swap if there's a NullClient, swapping is done


More information about the xorg-commit mailing list