[PATCH 12/28] Input: Set fractional member in set_raw_valuators
Daniel Stone
daniel at fooishbar.org
Thu Jun 9 10:17:20 PDT 2011
RawDeviceEvents have space for fractional valuator members, so might as
well start using them.
Signed-off-by: Daniel Stone <daniel at fooishbar.org>
Reviewed-by: Peter Hutterer <peter.hutterer at who-t.net>
---
dix/getevents.c | 20 ++++++++++++++------
1 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/dix/getevents.c b/dix/getevents.c
index 5195a24..f02b833 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -178,16 +178,20 @@ init_raw(DeviceIntPtr dev, RawDeviceEvent *event, Time ms, int type, int detail)
}
static void
-set_raw_valuators(RawDeviceEvent *event, ValuatorMask *mask, int32_t* data)
+set_raw_valuators(RawDeviceEvent *event, ValuatorMask *mask, int32_t* data,
+ int32_t* data_frac)
{
int i;
+ double val;
for (i = 0; i < valuator_mask_size(mask); i++)
{
if (valuator_mask_isset(mask, i))
{
SetBit(event->valuators.mask, i);
- data[i] = valuator_mask_get(mask, i);
+ val = valuator_mask_get_double(mask, i);
+ data[i] = trunc(val);
+ data_frac[i] = (val - data[i]) * (1UL << 32);
}
}
}
@@ -988,11 +992,13 @@ GetKeyboardEvents(InternalEvent *events, DeviceIntPtr pDev, int type,
valuator_mask_copy(&mask, mask_in);
init_raw(pDev, raw, ms, type, key_code);
- set_raw_valuators(raw, &mask, raw->valuators.data_raw);
+ set_raw_valuators(raw, &mask, raw->valuators.data_raw,
+ raw->valuators.data_raw_frac);
clipValuators(pDev, &mask);
- set_raw_valuators(raw, &mask, raw->valuators.data);
+ set_raw_valuators(raw, &mask, raw->valuators.data,
+ raw->valuators.data_frac);
event = &events->device_event;
init_event(pDev, event, ms);
@@ -1164,7 +1170,8 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type, int buttons
valuator_mask_copy(&mask, mask_in);
init_raw(pDev, raw, ms, type, buttons);
- set_raw_valuators(raw, &mask, raw->valuators.data_raw);
+ set_raw_valuators(raw, &mask, raw->valuators.data_raw,
+ raw->valuators.data_raw_frac);
if (flags & POINTER_ABSOLUTE)
{
@@ -1203,7 +1210,8 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type, int buttons
moveRelative(pDev, &x, &y, &mask);
}
- set_raw_valuators(raw, &mask, raw->valuators.data);
+ set_raw_valuators(raw, &mask, raw->valuators.data,
+ raw->valuators.data_frac);
positionSprite(pDev, (flags & POINTER_ABSOLUTE) ? Absolute : Relative,
&x, &y, x_frac, y_frac, scr, &cx, &cy, &cx_frac, &cy_frac);
--
1.7.5.3
More information about the xorg-devel
mailing list