diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/client/qwaylandinputdevice.cpp | 11 | ||||
-rw-r--r-- | src/client/qwaylandinputdevice_p.h | 2 | ||||
-rw-r--r-- | src/client/qwaylandtabletv2.cpp | 22 | ||||
-rw-r--r-- | src/client/qwaylandtabletv2_p.h | 7 | ||||
-rw-r--r-- | src/client/qwaylandtouch.cpp | 11 | ||||
-rw-r--r-- | src/client/qwaylandtouch_p.h | 2 | ||||
-rw-r--r-- | src/compositor/compositor_api/qwaylandquickitem.cpp | 32 | ||||
-rw-r--r-- | src/compositor/extensions/qwaylandwlshellintegration.cpp | 8 | ||||
-rw-r--r-- | src/compositor/extensions/qwaylandxdgshellintegration.cpp | 8 | ||||
-rw-r--r-- | src/compositor/extensions/qwaylandxdgshellv5integration.cpp | 8 | ||||
-rw-r--r-- | src/compositor/extensions/qwaylandxdgshellv6integration.cpp | 8 | ||||
-rw-r--r-- | src/compositor/extensions/qwlqttouch.cpp | 4 |
12 files changed, 63 insertions, 60 deletions
diff --git a/src/client/qwaylandinputdevice.cpp b/src/client/qwaylandinputdevice.cpp index 1de2ef17c..af9458b44 100644 --- a/src/client/qwaylandinputdevice.cpp +++ b/src/client/qwaylandinputdevice.cpp @@ -73,7 +73,7 @@ #endif #include <QtGui/QGuiApplication> -#include <QtGui/QTouchDevice> +#include <QtGui/QPointingDevice> QT_BEGIN_NAMESPACE @@ -456,10 +456,11 @@ void QWaylandInputDevice::seat_capabilities(uint32_t caps) mTouch->init(get_touch()); if (!mTouchDevice) { - mTouchDevice = new QTouchDevice; - mTouchDevice->setType(QTouchDevice::TouchScreen); - mTouchDevice->setCapabilities(QTouchDevice::Position); - QWindowSystemInterface::registerTouchDevice(mTouchDevice); + // TODO number of touchpoints, actual name and ID + mTouchDevice = new QPointingDevice(QLatin1String("some touchscreen"), 0, + QInputDevice::DeviceType::TouchScreen, QPointingDevice::PointerType::Finger, + QInputDevice::Capability::Position, 10, 0); + QWindowSystemInterface::registerInputDevice(mTouchDevice); } } else if (!(caps & WL_SEAT_CAPABILITY_TOUCH) && mTouch) { delete mTouch; diff --git a/src/client/qwaylandinputdevice_p.h b/src/client/qwaylandinputdevice_p.h index 448d0fce5..8e2dd184b 100644 --- a/src/client/qwaylandinputdevice_p.h +++ b/src/client/qwaylandinputdevice_p.h @@ -195,7 +195,7 @@ private: void seat_capabilities(uint32_t caps) override; void handleTouchPoint(int id, Qt::TouchPointState state, const QPointF &surfacePosition = QPoint()); - QTouchDevice *mTouchDevice = nullptr; + QPointingDevice *mTouchDevice = nullptr; friend class QWaylandTouchExtension; friend class QWaylandQtKeyExtension; diff --git a/src/client/qwaylandtabletv2.cpp b/src/client/qwaylandtabletv2.cpp index eb2e865f6..0f55aba9e 100644 --- a/src/client/qwaylandtabletv2.cpp +++ b/src/client/qwaylandtabletv2.cpp @@ -137,35 +137,35 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_done() case type::type_brush: case type::type_pencil: case type::type_pen: - m_pointerType = QTabletEvent::PointerType::Pen; + m_pointerType = QPointingDevice::PointerType::Pen; break; case type::type_eraser: - m_pointerType = QTabletEvent::PointerType::Eraser; + m_pointerType = QPointingDevice::PointerType::Eraser; break; case type::type_mouse: case type::type_lens: - m_pointerType = QTabletEvent::PointerType::Cursor; + m_pointerType = QPointingDevice::PointerType::Cursor; break; case type::type_finger: - m_pointerType = QTabletEvent::PointerType::UnknownPointer; + m_pointerType = QPointingDevice::PointerType::Unknown; break; } switch (m_toolType) { case type::type_airbrush: - m_tabletDevice = QTabletEvent::TabletDevice::Airbrush; + m_tabletDevice = QInputDevice::DeviceType::Airbrush; break; case type::type_brush: case type::type_pencil: case type::type_pen: case type::type_eraser: - m_tabletDevice = m_hasRotation ? QTabletEvent::TabletDevice::RotationStylus : QTabletEvent::TabletDevice::Stylus; + m_tabletDevice = QInputDevice::DeviceType::Stylus; break; case type::type_lens: - m_tabletDevice = QTabletEvent::TabletDevice::Puck; + m_tabletDevice = QInputDevice::DeviceType::Puck; break; case type::type_mouse: case type::type_finger: - m_tabletDevice = QTabletEvent::TabletDevice::NoDevice; + m_tabletDevice = QInputDevice::DeviceType::Unknown; break; } } @@ -261,7 +261,7 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_button(uint32_t serial, uint32_t b void QWaylandTabletToolV2::zwp_tablet_tool_v2_frame(uint32_t time) { if (m_pending.proximitySurface && !m_applied.proximitySurface) { - QWindowSystemInterface::handleTabletEnterProximityEvent(m_tabletDevice, m_pointerType, m_uid); + QWindowSystemInterface::handleTabletEnterProximityEvent(int(m_tabletDevice), int(m_pointerType), m_uid); m_applied.proximitySurface = m_pending.proximitySurface; } @@ -288,12 +288,12 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_frame(uint32_t time) qreal rotation = m_pending.rotation; int z = int(m_pending.distance); QWindowSystemInterface::handleTabletEvent(window, timestamp, localPosition, globalPosition, - m_tabletDevice, m_pointerType, buttons, pressure, + int(m_tabletDevice), int(m_pointerType), buttons, pressure, xTilt, yTilt, tangentialPressure, rotation, z, m_uid); } if (!m_pending.proximitySurface && m_applied.enteredSurface) { - QWindowSystemInterface::handleTabletLeaveProximityEvent(m_tabletDevice, m_pointerType, m_uid); + QWindowSystemInterface::handleTabletLeaveProximityEvent(int(m_tabletDevice), int(m_pointerType), m_uid); m_pending = State(); // Don't leave pressure etc. lying around when we enter the next surface } diff --git a/src/client/qwaylandtabletv2_p.h b/src/client/qwaylandtabletv2_p.h index 36dd42689..bf3c78f05 100644 --- a/src/client/qwaylandtabletv2_p.h +++ b/src/client/qwaylandtabletv2_p.h @@ -58,7 +58,8 @@ #include <QtCore/QObject> #include <QtCore/QPointer> #include <QtCore/QPointF> -#include <QtGui/QTabletEvent> +#include <QtGui/QPointingDevice> +#include <QtGui/QInputDevice> QT_BEGIN_NAMESPACE @@ -142,8 +143,8 @@ protected: private: // Static state (sent before done event) - QTabletEvent::PointerType m_pointerType = QTabletEvent::PointerType::UnknownPointer; - QTabletEvent::TabletDevice m_tabletDevice = QTabletEvent::TabletDevice::NoDevice; + QPointingDevice::PointerType m_pointerType = QPointingDevice::PointerType::Unknown; + QInputDevice::DeviceType m_tabletDevice = QInputDevice::DeviceType::Unknown; type m_toolType = type_pen; bool m_hasRotation = false; quint64 m_uid = 0; diff --git a/src/client/qwaylandtouch.cpp b/src/client/qwaylandtouch.cpp index 17c41fa8d..06fa822a3 100644 --- a/src/client/qwaylandtouch.cpp +++ b/src/client/qwaylandtouch.cpp @@ -42,7 +42,7 @@ #include "qwaylanddisplay_p.h" #include "qwaylandsurface_p.h" -#include <QtGui/QTouchDevice> +#include <QtGui/QPointingDevice> QT_BEGIN_NAMESPACE @@ -61,10 +61,11 @@ QWaylandTouchExtension::QWaylandTouchExtension(QWaylandDisplay *display, uint32_ void QWaylandTouchExtension::registerDevice(int caps) { - mTouchDevice = new QTouchDevice; - mTouchDevice->setType(QTouchDevice::TouchScreen); - mTouchDevice->setCapabilities(QTouchDevice::Capabilities(caps)); - QWindowSystemInterface::registerTouchDevice(mTouchDevice); + // TODO number of touchpoints, actual name and ID + mTouchDevice = new QPointingDevice(QLatin1String("some touchscreen"), 0, + QInputDevice::DeviceType::TouchScreen, QPointingDevice::PointerType::Finger, + QInputDevice::Capabilities(caps), 10, 0); + QWindowSystemInterface::registerInputDevice(mTouchDevice); } static inline qreal fromFixed(int f) diff --git a/src/client/qwaylandtouch_p.h b/src/client/qwaylandtouch_p.h index 93a829e21..444e63fac 100644 --- a/src/client/qwaylandtouch_p.h +++ b/src/client/qwaylandtouch_p.h @@ -95,7 +95,7 @@ private: QList<QWindowSystemInterface::TouchPoint> mTouchPoints; QList<QWindowSystemInterface::TouchPoint> mPrevTouchPoints; - QTouchDevice *mTouchDevice = nullptr; + QPointingDevice *mTouchDevice = nullptr; uint32_t mTimestamp; int mPointsLeft; uint32_t mFlags; diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp index 3e069d9a9..45431cfa1 100644 --- a/src/compositor/compositor_api/qwaylandquickitem.cpp +++ b/src/compositor/compositor_api/qwaylandquickitem.cpp @@ -480,7 +480,7 @@ void QWaylandQuickItem::mousePressEvent(QMouseEvent *event) return; } - if (!inputRegionContains(event->localPos())) { + if (!inputRegionContains(event->position())) { event->ignore(); return; } @@ -490,9 +490,9 @@ void QWaylandQuickItem::mousePressEvent(QMouseEvent *event) if (d->focusOnClick) takeFocus(seat); - seat->sendMouseMoveEvent(d->view.data(), mapToSurface(event->localPos()), event->windowPos()); + seat->sendMouseMoveEvent(d->view.data(), mapToSurface(event->position()), event->scenePosition()); seat->sendMousePressEvent(event->button()); - d->hoverPos = event->localPos(); + d->hoverPos = event->position(); } /*! @@ -507,21 +507,21 @@ void QWaylandQuickItem::mouseMoveEvent(QMouseEvent *event) if (d->isDragging) { QWaylandQuickOutput *currentOutput = qobject_cast<QWaylandQuickOutput *>(view()->output()); //TODO: also check if dragging onto other outputs - QWaylandQuickItem *targetItem = qobject_cast<QWaylandQuickItem *>(currentOutput->pickClickableItem(mapToScene(event->localPos()))); + QWaylandQuickItem *targetItem = qobject_cast<QWaylandQuickItem *>(currentOutput->pickClickableItem(mapToScene(event->position()))); QWaylandSurface *targetSurface = targetItem ? targetItem->surface() : nullptr; if (targetSurface) { - QPointF position = mapToItem(targetItem, event->localPos()); + QPointF position = mapToItem(targetItem, event->position()); QPointF surfacePosition = targetItem->mapToSurface(position); seat->drag()->dragMove(targetSurface, surfacePosition); } } else #endif // QT_CONFIG(draganddrop) { - seat->sendMouseMoveEvent(d->view.data(), mapToSurface(event->localPos()), event->windowPos()); - d->hoverPos = event->localPos(); + seat->sendMouseMoveEvent(d->view.data(), mapToSurface(event->position()), event->scenePosition()); + d->hoverPos = event->position(); } } else { - emit mouseMove(event->windowPos()); + emit mouseMove(event->scenePosition()); event->ignore(); } } @@ -555,14 +555,14 @@ void QWaylandQuickItem::mouseReleaseEvent(QMouseEvent *event) void QWaylandQuickItem::hoverEnterEvent(QHoverEvent *event) { Q_D(QWaylandQuickItem); - if (!inputRegionContains(event->posF())) { + if (!inputRegionContains(event->position())) { event->ignore(); return; } if (d->shouldSendInputEvents()) { QWaylandSeat *seat = compositor()->seatFor(event); - seat->sendMouseMoveEvent(d->view.data(), event->posF(), mapToScene(event->posF())); - d->hoverPos = event->posF(); + seat->sendMouseMoveEvent(d->view.data(), event->position(), mapToScene(event->position())); + d->hoverPos = event->position(); } else { event->ignore(); } @@ -575,16 +575,16 @@ void QWaylandQuickItem::hoverMoveEvent(QHoverEvent *event) { Q_D(QWaylandQuickItem); if (surface()) { - if (!inputRegionContains(event->posF())) { + if (!inputRegionContains(event->position())) { event->ignore(); return; } } if (d->shouldSendInputEvents()) { QWaylandSeat *seat = compositor()->seatFor(event); - if (event->posF() != d->hoverPos) { - seat->sendMouseMoveEvent(d->view.data(), mapToSurface(event->posF()), mapToScene(event->posF())); - d->hoverPos = event->posF(); + if (event->position() != d->hoverPos) { + seat->sendMouseMoveEvent(d->view.data(), mapToSurface(event->position()), mapToScene(event->position())); + d->hoverPos = event->position(); } } else { event->ignore(); @@ -673,7 +673,7 @@ void QWaylandQuickItem::touchEvent(QTouchEvent *event) QPointF pointPos; const QList<QTouchEvent::TouchPoint> &points = event->touchPoints(); if (!points.isEmpty()) - pointPos = points.at(0).pos(); + pointPos = points.at(0).position(); if (event->type() == QEvent::TouchBegin && !inputRegionContains(pointPos)) { event->ignore(); diff --git a/src/compositor/extensions/qwaylandwlshellintegration.cpp b/src/compositor/extensions/qwaylandwlshellintegration.cpp index 3853d7eec..ef81aad37 100644 --- a/src/compositor/extensions/qwaylandwlshellintegration.cpp +++ b/src/compositor/extensions/qwaylandwlshellintegration.cpp @@ -296,25 +296,25 @@ bool WlShellIntegration::filterMouseMoveEvent(QMouseEvent *event) if (grabberState == GrabberState::Resize) { Q_ASSERT(resizeState.seat == m_item->compositor()->seatFor(event)); if (!resizeState.initialized) { - resizeState.initialMousePos = event->windowPos(); + resizeState.initialMousePos = event->scenePosition(); resizeState.initialized = true; return true; } float scaleFactor = m_item->view()->output()->scaleFactor(); - QPointF delta = (event->windowPos() - resizeState.initialMousePos) / scaleFactor * devicePixelRatio(); + QPointF delta = (event->scenePosition() - resizeState.initialMousePos) / scaleFactor * devicePixelRatio(); QSize newSize = m_shellSurface->sizeForResize(resizeState.initialSize, delta, resizeState.resizeEdges); m_shellSurface->sendConfigure(newSize, resizeState.resizeEdges); } else if (grabberState == GrabberState::Move) { Q_ASSERT(moveState.seat == m_item->compositor()->seatFor(event)); QQuickItem *moveItem = m_item->moveItem(); if (!moveState.initialized) { - moveState.initialOffset = moveItem->mapFromItem(nullptr, event->windowPos()); + moveState.initialOffset = moveItem->mapFromItem(nullptr, event->scenePosition()); moveState.initialized = true; return true; } if (!moveItem->parentItem()) return true; - QPointF parentPos = moveItem->parentItem()->mapFromItem(nullptr, event->windowPos()); + QPointF parentPos = moveItem->parentItem()->mapFromItem(nullptr, event->scenePosition()); moveItem->setPosition(parentPos - moveState.initialOffset); } return false; diff --git a/src/compositor/extensions/qwaylandxdgshellintegration.cpp b/src/compositor/extensions/qwaylandxdgshellintegration.cpp index 9534ec942..89c1ef91b 100644 --- a/src/compositor/extensions/qwaylandxdgshellintegration.cpp +++ b/src/compositor/extensions/qwaylandxdgshellintegration.cpp @@ -94,24 +94,24 @@ bool XdgToplevelIntegration::filterMouseMoveEvent(QMouseEvent *event) if (grabberState == GrabberState::Resize) { Q_ASSERT(resizeState.seat == m_item->compositor()->seatFor(event)); if (!resizeState.initialized) { - resizeState.initialMousePos = event->windowPos(); + resizeState.initialMousePos = event->scenePosition(); resizeState.initialized = true; return true; } - QPointF delta = m_item->mapToSurface(event->windowPos() - resizeState.initialMousePos); + QPointF delta = m_item->mapToSurface(event->scenePosition() - resizeState.initialMousePos); QSize newSize = m_toplevel->sizeForResize(resizeState.initialWindowSize, delta, resizeState.resizeEdges); m_toplevel->sendResizing(newSize); } else if (grabberState == GrabberState::Move) { Q_ASSERT(moveState.seat == m_item->compositor()->seatFor(event)); QQuickItem *moveItem = m_item->moveItem(); if (!moveState.initialized) { - moveState.initialOffset = moveItem->mapFromItem(nullptr, event->windowPos()); + moveState.initialOffset = moveItem->mapFromItem(nullptr, event->scenePosition()); moveState.initialized = true; return true; } if (!moveItem->parentItem()) return true; - QPointF parentPos = moveItem->parentItem()->mapFromItem(nullptr, event->windowPos()); + QPointF parentPos = moveItem->parentItem()->mapFromItem(nullptr, event->scenePosition()); moveItem->setPosition(parentPos - moveState.initialOffset); } return false; diff --git a/src/compositor/extensions/qwaylandxdgshellv5integration.cpp b/src/compositor/extensions/qwaylandxdgshellv5integration.cpp index 2f11130fe..375f0e9fd 100644 --- a/src/compositor/extensions/qwaylandxdgshellv5integration.cpp +++ b/src/compositor/extensions/qwaylandxdgshellv5integration.cpp @@ -91,24 +91,24 @@ bool XdgShellV5Integration::filterMouseMoveEvent(QMouseEvent *event) if (grabberState == GrabberState::Resize) { Q_ASSERT(resizeState.seat == m_item->compositor()->seatFor(event)); if (!resizeState.initialized) { - resizeState.initialMousePos = event->windowPos(); + resizeState.initialMousePos = event->scenePosition(); resizeState.initialized = true; return true; } - QPointF delta = m_item->mapToSurface(event->windowPos() - resizeState.initialMousePos); + QPointF delta = m_item->mapToSurface(event->scenePosition() - resizeState.initialMousePos); QSize newSize = m_xdgSurface->sizeForResize(resizeState.initialWindowSize, delta, resizeState.resizeEdges); m_xdgSurface->sendResizing(newSize); } else if (grabberState == GrabberState::Move) { Q_ASSERT(moveState.seat == m_item->compositor()->seatFor(event)); QQuickItem *moveItem = m_item->moveItem(); if (!moveState.initialized) { - moveState.initialOffset = moveItem->mapFromItem(nullptr, event->windowPos()); + moveState.initialOffset = moveItem->mapFromItem(nullptr, event->scenePosition()); moveState.initialized = true; return true; } if (!moveItem->parentItem()) return true; - QPointF parentPos = moveItem->parentItem()->mapFromItem(nullptr, event->windowPos()); + QPointF parentPos = moveItem->parentItem()->mapFromItem(nullptr, event->scenePosition()); moveItem->setPosition(parentPos - moveState.initialOffset); } return false; diff --git a/src/compositor/extensions/qwaylandxdgshellv6integration.cpp b/src/compositor/extensions/qwaylandxdgshellv6integration.cpp index a86151dad..f4a8a399f 100644 --- a/src/compositor/extensions/qwaylandxdgshellv6integration.cpp +++ b/src/compositor/extensions/qwaylandxdgshellv6integration.cpp @@ -96,24 +96,24 @@ bool XdgToplevelV6Integration::filterMouseMoveEvent(QMouseEvent *event) if (grabberState == GrabberState::Resize) { Q_ASSERT(resizeState.seat == m_item->compositor()->seatFor(event)); if (!resizeState.initialized) { - resizeState.initialMousePos = event->windowPos(); + resizeState.initialMousePos = event->scenePosition(); resizeState.initialized = true; return true; } - QPointF delta = m_item->mapToSurface(event->windowPos() - resizeState.initialMousePos); + QPointF delta = m_item->mapToSurface(event->scenePosition() - resizeState.initialMousePos); QSize newSize = m_toplevel->sizeForResize(resizeState.initialWindowSize, delta, resizeState.resizeEdges); m_toplevel->sendResizing(newSize); } else if (grabberState == GrabberState::Move) { Q_ASSERT(moveState.seat == m_item->compositor()->seatFor(event)); QQuickItem *moveItem = m_item->moveItem(); if (!moveState.initialized) { - moveState.initialOffset = moveItem->mapFromItem(nullptr, event->windowPos()); + moveState.initialOffset = moveItem->mapFromItem(nullptr, event->scenePosition()); moveState.initialized = true; return true; } if (!moveItem->parentItem()) return true; - QPointF parentPos = moveItem->parentItem()->mapFromItem(nullptr, event->windowPos()); + QPointF parentPos = moveItem->parentItem()->mapFromItem(nullptr, event->scenePosition()); moveItem->setPosition(parentPos - moveState.initialOffset); } return false; diff --git a/src/compositor/extensions/qwlqttouch.cpp b/src/compositor/extensions/qwlqttouch.cpp index f9d1a368f..ca92cc2c8 100644 --- a/src/compositor/extensions/qwlqttouch.cpp +++ b/src/compositor/extensions/qwlqttouch.cpp @@ -29,8 +29,8 @@ #include "qwlqttouch_p.h" #include "qwaylandview.h" +#include <QPointingDevice> #include <QTouchEvent> -#include <QTouchDevice> #include <QWindow> QT_BEGIN_NAMESPACE @@ -89,7 +89,7 @@ bool TouchExtensionGlobal::postTouchEvent(QTouchEvent *event, QWaylandSurface *s uint32_t id = tp.id(); uint32_t state = (tp.state() & 0xFFFF) | (sentPointCount << 16); - uint32_t flags = (tp.flags() & 0xFFFF) | (int(event->device()->capabilities()) << 16); + uint32_t flags = (tp.flags() & 0xFFFF) | (int(event->pointingDevice()->capabilities()) << 16); int x = toFixed(tp.pos().x()); int y = toFixed(tp.pos().y()); |