[PATCH libXi] Fix XIScrollClass increment value on 32-bit machines

Chase Douglas chase.douglas at canonical.com
Wed Mar 7 14:52:54 PST 2012


This fixes scroll class increment values on 32-bit machines. Performing
1UL << 32 shifts the bit off the end of a 32-bit unsigned long value. By
expanding to 1ULL, we have the full 64-bits of an unsigned long long
including on 32-bit machines.

Before this change, xinput list --long would output scroll increment
values of -nan.

Signed-off-by: Chase Douglas <chase.douglas at canonical.com>
---
This is likely the cause of bad scrolling behavior in GTK+ master.

 src/XExtInt.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/XExtInt.c b/src/XExtInt.c
index 7694f06..89c0894 100644
--- a/src/XExtInt.c
+++ b/src/XExtInt.c
@@ -1695,7 +1695,7 @@ copy_classes(XIDeviceInfo* to, xXIAnyInfo* from, int *nclasses)
                     cls_lib->scroll_type= cls_wire->scroll_type;
                     cls_lib->flags      = cls_wire->flags;
                     cls_lib->increment  = cls_wire->increment.integral;
-                    cls_lib->increment += (unsigned int)cls_wire->increment.frac/(double)(1UL << 32);
+                    cls_lib->increment += (unsigned int)cls_wire->increment.frac/(double)(1ULL << 32);
 
                     to->classes[cls_idx++] = any_lib;
                 }
-- 
1.7.9



More information about the xorg-devel mailing list