summaryrefslogtreecommitdiff
path: root/src/XIQueryDevice.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-06-14 08:40:59 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-06-16 14:22:15 +1000
commit1ca170b8d19b1170356a1edf4717cd4a95671a13 (patch)
tree032223373129e124a128e4201694bea36832337e /src/XIQueryDevice.c
parent4ec5f70a813ba08bfcea7b2ff90f7647a94a95d7 (diff)
XIButtonClass now includes a XIButtonState struct.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src/XIQueryDevice.c')
-rw-r--r--src/XIQueryDevice.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/XIQueryDevice.c b/src/XIQueryDevice.c
index d8de8a6..d8df2d1 100644
--- a/src/XIQueryDevice.c
+++ b/src/XIQueryDevice.c
@@ -57,6 +57,7 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int nclasses)
case XIButtonClass:
l = sizeof(XIButtonClassInfo);
l += ((xXIButtonInfo*)any_wire)->num_buttons * sizeof(Atom);
+ l += ((((((xXIButtonInfo*)any_wire)->num_buttons + 7)/8) + 3)/4) * 4;
break;
case XIKeyClass:
l = sizeof(XIKeyClassInfo);
@@ -93,17 +94,25 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int nclasses)
{
XIButtonClassInfo *cls_lib;
xXIButtonInfo *cls_wire;
+ uint32_t *atoms;
+ int j;
cls_lib = (XIButtonClassInfo*)any_lib;
cls_wire = (xXIButtonInfo*)any_wire;
cls_lib->num_buttons = cls_wire->num_buttons;
- cls_lib->buttons = (Atom*)&cls_lib[1];
- memcpy(cls_lib->buttons, &cls_wire[1],
+ cls_lib->state.mask_len = ((((cls_wire->num_buttons + 7)/8) + 3)/4) * 4;
+ cls_lib->state.mask = (unsigned char*)&cls_lib[1];
+ memcpy(cls_lib->state.mask, &cls_wire[1],
+ cls_lib->state.mask_len);
+
+ cls_lib->names = (Atom*)((char*)&cls_lib[1] + cls_lib->state.mask_len);
+ memcpy(cls_lib->names, &cls_wire[1],
cls_lib->num_buttons);
ptr_lib += sizeof(XIButtonClassInfo);
ptr_lib += cls_lib->num_buttons * sizeof(Atom);
+ ptr_lib += cls_lib->state.mask_len;
break;
}
case XIKeyClass: