Use new FP1616/FP3232 conversion functions
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net> Reviewed-by: Jeremy Huddleston <jeremyhu@apple.com>
This commit is contained in:
parent
7500d841f4
commit
ffe20acedb
|
@ -41,6 +41,7 @@
|
||||||
#include "xserver-properties.h"
|
#include "xserver-properties.h"
|
||||||
#include "exevents.h"
|
#include "exevents.h"
|
||||||
#include "xace.h"
|
#include "xace.h"
|
||||||
|
#include "inpututils.h"
|
||||||
|
|
||||||
#include "xiquerydevice.h"
|
#include "xiquerydevice.h"
|
||||||
|
|
||||||
|
@ -351,8 +352,7 @@ ListValuatorInfo(DeviceIntPtr dev, xXIValuatorInfo* info, int axisnumber,
|
||||||
info->min.frac = 0;
|
info->min.frac = 0;
|
||||||
info->max.integral = v->axes[axisnumber].max_value;
|
info->max.integral = v->axes[axisnumber].max_value;
|
||||||
info->max.frac = 0;
|
info->max.frac = 0;
|
||||||
info->value.integral = (int)v->axisVal[axisnumber];
|
info->value = double_to_fp3232(v->axisVal[axisnumber]);
|
||||||
info->value.frac = (int)(v->axisVal[axisnumber] * (1 << 16) * (1 << 16));
|
|
||||||
info->resolution = v->axes[axisnumber].resolution;
|
info->resolution = v->axes[axisnumber].resolution;
|
||||||
info->number = axisnumber;
|
info->number = axisnumber;
|
||||||
info->mode = valuator_get_mode(dev, axisnumber);
|
info->mode = valuator_get_mode(dev, axisnumber);
|
||||||
|
@ -402,8 +402,7 @@ ListScrollInfo(DeviceIntPtr dev, xXIScrollInfo *info, int axisnumber)
|
||||||
ErrorF("[Xi] Unknown scroll type %d. This is a bug.\n", axis->scroll.type);
|
ErrorF("[Xi] Unknown scroll type %d. This is a bug.\n", axis->scroll.type);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
info->increment.integral = (int)axis->scroll.increment;
|
info->increment = double_to_fp3232(axis->scroll.increment);
|
||||||
info->increment.frac = (unsigned int)(axis->scroll.increment * (1UL << 16) * (1UL << 16));
|
|
||||||
info->sourceid = v->sourceid;
|
info->sourceid = v->sourceid;
|
||||||
|
|
||||||
info->flags = 0;
|
info->flags = 0;
|
||||||
|
|
|
@ -49,6 +49,7 @@
|
||||||
#include "inpututils.h"
|
#include "inpututils.h"
|
||||||
#include "xiquerydevice.h"
|
#include "xiquerydevice.h"
|
||||||
#include "xkbsrv.h"
|
#include "xkbsrv.h"
|
||||||
|
#include "inpututils.h"
|
||||||
|
|
||||||
|
|
||||||
static int countValuators(DeviceEvent *ev, int *first);
|
static int countValuators(DeviceEvent *ev, int *first);
|
||||||
|
@ -686,9 +687,7 @@ eventToDeviceEvent(DeviceEvent *ev, xEvent **xi)
|
||||||
if (BitIsOn(ev->valuators.mask, i))
|
if (BitIsOn(ev->valuators.mask, i))
|
||||||
{
|
{
|
||||||
SetBit(ptr, i);
|
SetBit(ptr, i);
|
||||||
axisval->integral = trunc(ev->valuators.data[i]);
|
*axisval = double_to_fp3232(ev->valuators.data[i]);
|
||||||
axisval->frac = (ev->valuators.data[i] - axisval->integral) *
|
|
||||||
(1 << 16) * (1 << 16);
|
|
||||||
axisval++;
|
axisval++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -732,13 +731,8 @@ eventToRawEvent(RawDeviceEvent *ev, xEvent **xi)
|
||||||
if (BitIsOn(ev->valuators.mask, i))
|
if (BitIsOn(ev->valuators.mask, i))
|
||||||
{
|
{
|
||||||
SetBit(ptr, i);
|
SetBit(ptr, i);
|
||||||
axisval->integral = trunc(ev->valuators.data[i]);
|
*axisval = double_to_fp3232(ev->valuators.data[i]);
|
||||||
axisval->frac = (ev->valuators.data[i] - axisval->integral) *
|
*axisval_raw = double_to_fp3232(ev->valuators.data_raw[i]);
|
||||||
(1 << 16) * (1 << 16);
|
|
||||||
axisval_raw->integral = trunc(ev->valuators.data_raw[i]);
|
|
||||||
axisval_raw->frac =
|
|
||||||
(ev->valuators.data_raw[i] - axisval_raw->integral) *
|
|
||||||
(1 << 16) * (1 << 16);
|
|
||||||
axisval++;
|
axisval++;
|
||||||
axisval_raw++;
|
axisval_raw++;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue