Commit a42ee93c authored by Alexander Bersenev's avatar Alexander Bersenev

Fix the FIXME in XIValuatorClass case of copy_classes function in XExtInt.c

In addition fix FP3232_TO_DOUBLE macro to correctly compute the fractional
part.

This fixes glitchy scrolling in Qt applications when the application was
just activated or was scrolled in the backgroud. Qt uses XIQueryDevice
call to synchronize internal scroll location with an actual one.

Bug: #10
parent 3e38d823
......@@ -1616,6 +1616,8 @@ size_classes(xXIAnyInfo* from, int nclasses)
return len;
}
#define FP3232_TO_DOUBLE(x) ((double) (x).integral + (double) (x).frac / (1ULL << 32))
/* Copy classes from any into to->classes and return the number of bytes
* copied. Memory layout of to->classes is
* [clsptr][clsptr][clsptr][classinfo][classinfo]...
......@@ -1724,10 +1726,9 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int *nclasses)
cls_lib->number = cls_wire->number;
cls_lib->label = cls_wire->label;
cls_lib->resolution = cls_wire->resolution;
cls_lib->min = cls_wire->min.integral;
cls_lib->max = cls_wire->max.integral;
cls_lib->value = cls_wire->value.integral;
/* FIXME: fractional parts */
cls_lib->min = FP3232_TO_DOUBLE(cls_wire->min);
cls_lib->max = FP3232_TO_DOUBLE(cls_wire->max);
cls_lib->value = FP3232_TO_DOUBLE(cls_wire->value);
cls_lib->mode = cls_wire->mode;
to->classes[cls_idx++] = any_lib;
......@@ -2000,8 +2001,6 @@ wireToTouchOwnershipEvent(xXITouchOwnershipEvent *in,
return 1;
}
#define FP3232_TO_DOUBLE(x) ((double) (x).integral + (x).frac / (1ULL << 32))
static int
wireToBarrierEvent(xXIBarrierEvent *in, XGenericEventCookie *cookie)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment