summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2011-02-23 14:31:01 +0000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-09-29 12:23:51 +1000
commit79d4deb76d5612b75ef26b4549b7ade3a656687d (patch)
tree4322bbb22612afb47ad02a7f37ecdd597d06018f
parent60a766a96f9ec97adf6d0273f70ec23f313a11c6 (diff)
Input: Convert ValuatorMask to double-precision internally
Switch the ValuatorMask struct to using doubles instead of ints for the actual values. Preserve the old int API, and (attempt to) round towards zero for values we return. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--dix/inpututils.c4
-rw-r--r--include/inpututils.h2
2 files changed, 3 insertions, 3 deletions
diff --git a/dix/inpututils.c b/dix/inpututils.c
index 7aeb1e516..1c4af8e5e 100644
--- a/dix/inpututils.c
+++ b/dix/inpututils.c
@@ -514,7 +514,7 @@ valuator_mask_set(ValuatorMask *mask, int valuator, int data)
int
valuator_mask_get(const ValuatorMask *mask, int valuator)
{
- return mask->valuators[valuator];
+ return trunc(mask->valuators[valuator]);
}
/**
@@ -527,7 +527,7 @@ valuator_mask_unset(ValuatorMask *mask, int valuator)
int i, lastbit = -1;
ClearBit(mask->mask, valuator);
- mask->valuators[valuator] = 0;
+ mask->valuators[valuator] = 0.0;
for (i = 0; i <= mask->last_bit; i++)
if (valuator_mask_isset(mask, i))
diff --git a/include/inpututils.h b/include/inpututils.h
index 63e1a263a..47e242d87 100644
--- a/include/inpututils.h
+++ b/include/inpututils.h
@@ -34,7 +34,7 @@
struct _ValuatorMask {
int8_t last_bit; /* highest bit set in mask */
uint8_t mask[(MAX_VALUATORS + 7)/8];
- int valuators[MAX_VALUATORS]; /* valuator data */
+ double valuators[MAX_VALUATORS]; /* valuator data */
};
extern void verify_internal_event(const InternalEvent *ev);