diff options
author | Daniel Stone <daniel@fooishbar.org> | 2011-03-03 15:06:45 +0000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2011-09-29 12:24:34 +1000 |
commit | 626f487b97c99b48bf1d8c8ef4367a686639c3e6 (patch) | |
tree | a52dbf70296dd2c5c0a1b9be582774e2d3cc9831 /test/xi2 | |
parent | 3b7fb0f68dc0d40c968c2cfc9bb74b1d0fb48bc8 (diff) |
Input: Make RawDeviceEvent use doubles internally
Change RawDeviceEvent to use doubles for valuators internally, rather
than data(_raw) and data(_raw)_frac.
Signed-off-by: Daniel Stone <daniel@fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'test/xi2')
-rw-r--r-- | test/xi2/protocol-eventconvert.c | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/test/xi2/protocol-eventconvert.c b/test/xi2/protocol-eventconvert.c index 80c47b06f..6df9af0fe 100644 --- a/test/xi2/protocol-eventconvert.c +++ b/test/xi2/protocol-eventconvert.c @@ -93,8 +93,8 @@ static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out, value = (FP3232*)(((unsigned char*)&out[1]) + out->valuators_len * 4); value += nvals; - vi.integral = in->valuators.data[i]; - vi.frac = in->valuators.data_frac[i]; + vi.integral = trunc(in->valuators.data[i]); + vi.frac = in->valuators.data[i] - vi.integral; vo.integral = value->integral; vo.frac = value->frac; @@ -109,8 +109,8 @@ static void test_values_XIRawEvent(RawDeviceEvent *in, xXIRawEvent *out, raw_value = value + bits_set; - vi.integral = in->valuators.data_raw[i]; - vi.frac = in->valuators.data_raw_frac[i]; + vi.integral = trunc(in->valuators.data_raw[i]); + vi.frac = in->valuators.data_raw[i] - vi.integral; vo.integral = raw_value->integral; vo.frac = raw_value->frac; @@ -248,10 +248,8 @@ static void test_convert_XIRawEvent(void) { XISetMask(in.valuators.mask, i); - in.valuators.data[i] = i; - in.valuators.data_raw[i] = i + 10; - in.valuators.data_frac[i] = i + 20; - in.valuators.data_raw_frac[i] = i + 30; + in.valuators.data[i] = i + (i * 0.0010); + in.valuators.data_raw[i] = (i + 10) + (i * 0.0030); test_XIRawEvent(&in); XIClearMask(in.valuators.mask, i); } |