summaryrefslogtreecommitdiff
path: root/dix/eventconvert.c
diff options
context:
space:
mode:
authorPeter Hutterer <peter.hutterer@who-t.net>2009-07-03 16:50:03 +1000
committerPeter Hutterer <peter.hutterer@who-t.net>2009-07-14 10:05:54 +1000
commit2d35ea8d957a955e1200ba2b14424bddfe1f4148 (patch)
treef06b6093ff6289b60fcfe6ab5aa72a8eb4d1c0e7 /dix/eventconvert.c
parent7dd415aa6a3959f15276741db168ba264948ecfe (diff)
dix: switch to byte-counting functions.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'dix/eventconvert.c')
-rw-r--r--dix/eventconvert.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/dix/eventconvert.c b/dix/eventconvert.c
index a65bf68da..8d9a329c1 100644
--- a/dix/eventconvert.c
+++ b/dix/eventconvert.c
@@ -389,13 +389,13 @@ eventToDeviceEvent(DeviceEvent *ev, xEvent **xi)
/* FIXME: this should just send the buttons we have, not MAX_BUTTONs. Same
* with MAX_VALUATORS below */
/* btlen is in 4 byte units */
- btlen = (((MAX_BUTTONS + 7)/8) + 3)/4;
+ btlen = bytes_to_int32(bits_to_bytes(MAX_BUTTONS));
len += btlen * 4; /* buttonmask len */
vallen = count_bits(ev->valuators.mask, sizeof(ev->valuators.mask)/sizeof(ev->valuators.mask[0]));
len += vallen * 2 * sizeof(uint32_t); /* axisvalues */
- vallen = (((MAX_VALUATORS + 7)/8) + 3)/4;
+ vallen = bytes_to_int32(bits_to_bytes(MAX_VALUATORS));
len += vallen * 4; /* valuators mask */
*xi = xcalloc(1, len);
@@ -404,7 +404,7 @@ eventToDeviceEvent(DeviceEvent *ev, xEvent **xi)
xde->extension = IReqCode;
xde->evtype = GetXI2Type((InternalEvent*)ev);
xde->time = ev->time;
- xde->length = (len - sizeof(xEvent) + 3)/4;
+ xde->length = bytes_to_int32(len - sizeof(xEvent));
xde->detail = ev->detail.button;
xde->root = ev->root;
xde->buttons_len = btlen;
@@ -459,7 +459,7 @@ eventToRawEvent(RawDeviceEvent *ev, xEvent **xi)
nvals = count_bits(ev->valuators.mask, sizeof(ev->valuators.mask)/sizeof(ev->valuators.mask[0]));
len += nvals * (2 * sizeof(uint32_t)) * 2; /* 8 byte per valuator, once
raw, once processed */
- vallen = (((MAX_VALUATORS + 7)/8) + 3)/4;
+ vallen = bytes_to_int32(bits_to_bytes(MAX_VALUATORS));
len += vallen * 4; /* valuators mask */
*xi = xcalloc(1, len);
@@ -468,7 +468,7 @@ eventToRawEvent(RawDeviceEvent *ev, xEvent **xi)
raw->extension = IReqCode;
raw->evtype = GetXI2Type((InternalEvent*)ev);
raw->time = ev->time;
- raw->length = (len - sizeof(xEvent) + 3)/4;
+ raw->length = bytes_to_int32(len - sizeof(xEvent));
raw->eventtype = ev->subtype;
raw->detail = ev->detail.button;
raw->deviceid = ev->deviceid;