From 9b7809a43ee0add8c11d3387b73a01bfdedd0043 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Tue, 6 Mar 2018 18:05:02 +0300 Subject: [PATCH] xcb: Fix FP1616 to int conversion Divide the whole FP1616 value by 0x10000 instead of dividing the integer part by 0x10000 and the fractional part by 0xFFFF. It also makes fixed1616ToInt() consistent with fixed1616ToReal(), see 7d3f353a5bd573dc0e72f7f55c70212a6b3837fa. Change-Id: Id76025028c926872b002ef0a1ca8a8bdc2de3e1e Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index e9a6e536a7..fed096f311 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -2333,7 +2333,7 @@ void QXcbWindow::handleMotionNotifyEvent(const xcb_motion_notify_event_t *event) #if QT_CONFIG(xinput2) static inline int fixed1616ToInt(FP1616 val) { - return int((qreal(val >> 16)) + (val & 0xFFFF) / (qreal)0xFFFF); + return int(qreal(val) / 0x10000); } void QXcbWindow::handleXIMouseEvent(xcb_ge_event_t *event, Qt::MouseEventSource source)