Stephan Kulow 2014-09-04 05:56:02 +00:00 committed by Git OBS Bridge
parent 74642d42fc
commit 5520ffd023
5 changed files with 221 additions and 0 deletions

View File

@ -0,0 +1,33 @@
From f1bce3bc17ebb99b1512b07499988538465c78a2 Mon Sep 17 00:00:00 2001
From: Allan Sandfeld Jensen <allan.jensen@digia.com>
Date: Thu, 21 Aug 2014 15:33:09 +0200
Subject: [PATCH] Avoid crash if querying device that has gone away
A device removed very fast after being inserted might disappear while
we are still seting it up. We must therefore check if we indeed still
get a matching device
Task-number: QTBUG-40820
Change-Id: I4372fb1932264e5799f37cea0d016795e28ebed6
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
---
src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
--- qtbase-opensource-src-5.3.1.orig/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ qtbase-opensource-src-5.3.1/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -328,10 +328,12 @@ XInput2DeviceData *QXcbConnection::devic
{
XInput2DeviceData *dev = m_touchDevices[id];
if (!dev) {
- int unused = 0;
+ int nrDevices = 0;
QTouchDevice::Capabilities caps = 0;
dev = new XInput2DeviceData;
- dev->xiDeviceInfo = XIQueryDevice(static_cast<Display *>(m_xlib_display), id, &unused);
+ dev->xiDeviceInfo = XIQueryDevice(static_cast<Display *>(m_xlib_display), id, &nrDevices);
+ if (nrDevices <= 0)
+ return 0;
int type = -1;
int maxTouchPoints = 1;
bool hasRelativeCoords = false;

View File

@ -0,0 +1,39 @@
From e98c461d43ea07c73898c93debe9285029ba0416 Mon Sep 17 00:00:00 2001
From: Joni Poikelin <joni.poikelin@digia.com>
Date: Thu, 12 Jun 2014 10:28:23 +0300
Subject: [PATCH] XCB: Fix leak with touch devices
Task-number: QTBUG-39596
Change-Id: I4225d5a1ab4939280640b35d30c283f056a56519
Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
---
src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index c296618..a574dca 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -228,6 +228,11 @@ void QXcbConnection::xi2SetupDevices()
void QXcbConnection::finalizeXInput2()
{
+ foreach (XInput2DeviceData *dev, m_touchDevices) {
+ if (dev->xiDeviceInfo)
+ XIFreeDeviceInfo(dev->xiDeviceInfo);
+ delete dev;
+ }
}
void QXcbConnection::xi2Select(xcb_window_t window)
@@ -393,6 +398,7 @@ XInput2DeviceData *QXcbConnection::deviceForId(int id)
m_touchDevices[id] = dev;
} else {
m_touchDevices.remove(id);
+ XIFreeDeviceInfo(dev->xiDeviceInfo);
delete dev;
dev = 0;
}
--
1.8.4.5

View File

@ -0,0 +1,128 @@
From 19d289ab1b5bde3e136765e5432b5c7d004df3a4 Mon Sep 17 00:00:00 2001
From: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Date: Tue, 20 May 2014 09:57:39 +0200
Subject: [PATCH] Listen to touch events on the master device instead of slave.
Listening to touch events on the master prevents pointer emulation
events from being generated, alleviating the need to grab.
Grabbing on the slave device is buggy, and breaks pointer emulation
on all current servers that support XInput 2.2 due to a bug in the
server, and will also grab unwanted touch events.
For reference, see https://bugs.freedesktop.org/show_bug.cgi?id=78345
Reverts 2c65b78b400ec27e6e559829b9a970dca2df6669. The idea of
enabling each touchscreen separately was introduced in
4dbf574b7acb7ae8f852219700afa95f8d568f0e; that aspect is also
reverted.
Change-Id: I30d36397aa4ff2fb7a8ad2bbb94c2a13abd472b4
Task-number: QTBUG-38625
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
---
src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 49 +++++++-----------------
1 file changed, 13 insertions(+), 36 deletions(-)
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index a574dca..cf809b3 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -251,14 +251,13 @@ void QXcbConnection::xi2Select(xcb_window_t window)
XIEventMask mask;
mask.mask_len = sizeof(bitMask);
mask.mask = xiBitMask;
- // Enable each touchscreen
- foreach (XInput2DeviceData *dev, m_touchDevices) {
- mask.deviceid = dev->xiDeviceInfo->deviceid;
+ if (!m_touchDevices.isEmpty()) {
+ mask.deviceid = XIAllMasterDevices;
Status result = XISelectEvents(xDisplay, window, &mask, 1);
- // If we have XInput >= 2.2 and successfully enable a touchscreen, then
- // it will provide touch only. In most other cases, there will be
- // emulated mouse events from the driver. If not, then Qt must do its
- // own mouse emulation to enable interaction with mouse-oriented QWidgets.
+ // If we select for touch events on the master pointer, XInput2
+ // will not synthesize mouse events. This means Qt must do it,
+ // which is also preferable, since Qt can control better when
+ // to do so.
if (m_xi2Minor >= 2 && result == Success)
has_touch_without_mouse_emulation = true;
}
@@ -272,10 +271,10 @@ void QXcbConnection::xi2Select(xcb_window_t window)
// similar handlers useless and we have no intention to infect
// all the pure xcb code with Xlib-based XI2.
if (!m_tabletData.isEmpty()) {
- unsigned int tabletBitMask = bitMask;
+ unsigned int tabletBitMask;
unsigned char *xiTabletBitMask = reinterpret_cast<unsigned char *>(&tabletBitMask);
QVector<XIEventMask> xiEventMask(m_tabletData.count());
- tabletBitMask |= XI_ButtonPressMask;
+ tabletBitMask = XI_ButtonPressMask;
tabletBitMask |= XI_ButtonReleaseMask;
tabletBitMask |= XI_MotionMask;
tabletBitMask |= XI_PropertyEventMask;
@@ -294,24 +293,18 @@ void QXcbConnection::xi2Select(xcb_window_t window)
// Enable each scroll device
if (!m_scrollingDevices.isEmpty()) {
QVector<XIEventMask> xiEventMask(m_scrollingDevices.size());
- unsigned int scrollBitMask = 0;
+ unsigned int scrollBitMask;
unsigned char *xiScrollBitMask = reinterpret_cast<unsigned char *>(&scrollBitMask);
+
scrollBitMask = XI_MotionMask;
scrollBitMask |= XI_ButtonReleaseMask;
- bitMask |= XI_MotionMask;
- bitMask |= XI_ButtonReleaseMask;
int i=0;
Q_FOREACH (const ScrollingDevice& scrollingDevice, m_scrollingDevices) {
if (tabletDevices.contains(scrollingDevice.deviceId))
continue; // All necessary events are already captured.
xiEventMask[i].deviceid = scrollingDevice.deviceId;
- if (m_touchDevices.contains(scrollingDevice.deviceId)) {
- xiEventMask[i].mask_len = sizeof(bitMask);
- xiEventMask[i].mask = xiBitMask;
- } else {
- xiEventMask[i].mask_len = sizeof(scrollBitMask);
- xiEventMask[i].mask = xiScrollBitMask;
- }
+ xiEventMask[i].mask_len = sizeof(scrollBitMask);
+ xiEventMask[i].mask = xiScrollBitMask;
i++;
}
XISelectEvents(xDisplay, window, xiEventMask.data(), i);
@@ -458,7 +451,7 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event)
fixed1616ToReal(xiDeviceEvent->root_x), fixed1616ToReal(xiDeviceEvent->root_y) );
if (QXcbWindow *platformWindow = platformWindowFromId(xiDeviceEvent->event)) {
- XInput2DeviceData *dev = deviceForId(xiEvent->deviceid);
+ XInput2DeviceData *dev = deviceForId(xiDeviceEvent->sourceid);
Q_ASSERT(dev);
const bool firstTouch = m_touchPoints.isEmpty();
if (xiEvent->evtype == XI_TouchBegin) {
@@ -563,22 +556,6 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event)
qDebug() << " touchpoint " << touchPoint.id << " state " << touchPoint.state << " pos norm " << touchPoint.normalPosition <<
" area " << touchPoint.area << " pressure " << touchPoint.pressure;
QWindowSystemInterface::handleTouchEvent(platformWindow->window(), xiEvent->time, dev->qtTouchDevice, m_touchPoints.values());
- if (has_touch_without_mouse_emulation) {
- // We need to grab the touch event to prevent mouse emulation.
- if (xiEvent->evtype == XI_TouchBegin) {
- XIEventMask xieventmask;
- unsigned int bitMask = 0;
- unsigned char *xiBitMask = reinterpret_cast<unsigned char *>(&bitMask);
- xieventmask.deviceid = xiEvent->deviceid;
- xieventmask.mask = xiBitMask;
- xieventmask.mask_len = sizeof(bitMask);
- bitMask |= XI_TouchBeginMask;
- bitMask |= XI_TouchUpdateMask;
- bitMask |= XI_TouchEndMask;
- XIGrabDevice(static_cast<Display *>(m_xlib_display), xiEvent->deviceid, platformWindow->winId(), xiEvent->time, None, GrabModeAsync, GrabModeAsync, true, &xieventmask);
- } else if (xiEvent->evtype == XI_TouchEnd)
- XIUngrabDevice(static_cast<Display *>(m_xlib_display), xiEvent->deviceid, xiEvent->time);
- }
if (touchPoint.state == Qt::TouchPointReleased)
// If a touchpoint was released, we can forget it, because the ID won't be reused.
m_touchPoints.remove(touchPoint.id);
--
1.8.4.5

View File

@ -1,3 +1,15 @@
-------------------------------------------------------------------
Fri Aug 29 06:57:03 UTC 2014 - mlin@suse.com
- Added upstream patches for bnc#890168
* libqt5-fix-leak-with-touch-devices-in-xcb.patch, QTBUG-39596
** fixed a leak what did not free m_touchDevices.
* libqt5-listen-to-touch-events-on-the-master-device.patch, QTBUG-38625
** listen to touch events on the master device instead of slave, was also
affects by fdo#78345
* libqt5-avoid-crash-during-querying-device.patch, QTBUG-40820
** avoid crashes if querying device that has gone away
-------------------------------------------------------------------
Thu Jul 3 19:17:01 UTC 2014 - hrvoje.senjan@gmail.com

View File

@ -69,6 +69,12 @@ Patch1004: 0005-Translate-Super-Hyper-keys-to-MetaModifier.patch
Patch2000: 00010-Replace-the-const-QString-global-static-with-a-QStri.patch
# PATCH-FIX-UPSTREAM 00011-Use-correct-signal-name-when-disconnecting.patch
Patch2001: 00011-Use-correct-signal-name-when-disconnecting.patch
# PATCH-FIX-UPSTREAM libqt5-fix-leak-with-touch-devices-in-xcb.patch -- QTBUG-39596
Patch2002: libqt5-fix-leak-with-touch-devices-in-xcb.patch
# PATCH-FIX-UPSTREAM libqt5-listen-to-touch-events-on-the-master-device.patch -- QTBUG-38625
Patch2003: libqt5-listen-to-touch-events-on-the-master-device.patch
# PATCH-FIX-UPSTREAM libqt5-avoid-crash-during-querying-device.patch -- QTBUG-40820
Patch2004: libqt5-avoid-crash-during-querying-device.patch
BuildRequires: alsa-devel
BuildRequires: cups-devel
BuildRequires: fdupes
@ -165,6 +171,9 @@ handling.
%patch1004 -p1
%patch2000 -p1
%patch2001 -p1
%patch2002 -p1
%patch2003 -p1
%patch2004 -p1
# be sure not to use them
rm -r src/3rdparty/{libjpeg,freetype,libpng,zlib}