From 1ca170b8d19b1170356a1edf4717cd4a95671a13 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Sun, 14 Jun 2009 08:40:59 +1000 Subject: XIButtonClass now includes a XIButtonState struct. Signed-off-by: Peter Hutterer --- src/XIQueryDevice.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/XIQueryDevice.c') 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: -- cgit v1.2.3