diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-06-14 08:40:59 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-06-16 14:22:15 +1000 |
commit | 1ca170b8d19b1170356a1edf4717cd4a95671a13 (patch) | |
tree | 032223373129e124a128e4201694bea36832337e | |
parent | 4ec5f70a813ba08bfcea7b2ff90f7647a94a95d7 (diff) |
XIButtonClass now includes a XIButtonState struct.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | include/X11/extensions/XInput2.h | 44 | ||||
-rw-r--r-- | src/XIQueryDevice.c | 13 |
2 files changed, 34 insertions, 23 deletions
diff --git a/include/X11/extensions/XInput2.h b/include/X11/extensions/XInput2.h index 7fd81c5..43abdb3 100644 --- a/include/X11/extensions/XInput2.h +++ b/include/X11/extensions/XInput2.h @@ -70,6 +70,27 @@ typedef union { typedef struct { + int base; + int latched; + int locked; +} XIModifierState; + +typedef XIModifierState XIGroupState; + +typedef struct { + int mask_len; + unsigned char *mask; +} XIButtonState; + +typedef struct { + int mask_len; + unsigned char *mask; + double *values; +} XIValuatorState; + + +typedef struct +{ int deviceid; int mask_len; unsigned char* mask; @@ -86,7 +107,8 @@ typedef struct int type; int sourceid; int num_buttons; - Atom *buttons; + Atom *names; + XIButtonState state; } XIButtonClassInfo; typedef struct @@ -186,26 +208,6 @@ typedef struct { XIAnyClassInfo **classes; /* same as in XIDeviceInfo */ } XIDeviceChangedEvent; -typedef struct -{ - int base; - int latched; - int locked; -} XIModifierState; - -typedef XIModifierState XIGroupState; - -typedef struct { - int mask_len; - unsigned char *mask; -} XIButtonState; - -typedef struct { - int mask_len; - unsigned char *mask; - double *values; -} XIValuatorState; - typedef struct { int type; /* GenericEvent */ unsigned long serial; /* # of last request processed by server */ 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: |