uint32_t id = tp.id();
uint32_t state = (tp.state() & 0xFFFF) | (sentPointCount << 16);
- uint32_t flags = tp.flags();
+ uint32_t flags = (tp.flags() & 0xFFFF) | (int(event->device()->capabilities()) << 16);
QPointF p = tp.pos() - surfacePos; // surface-relative
int x = toFixed(p.x());
mPointsLeft = 0;
mFlags = 0;
mMouseSourceId = -1;
+ mTouchDevice = 0;
mTouch = static_cast<struct wl_touch_extension *>(wl_display_bind(display->wl_display(), id, &wl_touch_extension_interface));
wl_touch_extension_add_listener(mTouch, &touch_listener, this);
+}
- QTouchDevice::Capabilities caps = QTouchDevice::Position
- | QTouchDevice::Area
- | QTouchDevice::Pressure
- | QTouchDevice::Velocity
- | QTouchDevice::RawPositions
- | QTouchDevice::NormalizedPosition;
+void QWaylandTouchExtension::registerDevice(int caps)
+{
mTouchDevice = new QTouchDevice;
mTouchDevice->setType(QTouchDevice::TouchScreen);
- mTouchDevice->setCapabilities(caps);
+ mTouchDevice->setCapabilities(QTouchDevice::Capabilities(caps));
QWindowSystemInterface::registerTouchDevice(mTouchDevice);
}
Q_ASSERT(sentPointCount > 0);
self->mPointsLeft = sentPointCount;
}
- tp.flags = QTouchEvent::TouchPoint::InfoFlags(int(flags));
+ tp.flags = QTouchEvent::TouchPoint::InfoFlags(int(flags & 0xFFFF));
+
+ if (!self->mTouchDevice)
+ self->registerDevice(flags >> 16);
tp.area = QRectF(0, 0, fromFixed(width), fromFixed(height));
// Got surface-relative coords but need a (virtual) screen position.