Timo Jyrinki has proposed merging 
lp:~timo-jyrinki/kubuntu-packaging/qtbase-opensource-src_touch_xinput2_use_master_device
 into lp:~kubuntu-packagers/kubuntu-packaging/qtbase-opensource-src.

Commit message:
* debian/patches/xi2-use-master-device.patch:
  - Make xi2 select events on master device instead of slaves.
    (LP: #1307701)

Requested reviews:
  Kubuntu Packagers (kubuntu-packagers)

For more details, see:
https://code.launchpad.net/~timo-jyrinki/kubuntu-packaging/qtbase-opensource-src_touch_xinput2_use_master_device/+merge/219175
-- 
https://code.launchpad.net/~timo-jyrinki/kubuntu-packaging/qtbase-opensource-src_touch_xinput2_use_master_device/+merge/219175
Your team Kubuntu Packagers is requested to review the proposed merge of 
lp:~timo-jyrinki/kubuntu-packaging/qtbase-opensource-src_touch_xinput2_use_master_device
 into lp:~kubuntu-packagers/kubuntu-packaging/qtbase-opensource-src.
=== modified file 'debian/changelog'
--- debian/changelog	2014-04-28 15:54:23 +0000
+++ debian/changelog	2014-05-12 11:26:25 +0000
@@ -1,3 +1,11 @@
+qtbase-opensource-src (5.2.1+dfsg-1ubuntu16) utopic; urgency=medium
+
+  * debian/patches/xi2-use-master-device.patch:
+    - Make xi2 select events on master device instead of slaves.
+      (LP: #1307701)
+
+ -- Maarten Lankhorst <[email protected]>  Tue, 06 May 2014 13:14:17 +0000
+
 qtbase-opensource-src (5.2.1+dfsg-1ubuntu15) utopic; urgency=medium
 
   [ Dmitry Shachnev ]

=== modified file 'debian/patches/series'
--- debian/patches/series	2014-04-23 08:37:26 +0000
+++ debian/patches/series	2014-05-12 11:26:25 +0000
@@ -30,3 +30,4 @@
 HarfBuzz-NG-Hide-characters-that-should-normally-be-.patch
 When-looking-up-the-window-hierarchy-stop-at-foreign.patch
 Add_better_support_for_keymap_update_handling.patch
+xi2-use-master-device.patch

=== added file 'debian/patches/xi2-use-master-device.patch'
--- debian/patches/xi2-use-master-device.patch	1970-01-01 00:00:00 +0000
+++ debian/patches/xi2-use-master-device.patch	2014-05-12 11:26:25 +0000
@@ -0,0 +1,81 @@
+Description: qt5 use xi2 master device instead of selecting events on all slave devices separately.
+Author: Maarten Lankhorst <[email protected]>
+
+For LP: #1307701
+
+Selecting events from the master device has the advantage that we don't need to
+grab the touch event to prevent mouse emulation to our window.
+
+---
+--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
++++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+@@ -84,6 +84,7 @@
+             m_xi2Enabled = XIQueryVersion(xDisplay, &xiMajor, &m_xi2Minor) != BadRequest;
+         } else {
+             m_xi2Enabled = true;
++            has_touch_without_mouse_emulation = true;
+         }
+         if (m_xi2Enabled) {
+             if (Q_UNLIKELY(debug_xinput_devices))
+@@ -180,17 +181,9 @@
+     XIEventMask mask;
+     mask.mask_len = sizeof(bitMask);
+     mask.mask = xiBitMask;
+-    // Enable each touchscreen
+-    foreach (XInput2DeviceData *dev, m_touchDevices.values()) {
+-        mask.deviceid = dev->xiDeviceInfo->deviceid;
+-        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 (m_xi2Minor >= 2 && result == Success)
+-            has_touch_without_mouse_emulation = true;
+-    }
++    mask.deviceid = XIAllMasterDevices;
++
++    Status result = XISelectEvents(xDisplay, window, &mask, 1);
+ #endif // XCB_USE_XINPUT22
+ 
+ #ifndef QT_NO_TABLETEVENT
+@@ -201,7 +194,7 @@
+     // all the pure xcb code with Xlib-based XI2.
+     if (!m_tabletData.isEmpty()) {
+         QVector<XIEventMask> xiEventMask(m_tabletData.count());
+-        bitMask |= XI_ButtonPressMask;
++        bitMask = XI_ButtonPressMask;
+         bitMask |= XI_ButtonReleaseMask;
+         bitMask |= XI_MotionMask;
+         bitMask |= XI_PropertyEventMask;
+@@ -329,7 +322,7 @@
+                     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) {
+@@ -434,22 +427,6 @@
+                     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);

-- 
kubuntu-devel mailing list
[email protected]
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/kubuntu-devel

Reply via email to