summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb
diff options
context:
space:
mode:
authorGatis Paeglis <gatis.paeglis@qt.io>2017-12-04 16:00:16 +0100
committerGatis Paeglis <gatis.paeglis@qt.io>2017-12-04 16:20:33 +0000
commitbcd0e43eb98885f0562efddee45b11ca7ec1d546 (patch)
treecbb2345bb44955ac0bbf80ced0fefe3cc993c804 /src/plugins/platforms/xcb
parent22ec92a201beb9ec4bb6a7e21fcfdc8cd9b884f9 (diff)
xcb: fix regression with missing XI_PropertyEvent
Wacom stylus proximity detection had stopped working: it was not detecting which type of tool is in use, so all stylus types acted as a generic drawing stylus. Selecting XI_PropertyEvent on a root window fixes the problem. There is nothing in the XI2 specification that says that this property would not be supported on non-root windows. Possibly it is bug in the X server. Anyways, selecting XI_PropertyEvent on a root window in this case actually is better. Property event contains a global state information, there is nothing window specific in it, so there is no need to select it for every native sub-window. It is worth noting that XI_HierarchyChanged also seems to work only when selected on the root window (according to my testing results). And on XI2 author's blog post about XI_HierarchyChanged it says [1]: "These events are sent to all windows, so it doesn't really matter where you register. The traditional approach is to register on the root window." This kind of further confirms that it might be bug in X Server's implementation. [1] http://who-t.blogspot.no/2009/06/xi2-recipies-part-2.html Task-number: QTBUG-64911 Change-Id: I8582675bf835239932e23f4596966dc167495e30 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/plugins/platforms/xcb')
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp30
1 files changed, 18 insertions, 12 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index f90f189146..ce6dd7c035 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -100,6 +100,7 @@ void QXcbConnection::xi2SelectStateEvents()
XIEventMask xiEventMask;
bitMask = XI_HierarchyChangedMask;
bitMask |= XI_DeviceChangedMask;
+ bitMask |= XI_PropertyEventMask;
xiEventMask.deviceid = XIAllDevices;
xiEventMask.mask_len = sizeof(bitMask);
xiEventMask.mask = xiBitMask;
@@ -121,7 +122,6 @@ void QXcbConnection::xi2SelectDeviceEvents(xcb_window_t window)
// core enter/leave events will be ignored in this case.
bitMask |= XI_EnterMask;
bitMask |= XI_LeaveMask;
- bitMask |= XI_PropertyEventMask;
#ifdef XCB_USE_XINPUT22
if (isAtLeastXI22()) {
bitMask |= XI_TouchBeginMask;
@@ -378,24 +378,25 @@ void QXcbConnection::xi2SelectDeviceEventsCompatibility(xcb_window_t window)
unsigned int mask = 0;
unsigned char *bitMask = reinterpret_cast<unsigned char *>(&mask);
- mask |= XI_PropertyEventMask;
+ Display *dpy = static_cast<Display *>(m_xlib_display);
+
#ifdef XCB_USE_XINPUT22
if (isAtLeastXI22()) {
mask |= XI_TouchBeginMask;
mask |= XI_TouchUpdateMask;
mask |= XI_TouchEndMask;
+
+ XIEventMask xiMask;
+ xiMask.mask_len = sizeof(mask);
+ xiMask.mask = bitMask;
+ xiMask.deviceid = XIAllMasterDevices;
+ Status result = XISelectEvents(dpy, window, &xiMask, 1);
+ if (result == Success)
+ QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(false);
+ else
+ qCDebug(lcQpaXInput, "failed to select events, window %x, result %d", window, result);
}
#endif
- XIEventMask xiMask;
- xiMask.mask_len = sizeof(mask);
- xiMask.mask = bitMask;
- xiMask.deviceid = XIAllMasterDevices;
- Display *dpy = static_cast<Display *>(m_xlib_display);
- Status result = XISelectEvents(dpy, window, &xiMask, 1);
- if (result == Success)
- QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(false);
- else
- qCDebug(lcQpaXInput, "failed to select events, window %x, result %d", window, result);
mask = XI_ButtonPressMask;
mask |= XI_ButtonReleaseMask;
@@ -434,6 +435,11 @@ void QXcbConnection::xi2SelectDeviceEventsCompatibility(xcb_window_t window)
XISelectEvents(dpy, window, xiEventMask.data(), i);
}
#endif
+
+#if !QT_CONFIG(tabletevent) && !defined(XCB_USE_XINPUT21)
+ Q_UNUSED(bitMask);
+ Q_UNUSED(dpy);
+#endif
}
QXcbConnection::TouchDeviceData *QXcbConnection::touchDeviceForId(int id)