diff options
author | Alexander Bersenev <bay@hackerdom.ru> | 2019-06-17 22:56:43 +0500 |
---|---|---|
committer | Alexander Bersenev <bay@hackerdom.ru> | 2019-06-17 22:56:43 +0500 |
commit | a42ee93c10bf9a63c22e0642d6e51877fba8dae5 (patch) | |
tree | 5df9fddf322aa95a3cf7c156cc19951483742769 | |
parent | 3e38d823a162c21492ac243924325730d4ea61bf (diff) |
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: https://gitlab.freedesktop.org/xorg/lib/libxi/issues/10
-rw-r--r-- | src/XExtInt.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/XExtInt.c b/src/XExtInt.c index a35fcc6..ccd3238 100644 --- a/src/XExtInt.c +++ b/src/XExtInt.c @@ -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) { |