summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/XExtInt.c44
-rw-r--r--src/XIFreeEvent.c5
2 files changed, 49 insertions, 0 deletions
diff --git a/src/XExtInt.c b/src/XExtInt.c
index 22c054e..662acbe 100644
--- a/src/XExtInt.c
+++ b/src/XExtInt.c
@@ -130,6 +130,8 @@ static int
wireToDeviceChangedEvent(xXIDeviceChangedEvent *in, XIDeviceChangedEvent* out);
static int
wireToHierarchyChangedEvent(xXIDeviceHierarchyEvent *in, XIDeviceHierarchyEvent* out);
+static int
+wireToRawEvent(xXIRawDeviceEvent *in, XIRawDeviceEvent *out);
static /* const */ XEvent emptyevent;
@@ -818,6 +820,15 @@ XInputWireToEvent(
}
return ENQUEUE_EVENT;
+ case XI_RawEvent:
+ *re = *save;
+ if (!wireToRawEvent(event, re))
+ {
+ printf("XInputWireToEvent: CONVERSION FAILURE! evtype=%d\n",
+ ge->evtype);
+ break;
+ }
+ return ENQUEUE_EVENT;
#if 0
case XI_HierarchyChangedNotify:
{
@@ -1003,3 +1014,36 @@ wireToHierarchyChangedEvent(xXIDeviceHierarchyEvent *in, XIDeviceHierarchyEvent*
return 1;
}
+
+static int
+wireToRawEvent(xXIRawDeviceEvent *in, XIRawDeviceEvent *out)
+{
+ int len, i;
+ FP3232 *values;
+
+ out->type = in->type;
+ out->extension = in->extension;
+ out->evtype = in->evtype;
+ out->time = in->time;
+ out->detail = in->detail;
+ out->deviceid = in->deviceid;
+
+ out->valuators = malloc(sizeof(XIValuatorState) + in->valuators_len * 4);
+ out->valuators->mask_len = in->valuators_len * 4;
+ out->valuators->mask = (unsigned char*)&out->valuators[1];
+ memcpy(out->valuators->mask, &in[1], out->valuators->mask_len);
+
+ len = count_bits(out->valuators->mask, out->valuators->mask_len);
+ out->valuators->values = calloc(len, sizeof(double));
+ out->raw_values = calloc(len, sizeof(double));
+
+ values = (FP3232*)(((char*)&in[1]) + in->valuators_len * 4);
+ for (i = 0; i < len; i++)
+ {
+ out->valuators->values[i] = values->integral;
+ out->raw_values[i] = (values + len)->integral;
+ values++;
+ }
+
+ return 1;
+}
diff --git a/src/XIFreeEvent.c b/src/XIFreeEvent.c
index 004b9e4..0c80602 100644
--- a/src/XIFreeEvent.c
+++ b/src/XIFreeEvent.c
@@ -55,5 +55,10 @@ XIFreeEventData(XIEvent *event)
case XI_HierarchyChanged:
free(((XIDeviceHierarchyEvent*)event)->info);
break;
+ case XI_RawEvent:
+ free(((XIRawDeviceEvent*)event)->valuators->values);
+ free(((XIRawDeviceEvent*)event)->valuators);
+ free(((XIRawDeviceEvent*)event)->raw_values);
+ break;
}
}