diff options
author | Peter Hutterer <peter@cs.unisa.edu.au> | 2007-05-02 09:44:37 +0930 |
---|---|---|
committer | Peter Hutterer <peter@cs.unisa.edu.au> | 2007-05-02 09:44:37 +0930 |
commit | fe33724ed6cdaad6b13a7ca1c9f03dbb98d93982 (patch) | |
tree | 259115631cea0662bfe86946fee711cdb1faaa33 | |
parent | 44ccc08bb19d9d55fb9ff6bfb0592d5d79b9b712 (diff) |
Add deviceid and ev-to-wire conversion for RawDeviceEvent.
-rw-r--r-- | src/XExtInt.c | 9 | ||||
-rw-r--r-- | src/XExtToWire.c | 23 |
2 files changed, 30 insertions, 2 deletions
diff --git a/src/XExtInt.c b/src/XExtInt.c index 9b90711..9396da5 100644 --- a/src/XExtInt.c +++ b/src/XExtInt.c @@ -791,12 +791,17 @@ XInputWireToEvent(dpy, re, event) raw_event->num_valuators = raw_wire->num_valuators; raw_event->first_valuator = raw_wire->first_valuator; raw_event->buttons = raw_wire->buttons; + raw_event->deviceid = raw_wire->deviceid; if (raw_event->num_valuators) { + int i; + CARD32* valptr; raw_event->valuators = (char*)calloc((raw_event->num_valuators), sizeof(int)); - memcpy(raw_event->valuators, &raw_wire->valuator0, - raw_event->num_valuators * sizeof(CARD32)); + valptr = &raw_wire->valuator0; + for (i = 0; i < raw_event->num_valuators; i++, + valptr++) + raw_event->valuators[i] = *valptr; } else raw_event->valuators = NULL; *re = *save; diff --git a/src/XExtToWire.c b/src/XExtToWire.c index 163dd4a..6c48335 100644 --- a/src/XExtToWire.c +++ b/src/XExtToWire.c @@ -514,6 +514,29 @@ _XiEventToWire(dpy, re, event, count) pcev->keyboard = ev->keyboardid; break; } + case XI_RawDeviceEvent: + { + int i; + CARD32* valptr; + XRawDeviceEvent* ev = (XRawDeviceEvent*)re; + rawDeviceEvent* rev; + *count = 1; + rev = (rawDeviceEvent*)Xmalloc(*count * (sizeof(xEvent) + ev->num_valuators * sizeof(CARD32))); + if (!rev) + return (_XUnknownNativeEvent(dpy, re, *event)); + + *event = (xEvent*)rev; + rev->type = ev->type; + rev->extension = ev->extension; + rev->deviceid = ev->deviceid; + rev->buttons = ev->buttons; + rev->num_valuators = ev->num_valuators; + rev->first_valuator = ev->first_valuator; + valptr = &rev->valuator0; + for(i = 0; i < ev->num_valuators; i++, valptr++) + *valptr = ev->valuators[i]; + break; + } default: return (_XUnknownNativeEvent(dpy, re, *event)); } |