summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-01-06 15:26:01 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-01-06 15:26:02 +0100
commitc8046f7d42b565e7fc02aa6228c72eee5ab51605 (patch)
treeeee9ea01acd97d156a9c3466251d3023feef9d82 /src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
parentae56140b50bccde9e6cfdc6757f345c989ccd755 (diff)
parentffac6ee2673a573a9db4f75a89c4c53251fa1304 (diff)
Merge remote-tracking branch 'origin/stable' into dev
Diffstat (limited to 'src/plugins/platforms/xcb/qxcbconnection_xi2.cpp')
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index 198e323873..9b6d234375 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -432,6 +432,22 @@ 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);