summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Stone <daniel@fooishbar.org>2011-03-02 13:34:32 +0000
committerPeter Hutterer <peter.hutterer@who-t.net>2011-09-29 12:23:51 +1000
commite1df51421bc392d57f88c831fe0661871a8aa769 (patch)
tree9cc9c121e1fd3527931fc4e5b05436513c97605e
parentcdf202250ef616f3b261db70da30e421ea59a630 (diff)
Input: Set fractional member in set_raw_valuators
RawDeviceEvents have space for fractional valuator members, so might as well start using them. Signed-off-by: Daniel Stone <daniel@fooishbar.org> Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r--dix/getevents.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/dix/getevents.c b/dix/getevents.c
index 76e8a32ed..b8f4a8cf4 100644
--- a/dix/getevents.c
+++ b/dix/getevents.c
@@ -167,16 +167,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);
}
}
}
@@ -969,11 +973,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_device_event(event, pDev, ms);
@@ -1147,7 +1153,8 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type, int buttons
num_events++;
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)
@@ -1188,7 +1195,8 @@ GetPointerEvents(InternalEvent *events, DeviceIntPtr pDev, int type, int buttons
}
if ((flags & POINTER_NORAW) == 0)
- 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);