diff options
author | Peter Hutterer <peter@cs.unisa.edu.au> | 2007-10-18 12:22:37 +0930 |
---|---|---|
committer | Peter Hutterer <peter@cs.unisa.edu.au> | 2007-10-18 12:22:37 +0930 |
commit | d1f92d6c14d7c9b553b8530a1daf0a77a8babccf (patch) | |
tree | 2d794f182365267dd12925bd564c5c27ce57d3bd | |
parent | fbd0431546c3ede8d606559fdd7a18f4cce05743 (diff) |
Create AttachInfo class for all devices, containing attachment info.
Thanks to Xlib's braindead design we can't just add the field to XDeviceInfo.
So we just fake up a new class, add it to all devices and let clients deal
with it.
-rw-r--r-- | src/XListDev.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/XListDev.c b/src/XListDev.c index b9a617d..347e990 100644 --- a/src/XListDev.c +++ b/src/XListDev.c @@ -133,6 +133,11 @@ XListInputDevices(dpy, ndevices) } any = (xAnyClassPtr) ((char *)any + any->length); } + /* Thanks to Xlibs braindead abstraction of XListInputDevices we + * have to fake up a new class to indicate attachment, otherwise + * we need to break the ABI. Each device has such a class. + */ + size += sizeof(XAttachInfo); } for (i = 0, nptr = (char *)any; i < *ndevices; i++) { @@ -156,7 +161,7 @@ XListInputDevices(dpy, ndevices) clist->type = list->type; clist->id = list->id; clist->use = list->use; - clist->num_classes = list->num_classes; + clist->num_classes = list->num_classes + 1; /*fake attach class */ clist->inputclassinfo = Any; for (j = 0; j < (int)list->num_classes; j++) { switch (any->class) { @@ -211,6 +216,14 @@ XListInputDevices(dpy, ndevices) any = (xAnyClassPtr) ((char *)any + any->length); Any = (XAnyClassPtr) ((char *)Any + Any->length); } + + /* Insert fake AttachInfo class */ + { + ((XAttachInfoPtr)Any)->length = sizeof(XAttachInfo); + ((XAttachInfoPtr)Any)->class = AttachClass; + ((XAttachInfoPtr)Any)->attached = list->attached; + Any = (XAnyClassPtr) ((char *)Any + Any->length); + } } clist = sclist; |