summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-07-08 16:00:57 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-07-12 16:33:50 +1000
commit4dacd34cc05054a0ab26621aaec8125b2ffe5bbf (patch)
treeeef41ebb4fbd4421a01ae2074269d0987f4893e9 /src
parent79b1ee174bb08722198e6d00c9d1a1e9e9352b8a (diff)
Add event copying for raw events.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'src')
-rw-r--r--src/XExtInt.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/XExtInt.c b/src/XExtInt.c
index 80ccda2..c58ef7e 100644
--- a/src/XExtInt.c
+++ b/src/XExtInt.c
@@ -1177,6 +1177,41 @@ copyPropertyEvent(XGenericEventCookie *cookie_in,
}
static Bool
+copyRawEvent(XGenericEventCookie *cookie_in,
+ XGenericEventCookie *cookie_out)
+{
+ XIRawEvent *in, *out;
+ void *ptr;
+ int len;
+ int bits;
+
+ in = cookie_in->data;
+
+ bits = count_bits(in->valuators.mask, in->valuators.mask_len);
+ len = sizeof(XIRawEvent) + in->valuators.mask_len;
+ len += bits * sizeof(double) * 2;
+
+ ptr = cookie_out->data = malloc(sizeof(XIRawEvent));
+ if (!ptr)
+ return False;
+
+ out = next_block(&ptr, sizeof(XIRawEvent));
+ *out = *in;
+ out->valuators.mask = next_block(&ptr, out->valuators.mask_len);
+ memcpy(out->valuators.mask, in->valuators.mask, out->valuators.mask_len);
+
+ out->valuators.values = next_block(&ptr, bits * sizeof(double));
+ memcpy(out->valuators.values, in->valuators.values, bits * sizeof(double));
+
+ out->raw_values = next_block(&ptr, bits * sizeof(double));
+ memcpy(out->raw_values, in->raw_values, bits * sizeof(double));
+
+ return True;
+}
+
+
+
+static Bool
XInputCopyCookie(Display *dpy, XGenericEventCookie *in, XGenericEventCookie *out)
{
int ret = True;
@@ -1217,6 +1252,9 @@ XInputCopyCookie(Display *dpy, XGenericEventCookie *in, XGenericEventCookie *out
case XI_PropertyEvent:
ret = copyPropertyEvent(in, out);
break;
+ case XI_RawEvent:
+ ret = copyRawEvent(in, out);
+ break;
default:
printf("XInputCopyCookie: unknown evtype %d\n", in->evtype);
ret = False;