The macro FP3232_TO_DOUBLE always ignores the fractional part of number
Submitted by bay
Assigned to Xorg Project Team
Link to original bug (#106663)
Description
Hello,
The FP3232_TO_DOUBLE(x) is declared in XExtInt.c as: #define FP3232_TO_DOUBLE(x) ((double) (x).integral + (x).frac / (1ULL << 32))
The (x).frac is integer and (1ULL << 32) is also integer, to the result is also integer and zero.
The proposed fix is to convert (x).frac to double: #define FP3232_TO_DOUBLE(x) ((double) (x).integral + (double) (x).frac / (1ULL << 32))
Also the fractional values are ignored in copy_classes function and there is a /* FIXME: fractional parts */ there.
The fix is trivial:
Instead of: cls_lib->min = cls_wire->min.integral; cls_lib->max = cls_wire->max.integral; cls_lib->value = cls_wire->value.integral; /* FIXME: fractional parts */
Could be replaced by: 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);
This fixes glitchy scrolling in Qt applications when the application was just activated or was scrolled in the backgroud. Qt is using XIQueryDevice call to synchronize internal scroll location with an actual one (QXcbConnection::xi2HandleDeviceChangedEvent and QXcbConnection::updateScrollingDevice functions in http://code.qt.io/cgit/qt/qtbase.git/tree/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp)
The patch is attached
Best, Alexander Bersenev
Version: git