libqt5-qtbase/big-endian-scroll.patch

92 lines
4.1 KiB
Diff
Raw Normal View History

From 2c828bf5d4a0332ecece29e4513ae4b0a4a78d08 Mon Sep 17 00:00:00 2001
From: q66 <daniel@octaforge.org>
Date: Mon, 3 Apr 2023 14:36:51 +0200
Subject: [PATCH] Fix scrolling on big endian platforms
The mask is defined as an array of 4*CARD8, but libxcb and Qt treat
it as array of CARD32, but that only works on little endian platforms.
Qt 6 switched to the array of 4*CARD8 representation, but that change is rather
complex for a backport but fortunately also not needed because 5.x only uses
32 bits. Use a little-endian CARD32 to have the same effect as 4*CARD8.
The initial diff is from https://github.com/void-linux/void-packages/pull/13901,
which is assumed to be the original source.
Fabian Vogt <fvogt@suse.de> added a patch header, description and also fixed
QXcbConnection::xi2SetMouseGrabEnabled.
Fixes: https://bugreports.qt.io/browse/QTBUG-105157
---
src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index 27a2526df..cda10b39a 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -43,6 +43,7 @@
#include "qxcbwindow.h"
#include "qtouchdevice.h"
#include "QtCore/qmetaobject.h"
+#include "QtCore/qendian.h"
#include <qpa/qwindowsysteminterface_p.h>
#include <QDebug>
#include <cmath>
@@ -66,6 +67,7 @@ void QXcbConnection::xi2SelectStateEvents()
xiEventMask.mask = XCB_INPUT_XI_EVENT_MASK_HIERARCHY;
xiEventMask.mask |= XCB_INPUT_XI_EVENT_MASK_DEVICE_CHANGED;
xiEventMask.mask |= XCB_INPUT_XI_EVENT_MASK_PROPERTY;
+ xiEventMask.mask = qToLittleEndian(xiEventMask.mask);
xcb_input_xi_select_events(xcb_connection(), rootWindow(), 1, &xiEventMask.header);
}
@@ -90,7 +92,7 @@ void QXcbConnection::xi2SelectDeviceEvents(xcb_window_t window)
qt_xcb_input_event_mask_t mask;
mask.header.deviceid = XCB_INPUT_DEVICE_ALL_MASTER;
mask.header.mask_len = 1;
- mask.mask = bitMask;
+ mask.mask = qToLittleEndian(bitMask);
xcb_void_cookie_t cookie =
xcb_input_xi_select_events_checked(xcb_connection(), window, 1, &mask.header);
xcb_generic_error_t *error = xcb_request_check(xcb_connection(), cookie);
@@ -363,7 +365,7 @@ void QXcbConnection::xi2SelectDeviceEventsCompatibility(xcb_window_t window)
qt_xcb_input_event_mask_t xiMask;
xiMask.header.deviceid = XCB_INPUT_DEVICE_ALL_MASTER;
xiMask.header.mask_len = 1;
- xiMask.mask = mask;
+ xiMask.mask = qToLittleEndian(mask);
xcb_void_cookie_t cookie =
xcb_input_xi_select_events_checked(xcb_connection(), window, 1, &xiMask.header);
@@ -390,7 +392,7 @@ void QXcbConnection::xi2SelectDeviceEventsCompatibility(xcb_window_t window)
tabletDevices.insert(deviceId);
xiEventMask[i].header.deviceid = deviceId;
xiEventMask[i].header.mask_len = 1;
- xiEventMask[i].mask = mask;
+ xiEventMask[i].mask = qToLittleEndian(mask);
}
xcb_input_xi_select_events(xcb_connection(), window, nrTablets, &(xiEventMask.data()->header));
}
@@ -406,7 +408,7 @@ void QXcbConnection::xi2SelectDeviceEventsCompatibility(xcb_window_t window)
#endif
xiEventMask[i].header.deviceid = scrollingDevice.deviceId;
xiEventMask[i].header.mask_len = 1;
- xiEventMask[i].mask = mask;
+ xiEventMask[i].mask = qToLittleEndian(mask);
i++;
}
xcb_input_xi_select_events(xcb_connection(), window, i, &(xiEventMask.data()->header));
@@ -826,6 +828,8 @@ bool QXcbConnection::xi2SetMouseGrabEnabled(xcb_window_t w, bool grab)
| XCB_INPUT_XI_EVENT_MASK_TOUCH_UPDATE
| XCB_INPUT_XI_EVENT_MASK_TOUCH_END;
+ mask = qToLittleEndian(mask);
+
for (int id : qAsConst(m_xiMasterPointerIds)) {
xcb_generic_error_t *error = nullptr;
auto cookie = xcb_input_xi_grab_device(xcb_connection(), w, XCB_CURRENT_TIME, XCB_CURSOR_NONE, id,
--
2.40.1