diff options
58 files changed, 447 insertions, 451 deletions
diff --git a/examples/wayland/custom-extension/compositor/qml/Screen.qml b/examples/wayland/custom-extension/compositor/qml/Screen.qml index a1e43a00b..b6e4e12d0 100644 --- a/examples/wayland/custom-extension/compositor/qml/Screen.qml +++ b/examples/wayland/custom-extension/compositor/qml/Screen.qml @@ -72,7 +72,7 @@ WaylandOutput { x: mouseTracker.mouseX y: mouseTracker.mouseY - inputDevice: output.compositor.defaultInputDevice + seat: output.compositor.defaultSeat } Rectangle { anchors.bottom: parent.bottom diff --git a/examples/wayland/multi-output/qml/ShellScreen.qml b/examples/wayland/multi-output/qml/ShellScreen.qml index 2ac22367f..9a6122118 100644 --- a/examples/wayland/multi-output/qml/ShellScreen.qml +++ b/examples/wayland/multi-output/qml/ShellScreen.qml @@ -69,7 +69,7 @@ WaylandOutput { x: mouseTracker.mouseX y: mouseTracker.mouseY - inputDevice : output.compositor.defaultInputDevice + seat : output.compositor.defaultSeat } } } diff --git a/examples/wayland/pure-qml/qml/Screen.qml b/examples/wayland/pure-qml/qml/Screen.qml index 968aad818..0920a8b95 100644 --- a/examples/wayland/pure-qml/qml/Screen.qml +++ b/examples/wayland/pure-qml/qml/Screen.qml @@ -76,7 +76,7 @@ WaylandOutput { x: mouseTracker.mouseX y: mouseTracker.mouseY - inputDevice: output.compositor.defaultInputDevice + seat: output.compositor.defaultSeat } } diff --git a/examples/wayland/qwindow-compositor/compositor.cpp b/examples/wayland/qwindow-compositor/compositor.cpp index cff3df082..b7cdbbd9f 100644 --- a/examples/wayland/qwindow-compositor/compositor.cpp +++ b/examples/wayland/qwindow-compositor/compositor.cpp @@ -46,7 +46,7 @@ #include <QtWaylandCompositor/QWaylandXdgShell> #include <QtWaylandCompositor/QWaylandWlShellSurface> -#include <QtWaylandCompositor/qwaylandinput.h> +#include <QtWaylandCompositor/qwaylandseat.h> #include <QtWaylandCompositor/qwaylanddrag.h> #include <QDebug> @@ -162,8 +162,8 @@ void Compositor::create() QWaylandCompositor::create(); connect(this, &QWaylandCompositor::surfaceCreated, this, &Compositor::onSurfaceCreated); - connect(defaultInputDevice(), &QWaylandInputDevice::cursorSurfaceRequest, this, &Compositor::adjustCursorSurface); - connect(defaultInputDevice()->drag(), &QWaylandDrag::dragStarted, this, &Compositor::startDrag); + connect(defaultSeat(), &QWaylandSeat::cursorSurfaceRequest, this, &Compositor::adjustCursorSurface); + connect(defaultSeat()->drag(), &QWaylandDrag::dragStarted, this, &Compositor::startDrag); connect(this, &QWaylandCompositor::subsurfaceChanged, this, &Compositor::onSubsurfaceChanged); } @@ -191,7 +191,7 @@ void Compositor::surfaceMappedChanged() if (surface->role() == QWaylandWlShellSurface::role() || surface->role() == QWaylandXdgSurface::role() || surface->role() == QWaylandXdgPopup::role()) { - defaultInputDevice()->setKeyboardFocus(surface); + defaultSeat()->setKeyboardFocus(surface); } } else if (popupActive()) { for (int i = 0; i < m_popupViews.count(); i++) { @@ -253,10 +253,10 @@ void Compositor::onXdgSurfaceCreated(QWaylandXdgSurface *xdgSurface) } void Compositor::onXdgPopupRequested(QWaylandSurface *surface, QWaylandSurface *parent, - QWaylandInputDevice *inputDevice, const QPoint &position, + QWaylandSeat *seat, const QPoint &position, const QWaylandResource &resource) { - Q_UNUSED(inputDevice); + Q_UNUSED(seat); QWaylandXdgPopup *xdgPopup = new QWaylandXdgPopup(m_xdgShell, surface, parent, position, resource); @@ -276,16 +276,16 @@ void Compositor::onStartMove() emit startMove(); } -void Compositor::onWlStartResize(QWaylandInputDevice *, QWaylandWlShellSurface::ResizeEdge edges) +void Compositor::onWlStartResize(QWaylandSeat *, QWaylandWlShellSurface::ResizeEdge edges) { closePopups(); emit startResize(int(edges), false); } -void Compositor::onXdgStartResize(QWaylandInputDevice *inputDevice, - QWaylandXdgSurface::ResizeEdge edges) +void Compositor::onXdgStartResize(QWaylandSeat *seat, + QWaylandXdgSurface::ResizeEdge edges) { - Q_UNUSED(inputDevice); + Q_UNUSED(seat); emit startResize(int(edges), true); } @@ -303,9 +303,9 @@ void Compositor::onSetTransient(QWaylandSurface *parent, const QPoint &relativeT } } -void Compositor::onSetPopup(QWaylandInputDevice *inputDevice, QWaylandSurface *parent, const QPoint &relativeToParent) +void Compositor::onSetPopup(QWaylandSeat *seat, QWaylandSurface *parent, const QPoint &relativeToParent) { - Q_UNUSED(inputDevice); + Q_UNUSED(seat); QWaylandWlShellSurface *surface = qobject_cast<QWaylandWlShellSurface*>(sender()); View *view = findView(surface->surface()); m_popupViews << view; @@ -395,7 +395,7 @@ void Compositor::handleMouseEvent(QWaylandView *target, QMouseEvent *me) && target->surface()->client() != m_popupViews.first()->surface()->client()) { closePopups(); } - QWaylandInputDevice *input = defaultInputDevice(); + QWaylandSeat *input = defaultSeat(); QWaylandSurface *surface = target ? target->surface() : nullptr; switch (me->type()) { case QEvent::MouseButtonPress: @@ -438,7 +438,7 @@ void Compositor::handleResize(View *target, const QSize &initialSize, const QPoi void Compositor::startDrag() { - QWaylandDrag *currentDrag = defaultInputDevice()->drag(); + QWaylandDrag *currentDrag = defaultSeat()->drag(); Q_ASSERT(currentDrag); View *iconView = findView(currentDrag->icon()); iconView->setPosition(m_window->mapFromGlobal(QCursor::pos())); @@ -454,7 +454,7 @@ void Compositor::handleDrag(View *target, QMouseEvent *me) pos -= target->position(); surface = target->surface(); } - QWaylandDrag *currentDrag = defaultInputDevice()->drag(); + QWaylandDrag *currentDrag = defaultSeat()->drag(); currentDrag->dragMove(surface, pos); if (me->buttons() == Qt::NoButton) currentDrag->drop(); diff --git a/examples/wayland/qwindow-compositor/compositor.h b/examples/wayland/qwindow-compositor/compositor.h index 3e25ea7df..243e5dbef 100644 --- a/examples/wayland/qwindow-compositor/compositor.h +++ b/examples/wayland/qwindow-compositor/compositor.h @@ -123,8 +123,8 @@ private slots: void surfaceDestroyed(); void viewSurfaceDestroyed(); void onStartMove(); - void onWlStartResize(QWaylandInputDevice *inputDevice, QWaylandWlShellSurface::ResizeEdge edges); - void onXdgStartResize(QWaylandInputDevice *inputDevice, QWaylandXdgSurface::ResizeEdge edges); + void onWlStartResize(QWaylandSeat *seat, QWaylandWlShellSurface::ResizeEdge edges); + void onXdgStartResize(QWaylandSeat *seat, QWaylandXdgSurface::ResizeEdge edges); void startDrag(); @@ -133,10 +133,10 @@ private slots: void onSurfaceCreated(QWaylandSurface *surface); void onWlShellSurfaceCreated(QWaylandWlShellSurface *wlShellSurface); void onXdgSurfaceCreated(QWaylandXdgSurface *xdgSurface); - void onXdgPopupRequested(QWaylandSurface *surface, QWaylandSurface *parent, QWaylandInputDevice *inputDevice, + void onXdgPopupRequested(QWaylandSurface *surface, QWaylandSurface *parent, QWaylandSeat *seat, const QPoint &position, const QWaylandResource &resource); void onSetTransient(QWaylandSurface *parentSurface, const QPoint &relativeToParent, QWaylandWlShellSurface::FocusPolicy focusPolicy); - void onSetPopup(QWaylandInputDevice *inputDevice, QWaylandSurface *parent, const QPoint &relativeToParent); + void onSetPopup(QWaylandSeat *seat, QWaylandSurface *parent, const QPoint &relativeToParent); void onSubsurfaceChanged(QWaylandSurface *child, QWaylandSurface *parent); void onSubsurfacePositionChanged(const QPoint &position); diff --git a/examples/wayland/qwindow-compositor/window.cpp b/examples/wayland/qwindow-compositor/window.cpp index c3fc9b7df..86a1f8651 100644 --- a/examples/wayland/qwindow-compositor/window.cpp +++ b/examples/wayland/qwindow-compositor/window.cpp @@ -47,7 +47,7 @@ #include <QMatrix4x4> #include "compositor.h" -#include <QtWaylandCompositor/qwaylandinput.h> +#include <QtWaylandCompositor/qwaylandseat.h> Window::Window() : m_backgroundTexture(0) @@ -268,10 +268,10 @@ void Window::sendMouseEvent(QMouseEvent *e, View *target) void Window::keyPressEvent(QKeyEvent *e) { - m_compositor->defaultInputDevice()->sendKeyPressEvent(e->nativeScanCode()); + m_compositor->defaultSeat()->sendKeyPressEvent(e->nativeScanCode()); } void Window::keyReleaseEvent(QKeyEvent *e) { - m_compositor->defaultInputDevice()->sendKeyReleaseEvent(e->nativeScanCode()); + m_compositor->defaultSeat()->sendKeyReleaseEvent(e->nativeScanCode()); } diff --git a/src/compositor/compositor_api/compositor_api.pri b/src/compositor/compositor_api/compositor_api.pri index 5a2b77f65..e803d14c0 100644 --- a/src/compositor/compositor_api/compositor_api.pri +++ b/src/compositor/compositor_api/compositor_api.pri @@ -6,8 +6,8 @@ HEADERS += \ compositor_api/qwaylandclient.h \ compositor_api/qwaylandsurface.h \ compositor_api/qwaylandsurface_p.h \ - compositor_api/qwaylandinput.h \ - compositor_api/qwaylandinput_p.h \ + compositor_api/qwaylandseat.h \ + compositor_api/qwaylandseat_p.h \ compositor_api/qwaylandkeyboard.h \ compositor_api/qwaylandkeyboard_p.h \ compositor_api/qwaylandpointer.h \ @@ -30,7 +30,7 @@ SOURCES += \ compositor_api/qwaylandcompositor.cpp \ compositor_api/qwaylandclient.cpp \ compositor_api/qwaylandsurface.cpp \ - compositor_api/qwaylandinput.cpp \ + compositor_api/qwaylandseat.cpp \ compositor_api/qwaylandkeyboard.cpp \ compositor_api/qwaylandpointer.cpp \ compositor_api/qwaylandtouch.cpp \ diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp index a8c1eb3d2..0feba9857 100644 --- a/src/compositor/compositor_api/qwaylandcompositor.cpp +++ b/src/compositor/compositor_api/qwaylandcompositor.cpp @@ -39,7 +39,7 @@ #include "qwaylandcompositor_p.h" #include <QtWaylandCompositor/qwaylandclient.h> -#include <QtWaylandCompositor/qwaylandinput.h> +#include <QtWaylandCompositor/qwaylandseat.h> #include <QtWaylandCompositor/qwaylandoutput.h> #include <QtWaylandCompositor/qwaylandview.h> #include <QtWaylandCompositor/qwaylandclient.h> @@ -100,7 +100,7 @@ public: { if (e->type == QWindowSystemInterfacePrivate::Key) { QWindowSystemInterfacePrivate::KeyEvent *ke = static_cast<QWindowSystemInterfacePrivate::KeyEvent *>(e); - QWaylandKeyboardPrivate *keyb = QWaylandKeyboardPrivate::get(compositor->defaultInputDevice()->keyboard()); + QWaylandKeyboardPrivate *keyb = QWaylandKeyboardPrivate::get(compositor->defaultSeat()->keyboard()); uint32_t code = ke->nativeScanCode; bool isDown = ke->keyType == QEvent::KeyPress; @@ -200,7 +200,7 @@ void QWaylandCompositorPrivate::init() QObject::connect(dispatcher, SIGNAL(aboutToBlock()), q, SLOT(processWaylandEvents())); initializeHardwareIntegration(); - initializeDefaultInputDevice(); + initializeDefaultSeat(); initialized = true; @@ -350,12 +350,12 @@ void QWaylandCompositorPrivate::initializeHardwareIntegration() #endif } -void QWaylandCompositorPrivate::initializeDefaultInputDevice() +void QWaylandCompositorPrivate::initializeDefaultSeat() { Q_Q(QWaylandCompositor); - QWaylandInputDevice *device = q->createInputDevice(); - inputDevices.append(device); - q->defaultInputDeviceChanged(device, nullptr); + QWaylandSeat *device = q->createSeat(); + seats.append(device); + q->defaultSeatChanged(device, nullptr); } void QWaylandCompositorPrivate::loadClientBufferIntegration() @@ -411,7 +411,7 @@ void QWaylandCompositorPrivate::loadServerBufferIntegration() \brief Type managing the Wayland display server. The WaylandCompositor manages the connections to the clients, as well as the different - \l{WaylandOutput}{outputs} and \l{QWaylandInputDevice}{input devices}. + \l{WaylandOutput}{outputs} and \l{QWaylandSeat}{seats}. Normally, a compositor application will have a single WaylandCompositor instance, which can have several outputs as children. When a client @@ -430,7 +430,7 @@ void QWaylandCompositorPrivate::loadServerBufferIntegration() \brief Class managing the Wayland display server. The QWaylandCompositor manages the connections to the clients, as well as the different \l{QWaylandOutput}{outputs} - and \l{QWaylandInputDevice}{input devices}. + and \l{QWaylandSeat}{seats}. Normally, a compositor application will have a single WaylandCompositor instance, which can have several outputs as children. @@ -687,33 +687,33 @@ void QWaylandCompositor::processWaylandEvents() /*! * \internal */ -QWaylandInputDevice *QWaylandCompositor::createInputDevice() +QWaylandSeat *QWaylandCompositor::createSeat() { - return new QWaylandInputDevice(this); + return new QWaylandSeat(this); } /*! * \internal */ -QWaylandPointer *QWaylandCompositor::createPointerDevice(QWaylandInputDevice *inputDevice) +QWaylandPointer *QWaylandCompositor::createPointerDevice(QWaylandSeat *seat) { - return new QWaylandPointer(inputDevice); + return new QWaylandPointer(seat); } /*! * \internal */ -QWaylandKeyboard *QWaylandCompositor::createKeyboardDevice(QWaylandInputDevice *inputDevice) +QWaylandKeyboard *QWaylandCompositor::createKeyboardDevice(QWaylandSeat *seat) { - return new QWaylandKeyboard(inputDevice); + return new QWaylandKeyboard(seat); } /*! * \internal */ -QWaylandTouch *QWaylandCompositor::createTouchDevice(QWaylandInputDevice *inputDevice) +QWaylandTouch *QWaylandCompositor::createTouchDevice(QWaylandSeat *seat) { - return new QWaylandTouch(inputDevice); + return new QWaylandTouch(seat); } /*! @@ -756,38 +756,38 @@ void QWaylandCompositor::overrideSelection(const QMimeData *data) } /*! - * \qmlproperty object QtWaylandCompositor::WaylandCompositor::defaultInputDevice + * \qmlproperty object QtWaylandCompositor::WaylandCompositor::defaultSeat * - * This property contains the default input device for this + * This property contains the default seat for this * WaylandCompositor. */ /*! - * \property QWaylandCompositor::defaultInputDevice + * \property QWaylandCompositor::defaultSeat * - * This property contains the default input device for this + * This property contains the default seat for this * QWaylandCompositor. */ -QWaylandInputDevice *QWaylandCompositor::defaultInputDevice() const +QWaylandSeat *QWaylandCompositor::defaultSeat() const { Q_D(const QWaylandCompositor); - if (d->inputDevices.size()) - return d->inputDevices.first(); + if (d->seats.size()) + return d->seats.first(); return Q_NULLPTR; } /*! * \internal * - * Currently, Qt only supports a single input device, so this exists for + * Currently, Qt only supports a single seat, so this exists for * future proofing the APIs. */ -QWaylandInputDevice *QWaylandCompositor::inputDeviceFor(QInputEvent *inputEvent) +QWaylandSeat *QWaylandCompositor::seatFor(QInputEvent *inputEvent) { Q_D(QWaylandCompositor); - QWaylandInputDevice *dev = NULL; - for (int i = 0; i < d->inputDevices.size(); i++) { - QWaylandInputDevice *candidate = d->inputDevices.at(i); + QWaylandSeat *dev = NULL; + for (int i = 0; i < d->seats.size(); i++) { + QWaylandSeat *candidate = d->seats.at(i); if (candidate->isOwner(inputEvent)) { dev = candidate; break; diff --git a/src/compositor/compositor_api/qwaylandcompositor.h b/src/compositor/compositor_api/qwaylandcompositor.h index 5bb795a40..15022b378 100644 --- a/src/compositor/compositor_api/qwaylandcompositor.h +++ b/src/compositor/compositor_api/qwaylandcompositor.h @@ -58,7 +58,7 @@ class QOpenGLContext; class QWaylandCompositorPrivate; class QWaylandClient; class QWaylandSurface; -class QWaylandInputDevice; +class QWaylandSeat; class QWaylandGlobalInterface; class QWaylandView; class QWaylandPointer; @@ -77,7 +77,7 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandCompositor : public QWaylandObject Q_PROPERTY(bool retainedSelection READ retainedSelectionEnabled WRITE setRetainedSelectionEnabled) Q_PROPERTY(QWaylandOutput *defaultOutput READ defaultOutput WRITE setDefaultOutput NOTIFY defaultOutputChanged) Q_PROPERTY(bool useHardwareIntegrationExtension READ useHardwareIntegrationExtension WRITE setUseHardwareIntegrationExtension NOTIFY useHardwareIntegrationExtensionChanged) - Q_PROPERTY(QWaylandInputDevice *defaultInputDevice READ defaultInputDevice NOTIFY defaultInputDeviceChanged) + Q_PROPERTY(QWaylandSeat *defaultSeat READ defaultSeat NOTIFY defaultSeatChanged) public: QWaylandCompositor(QObject *parent = nullptr); @@ -111,11 +111,11 @@ public: bool retainedSelectionEnabled() const; void overrideSelection(const QMimeData *data); - QWaylandInputDevice *defaultInputDevice() const; + QWaylandSeat *defaultSeat() const; QWaylandView *createSurfaceView(QWaylandSurface *surface); - QWaylandInputDevice *inputDeviceFor(QInputEvent *inputEvent); + QWaylandSeat *seatFor(QInputEvent *inputEvent); bool useHardwareIntegrationExtension() const; void setUseHardwareIntegrationExtension(bool use); @@ -132,7 +132,7 @@ Q_SIGNALS: void subsurfaceChanged(QWaylandSurface *child, QWaylandSurface *parent); void defaultOutputChanged(); - void defaultInputDeviceChanged(QWaylandInputDevice *newDevice, QWaylandInputDevice *oldDevice); + void defaultSeatChanged(QWaylandSeat *newDevice, QWaylandSeat *oldDevice); void useHardwareIntegrationExtensionChanged(); @@ -141,10 +141,10 @@ Q_SIGNALS: protected: virtual void retainedSelectionReceived(QMimeData *mimeData); - virtual QWaylandInputDevice *createInputDevice(); - virtual QWaylandPointer *createPointerDevice(QWaylandInputDevice *inputDevice); - virtual QWaylandKeyboard *createKeyboardDevice(QWaylandInputDevice *inputDevice); - virtual QWaylandTouch *createTouchDevice(QWaylandInputDevice *inputDevice); + virtual QWaylandSeat *createSeat(); + virtual QWaylandPointer *createPointerDevice(QWaylandSeat *seat); + virtual QWaylandKeyboard *createKeyboardDevice(QWaylandSeat *seat); + virtual QWaylandTouch *createTouchDevice(QWaylandSeat *seat); QWaylandCompositor(QWaylandCompositorPrivate &dptr, QObject *parent = nullptr); }; diff --git a/src/compositor/compositor_api/qwaylandcompositor_p.h b/src/compositor/compositor_api/qwaylandcompositor_p.h index 324f55bd4..708d0113d 100644 --- a/src/compositor/compositor_api/qwaylandcompositor_p.h +++ b/src/compositor/compositor_api/qwaylandcompositor_p.h @@ -90,12 +90,12 @@ public: QtWayland::DataDeviceManager *dataDeviceManager() const { return data_device_manager; } void feedRetainedSelectionData(QMimeData *data); - QWaylandPointer *callCreatePointerDevice(QWaylandInputDevice *inputDevice) - { return q_func()->createPointerDevice(inputDevice); } - QWaylandKeyboard *callCreateKeyboardDevice(QWaylandInputDevice *inputDevice) - { return q_func()->createKeyboardDevice(inputDevice); } - QWaylandTouch *callCreateTouchDevice(QWaylandInputDevice *inputDevice) - { return q_func()->createTouchDevice(inputDevice); } + QWaylandPointer *callCreatePointerDevice(QWaylandSeat *seat) + { return q_func()->createPointerDevice(seat); } + QWaylandKeyboard *callCreateKeyboardDevice(QWaylandSeat *seat) + { return q_func()->createKeyboardDevice(seat); } + QWaylandTouch *callCreateTouchDevice(QWaylandSeat *seat) + { return q_func()->createTouchDevice(seat); } inline void addClient(QWaylandClient *client); inline void removeClient(QWaylandClient *client); @@ -114,7 +114,7 @@ protected: protected: void initializeHardwareIntegration(); void initializeExtensions(); - void initializeDefaultInputDevice(); + void initializeDefaultSeat(); void loadClientBufferIntegration(); void loadServerBufferIntegration(); @@ -122,7 +122,7 @@ protected: QByteArray socket_name; struct wl_display *display; - QList<QWaylandInputDevice *> inputDevices; + QList<QWaylandSeat *> seats; QList<QWaylandOutput *> outputs; QList<QWaylandSurface *> all_surfaces; diff --git a/src/compositor/compositor_api/qwaylanddrag.cpp b/src/compositor/compositor_api/qwaylanddrag.cpp index 26b1140bf..3c3d9ce52 100644 --- a/src/compositor/compositor_api/qwaylanddrag.cpp +++ b/src/compositor/compositor_api/qwaylanddrag.cpp @@ -40,33 +40,33 @@ #include "qwldatadevice_p.h" #include "qwaylandview.h" -#include <QtWaylandCompositor/private/qwaylandinput_p.h> +#include <QtWaylandCompositor/private/qwaylandseat_p.h> QT_BEGIN_NAMESPACE class QWaylandDragPrivate : public QObjectPrivate { public: - QWaylandDragPrivate(QWaylandInputDevice *id) - : inputDevice(id) + QWaylandDragPrivate(QWaylandSeat *seat) + : seat(seat) { } QtWayland::DataDevice *dataDevice() { - return QWaylandInputDevicePrivate::get(inputDevice)->dataDevice(); + return QWaylandSeatPrivate::get(seat)->dataDevice(); } const QtWayland::DataDevice *dataDevice() const { - return QWaylandInputDevicePrivate::get(inputDevice)->dataDevice(); + return QWaylandSeatPrivate::get(seat)->dataDevice(); } - QWaylandInputDevice *inputDevice; + QWaylandSeat *seat; }; -QWaylandDrag::QWaylandDrag(QWaylandInputDevice *inputDevice) - : QObject(* new QWaylandDragPrivate(inputDevice)) +QWaylandDrag::QWaylandDrag(QWaylandSeat *seat) + : QObject(* new QWaylandDragPrivate(seat)) { } @@ -88,10 +88,10 @@ QWaylandSurface *QWaylandDrag::origin() const return dataDevice ? dataDevice->dragOrigin() : nullptr; } -QWaylandInputDevice *QWaylandDrag::inputDevice() const +QWaylandSeat *QWaylandDrag::seat() const { Q_D(const QWaylandDrag); - return d->inputDevice; + return d->seat; } diff --git a/src/compositor/compositor_api/qwaylanddrag.h b/src/compositor/compositor_api/qwaylanddrag.h index 80d063725..08ad11018 100644 --- a/src/compositor/compositor_api/qwaylanddrag.h +++ b/src/compositor/compositor_api/qwaylanddrag.h @@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE class QWaylandDragPrivate; class QWaylandSurface; -class QWaylandInputDevice; +class QWaylandSeat; class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandDrag : public QObject { @@ -57,11 +57,11 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandDrag : public QObject Q_PROPERTY(bool visible READ visible NOTIFY iconChanged) public: - explicit QWaylandDrag(QWaylandInputDevice *inputDevice); + explicit QWaylandDrag(QWaylandSeat *seat); QWaylandSurface *icon() const; QWaylandSurface *origin() const; - QWaylandInputDevice *inputDevice() const; + QWaylandSeat *seat() const; bool visible() const; public Q_SLOTS: diff --git a/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp b/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp index 122c589da..68279bb97 100644 --- a/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp +++ b/src/compositor/compositor_api/qwaylandinputmethodcontrol.cpp @@ -38,7 +38,7 @@ #include "qwaylandinputmethodcontrol_p.h" #include "qwaylandcompositor.h" -#include "qwaylandinput.h" +#include "qwaylandseat.h" #include "qwaylandsurface.h" #include "qwaylandview.h" #include "qwaylandtextinput.h" @@ -48,8 +48,8 @@ QWaylandInputMethodControl::QWaylandInputMethodControl(QWaylandSurface *surface) : QObject(*new QWaylandInputMethodControlPrivate(surface), surface) { - connect(d_func()->compositor, &QWaylandCompositor::defaultInputDeviceChanged, - this, &QWaylandInputMethodControl::defaultInputDeviceChanged); + connect(d_func()->compositor, &QWaylandCompositor::defaultSeatChanged, + this, &QWaylandInputMethodControl::defaultSeatChanged); QWaylandTextInput *textInput = d_func()->textInput(); if (textInput) { connect(textInput, &QWaylandTextInput::surfaceEnabled, this, &QWaylandInputMethodControl::surfaceEnabled); @@ -135,13 +135,13 @@ void QWaylandInputMethodControl::setSurface(QWaylandSurface *surface) setEnabled(textInput && textInput->isSurfaceEnabled(d->surface)); } -void QWaylandInputMethodControl::defaultInputDeviceChanged() +void QWaylandInputMethodControl::defaultSeatChanged() { Q_D(QWaylandInputMethodControl); disconnect(d->textInput(), 0, this, 0); - d->inputDevice = d->compositor->defaultInputDevice(); + d->seat = d->compositor->defaultSeat(); QWaylandTextInput *textInput = d->textInput(); connect(textInput, &QWaylandTextInput::surfaceEnabled, this, &QWaylandInputMethodControl::surfaceEnabled); @@ -153,7 +153,7 @@ void QWaylandInputMethodControl::defaultInputDeviceChanged() QWaylandInputMethodControlPrivate::QWaylandInputMethodControlPrivate(QWaylandSurface *surface) : QObjectPrivate() , compositor(surface->compositor()) - , inputDevice(compositor->defaultInputDevice()) + , seat(compositor->defaultSeat()) , surface(surface) , enabled(false) { @@ -161,5 +161,5 @@ QWaylandInputMethodControlPrivate::QWaylandInputMethodControlPrivate(QWaylandSur QWaylandTextInput *QWaylandInputMethodControlPrivate::textInput() const { - return QWaylandTextInput::findIn(inputDevice); + return QWaylandTextInput::findIn(seat); } diff --git a/src/compositor/compositor_api/qwaylandinputmethodcontrol.h b/src/compositor/compositor_api/qwaylandinputmethodcontrol.h index f71650294..ab894c9c5 100644 --- a/src/compositor/compositor_api/qwaylandinputmethodcontrol.h +++ b/src/compositor/compositor_api/qwaylandinputmethodcontrol.h @@ -74,7 +74,7 @@ Q_SIGNALS: #endif private: - void defaultInputDeviceChanged(); + void defaultSeatChanged(); void surfaceEnabled(QWaylandSurface *surface); void surfaceDisabled(QWaylandSurface *surface); }; diff --git a/src/compositor/compositor_api/qwaylandinputmethodcontrol_p.h b/src/compositor/compositor_api/qwaylandinputmethodcontrol_p.h index a687e5299..a4f9ce877 100644 --- a/src/compositor/compositor_api/qwaylandinputmethodcontrol_p.h +++ b/src/compositor/compositor_api/qwaylandinputmethodcontrol_p.h @@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE class QWaylandCompositor; -class QWaylandInputDevice; +class QWaylandSeat; class QWaylandSurface; class QWaylandTextInput; @@ -70,7 +70,7 @@ public: QWaylandTextInput *textInput() const; QWaylandCompositor *compositor; - QWaylandInputDevice *inputDevice; + QWaylandSeat *seat; QWaylandSurface *surface; bool enabled; }; diff --git a/src/compositor/compositor_api/qwaylandkeyboard.cpp b/src/compositor/compositor_api/qwaylandkeyboard.cpp index e6ba64ed5..d29b9d947 100644 --- a/src/compositor/compositor_api/qwaylandkeyboard.cpp +++ b/src/compositor/compositor_api/qwaylandkeyboard.cpp @@ -38,7 +38,7 @@ #include "qwaylandkeyboard.h" #include "qwaylandkeyboard_p.h" #include <QtWaylandCompositor/QWaylandCompositor> -#include <QtWaylandCompositor/QWaylandInputDevice> +#include <QtWaylandCompositor/QWaylandSeat> #include <QtWaylandCompositor/QWaylandClient> #include <QtCore/QFile> @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE -QWaylandKeyboardPrivate::QWaylandKeyboardPrivate(QWaylandInputDevice *seat) +QWaylandKeyboardPrivate::QWaylandKeyboardPrivate(QWaylandSeat *seat) : QtWaylandServer::wl_keyboard() , seat(seat) , focus() @@ -384,24 +384,24 @@ void QWaylandKeyboardPrivate::sendRepeatInfo() * \preliminary * \brief The QWaylandKeyboard class provides access to a keyboard device. * - * This class provides access to the keyboard device in a QWaylandInputDevice. It corresponds to + * This class provides access to the keyboard device in a QWaylandSeat. It corresponds to * the Wayland interface wl_keyboard. */ /*! - * Constructs a QWaylandKeyboard for the given \a inputDevice and with the given \a parent. + * Constructs a QWaylandKeyboard for the given \a seat and with the given \a parent. */ -QWaylandKeyboard::QWaylandKeyboard(QWaylandInputDevice *inputDevice, QObject *parent) - : QWaylandObject(* new QWaylandKeyboardPrivate(inputDevice), parent) +QWaylandKeyboard::QWaylandKeyboard(QWaylandSeat *seat, QObject *parent) + : QWaylandObject(* new QWaylandKeyboardPrivate(seat), parent) { Q_D(QWaylandKeyboard); connect(&d->focusDestroyListener, &QWaylandDestroyListener::fired, this, &QWaylandKeyboard::focusDestroyed); } /*! - * Returns the input device for this QWaylandKeyboard. + * Returns the seat for this QWaylandKeyboard. */ -QWaylandInputDevice *QWaylandKeyboard::inputDevice() const +QWaylandSeat *QWaylandKeyboard::seat() const { Q_D(const QWaylandKeyboard); return d->seat; diff --git a/src/compositor/compositor_api/qwaylandkeyboard.h b/src/compositor/compositor_api/qwaylandkeyboard.h index b5bf6fe5c..1348f5cd9 100644 --- a/src/compositor/compositor_api/qwaylandkeyboard.h +++ b/src/compositor/compositor_api/qwaylandkeyboard.h @@ -47,7 +47,7 @@ QT_BEGIN_NAMESPACE class QWaylandKeyboard; class QWaylandKeyboardPrivate; -class QWaylandInputDevice; +class QWaylandSeat; class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandKeymap { @@ -76,9 +76,9 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandKeyboard : public QWaylandObject Q_PROPERTY(quint32 repeatRate READ repeatRate WRITE setRepeatRate NOTIFY repeatRateChanged) Q_PROPERTY(quint32 repeatDelay READ repeatDelay WRITE setRepeatDelay NOTIFY repeatDelayChanged) public: - QWaylandKeyboard(QWaylandInputDevice *inputDevice, QObject *parent = nullptr); + QWaylandKeyboard(QWaylandSeat *seat, QObject *parent = nullptr); - QWaylandInputDevice *inputDevice() const; + QWaylandSeat *seat() const; QWaylandCompositor *compositor() const; quint32 repeatRate() const; diff --git a/src/compositor/compositor_api/qwaylandkeyboard_p.h b/src/compositor/compositor_api/qwaylandkeyboard_p.h index ede97d8ba..ac306282e 100644 --- a/src/compositor/compositor_api/qwaylandkeyboard_p.h +++ b/src/compositor/compositor_api/qwaylandkeyboard_p.h @@ -50,7 +50,7 @@ // #include <QtWaylandCompositor/qwaylandexport.h> -#include <QtWaylandCompositor/qwaylandinput.h> +#include <QtWaylandCompositor/qwaylandseat.h> #include <QtWaylandCompositor/qwaylandkeyboard.h> #include <QtWaylandCompositor/qwaylanddestroylistener.h> @@ -74,7 +74,7 @@ public: static QWaylandKeyboardPrivate *get(QWaylandKeyboard *keyboard); - QWaylandKeyboardPrivate(QWaylandInputDevice *seat); + QWaylandKeyboardPrivate(QWaylandSeat *seat); ~QWaylandKeyboardPrivate(); QWaylandCompositor *compositor() const { return seat->compositor(); } @@ -111,7 +111,7 @@ private: void sendRepeatInfo(); - QWaylandInputDevice *seat; + QWaylandSeat *seat; QWaylandSurface *focus; Resource *focusResource; diff --git a/src/compositor/compositor_api/qwaylandpointer.cpp b/src/compositor/compositor_api/qwaylandpointer.cpp index da08e339e..2ca8c51a2 100644 --- a/src/compositor/compositor_api/qwaylandpointer.cpp +++ b/src/compositor/compositor_api/qwaylandpointer.cpp @@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE QWaylandSurfaceRole QWaylandPointerPrivate::s_role("wl_pointer"); -QWaylandPointerPrivate::QWaylandPointerPrivate(QWaylandPointer *pointer, QWaylandInputDevice *seat) +QWaylandPointerPrivate::QWaylandPointerPrivate(QWaylandPointer *pointer, QWaylandSeat *seat) : QObjectPrivate() , wl_pointer() , seat(seat) @@ -97,24 +97,24 @@ void QWaylandPointerPrivate::pointer_set_cursor(wl_pointer::Resource *resource, * \preliminary * \brief The QWaylandPointer class provides access to a pointer device. * - * This class provides access to the pointer device in a QWaylandInputDevice. It corresponds to + * This class provides access to the pointer device in a QWaylandSeat. It corresponds to * the Wayland interface wl_pointer. */ /*! - * Constructs a QWaylandPointer for the given \a inputDevice and with the given \a parent. + * Constructs a QWaylandPointer for the given \a seat and with the given \a parent. */ -QWaylandPointer::QWaylandPointer(QWaylandInputDevice *inputDevice, QObject *parent) - : QWaylandObject(* new QWaylandPointerPrivate(this, inputDevice), parent) +QWaylandPointer::QWaylandPointer(QWaylandSeat *seat, QObject *parent) + : QWaylandObject(* new QWaylandPointerPrivate(this, seat), parent) { connect(&d_func()->focusDestroyListener, &QWaylandDestroyListener::fired, this, &QWaylandPointer::focusDestroyed); - connect(inputDevice, &QWaylandInputDevice::mouseFocusChanged, this, &QWaylandPointer::pointerFocusChanged); + connect(seat, &QWaylandSeat::mouseFocusChanged, this, &QWaylandPointer::pointerFocusChanged); } /*! * Returns the input device for this QWaylandPointer. */ -QWaylandInputDevice *QWaylandPointer::inputDevice() const +QWaylandSeat *QWaylandPointer::seat() const { Q_D(const QWaylandPointer); return d->seat; diff --git a/src/compositor/compositor_api/qwaylandpointer.h b/src/compositor/compositor_api/qwaylandpointer.h index 9d7d06807..0db1635bb 100644 --- a/src/compositor/compositor_api/qwaylandpointer.h +++ b/src/compositor/compositor_api/qwaylandpointer.h @@ -45,7 +45,7 @@ QT_BEGIN_NAMESPACE class QWaylandPointer; class QWaylandPointerPrivate; -class QWaylandInputDevice; +class QWaylandSeat; class QWaylandView; class QWaylandOutput; class QWaylandClient; @@ -56,9 +56,9 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandPointer : public QWaylandObject Q_DECLARE_PRIVATE(QWaylandPointer) Q_PROPERTY(bool isButtonPressed READ isButtonPressed NOTIFY buttonPressedChanged) public: - QWaylandPointer(QWaylandInputDevice *inputDevice, QObject *parent = nullptr); + QWaylandPointer(QWaylandSeat *seat, QObject *parent = nullptr); - QWaylandInputDevice *inputDevice() const; + QWaylandSeat *seat() const; QWaylandCompositor *compositor() const; QWaylandOutput *output() const; diff --git a/src/compositor/compositor_api/qwaylandpointer_p.h b/src/compositor/compositor_api/qwaylandpointer_p.h index 5ac030029..54ac72d11 100644 --- a/src/compositor/compositor_api/qwaylandpointer_p.h +++ b/src/compositor/compositor_api/qwaylandpointer_p.h @@ -61,7 +61,7 @@ #include <QtWaylandCompositor/private/qwayland-server-wayland.h> #include <QtWaylandCompositor/QWaylandView> #include <QtWaylandCompositor/QWaylandSurface> -#include <QtWaylandCompositor/QWaylandInputDevice> +#include <QtWaylandCompositor/QWaylandSeat> #include <stdint.h> @@ -74,7 +74,7 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandPointerPrivate : public QObjectPrivate { Q_DECLARE_PUBLIC(QWaylandPointer) public: - QWaylandPointerPrivate(QWaylandPointer *pointer, QWaylandInputDevice *seat); + QWaylandPointerPrivate(QWaylandPointer *pointer, QWaylandSeat *seat); QWaylandCompositor *compositor() const { return seat->compositor(); } @@ -86,7 +86,7 @@ protected: private: void focusDestroyed(void *data); - QWaylandInputDevice *seat; + QWaylandSeat *seat; QWaylandOutput *output; QPointF localPosition; diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp index f47104d7e..2b24938fa 100644 --- a/src/compositor/compositor_api/qwaylandquickitem.cpp +++ b/src/compositor/compositor_api/qwaylandquickitem.cpp @@ -41,7 +41,7 @@ #include "qwaylandtextinput.h" #include "qwaylandquickoutput.h" #include <QtWaylandCompositor/qwaylandcompositor.h> -#include <QtWaylandCompositor/qwaylandinput.h> +#include <QtWaylandCompositor/qwaylandseat.h> #include <QtWaylandCompositor/qwaylandbufferref.h> #include <QtWaylandCompositor/QWaylandDrag> #include <QtWaylandCompositor/private/qwlclientbufferintegration_p.h> @@ -495,13 +495,13 @@ void QWaylandQuickItem::mousePressEvent(QMouseEvent *event) return; } - QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event); + QWaylandSeat *seat = compositor()->seatFor(event); if (d->focusOnClick) - takeFocus(inputDevice); + takeFocus(seat); - inputDevice->sendMouseMoveEvent(d->view.data(), mapToSurface(event->localPos()), event->windowPos()); - inputDevice->sendMousePressEvent(event->button()); + seat->sendMouseMoveEvent(d->view.data(), mapToSurface(event->localPos()), event->windowPos()); + seat->sendMousePressEvent(event->button()); } /*! @@ -511,7 +511,7 @@ void QWaylandQuickItem::mouseMoveEvent(QMouseEvent *event) { Q_D(QWaylandQuickItem); if (d->shouldSendInputEvents()) { - QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event); + QWaylandSeat *seat = compositor()->seatFor(event); if (d->isDragging) { QWaylandQuickOutput *currentOutput = qobject_cast<QWaylandQuickOutput *>(view()->output()); //TODO: also check if dragging onto other outputs @@ -520,10 +520,10 @@ void QWaylandQuickItem::mouseMoveEvent(QMouseEvent *event) if (targetSurface) { QPointF position = mapToItem(targetItem, event->localPos()); QPointF surfacePosition = targetItem->mapToSurface(position); - inputDevice->drag()->dragMove(targetSurface, surfacePosition); + seat->drag()->dragMove(targetSurface, surfacePosition); } } else { - inputDevice->sendMouseMoveEvent(d->view.data(), mapToSurface(event->localPos()), event->windowPos()); + seat->sendMouseMoveEvent(d->view.data(), mapToSurface(event->localPos()), event->windowPos()); } } else { emit mouseMove(event->windowPos()); @@ -538,12 +538,12 @@ void QWaylandQuickItem::mouseReleaseEvent(QMouseEvent *event) { Q_D(QWaylandQuickItem); if (d->shouldSendInputEvents()) { - QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event); + QWaylandSeat *seat = compositor()->seatFor(event); if (d->isDragging) { d->isDragging = false; - inputDevice->drag()->drop(); + seat->drag()->drop(); } else { - inputDevice->sendMouseReleaseEvent(event->button()); + seat->sendMouseReleaseEvent(event->button()); } } else { emit mouseRelease(); @@ -562,8 +562,8 @@ void QWaylandQuickItem::hoverEnterEvent(QHoverEvent *event) return; } if (d->shouldSendInputEvents()) { - QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event); - inputDevice->sendMouseMoveEvent(d->view.data(), event->pos(), mapToScene(event->pos())); + QWaylandSeat *seat = compositor()->seatFor(event); + seat->sendMouseMoveEvent(d->view.data(), event->pos(), mapToScene(event->pos())); } else { event->ignore(); } @@ -582,8 +582,8 @@ void QWaylandQuickItem::hoverMoveEvent(QHoverEvent *event) } } if (d->shouldSendInputEvents()) { - QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event); - inputDevice->sendMouseMoveEvent(d->view.data(), mapToSurface(event->pos()), mapToScene(event->pos())); + QWaylandSeat *seat = compositor()->seatFor(event); + seat->sendMouseMoveEvent(d->view.data(), mapToSurface(event->pos()), mapToScene(event->pos())); } else { event->ignore(); } @@ -596,8 +596,8 @@ void QWaylandQuickItem::hoverLeaveEvent(QHoverEvent *event) { Q_D(QWaylandQuickItem); if (d->shouldSendInputEvents()) { - QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event); - inputDevice->setMouseFocus(Q_NULLPTR); + QWaylandSeat *seat = compositor()->seatFor(event); + seat->setMouseFocus(Q_NULLPTR); } else { event->ignore(); } @@ -615,8 +615,8 @@ void QWaylandQuickItem::wheelEvent(QWheelEvent *event) return; } - QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event); - inputDevice->sendMouseWheelEvent(event->orientation(), event->delta()); + QWaylandSeat *seat = compositor()->seatFor(event); + seat->sendMouseWheelEvent(event->orientation(), event->delta()); } else { event->ignore(); } @@ -629,8 +629,8 @@ void QWaylandQuickItem::keyPressEvent(QKeyEvent *event) { Q_D(QWaylandQuickItem); if (d->shouldSendInputEvents()) { - QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event); - inputDevice->sendFullKeyEvent(event); + QWaylandSeat *seat = compositor()->seatFor(event); + seat->sendFullKeyEvent(event); } else { event->ignore(); } @@ -643,8 +643,8 @@ void QWaylandQuickItem::keyReleaseEvent(QKeyEvent *event) { Q_D(QWaylandQuickItem); if (d->shouldSendInputEvents() && hasFocus()) { - QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event); - inputDevice->sendFullKeyEvent(event); + QWaylandSeat *seat = compositor()->seatFor(event); + seat->sendFullKeyEvent(event); } else { event->ignore(); } @@ -657,7 +657,7 @@ void QWaylandQuickItem::touchEvent(QTouchEvent *event) { Q_D(QWaylandQuickItem); if (d->shouldSendInputEvents() && d->touchEventsEnabled) { - QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event); + QWaylandSeat *seat = compositor()->seatFor(event); if (event->type() == QEvent::TouchBegin) { QQuickItem *grabber = window()->mouseGrabberItem(); @@ -676,10 +676,10 @@ void QWaylandQuickItem::touchEvent(QTouchEvent *event) } event->accept(); - if (inputDevice->mouseFocus() != d->view.data()) { - inputDevice->sendMouseMoveEvent(d->view.data(), pointPos, mapToScene(pointPos)); + if (seat->mouseFocus() != d->view.data()) { + seat->sendMouseMoveEvent(d->view.data(), pointPos, mapToScene(pointPos)); } - inputDevice->sendFullTouchEvent(event); + seat->sendFullTouchEvent(event); } else { event->ignore(); } @@ -830,16 +830,16 @@ void QWaylandQuickItem::handleSurfaceChanged() * Calling this function causes the item to take the focus of the * input \a device. */ -void QWaylandQuickItem::takeFocus(QWaylandInputDevice *device) +void QWaylandQuickItem::takeFocus(QWaylandSeat *device) { forceActiveFocus(); if (!surface()) return; - QWaylandInputDevice *target = device; + QWaylandSeat *target = device; if (!target) { - target = compositor()->defaultInputDevice(); + target = compositor()->defaultSeat(); } target->setKeyboardFocus(surface()); QWaylandTextInput *textInput = QWaylandTextInput::findIn(target); @@ -1203,7 +1203,7 @@ void QWaylandQuickItem::handleDragStarted(QWaylandDrag *drag) { Q_D(QWaylandQuickItem); Q_ASSERT(drag->origin() == surface()); - drag->inputDevice()->setMouseFocus(nullptr); + drag->seat()->setMouseFocus(nullptr); d->isDragging = true; } diff --git a/src/compositor/compositor_api/qwaylandquickitem.h b/src/compositor/compositor_api/qwaylandquickitem.h index 7b5627aa2..0a6c78919 100644 --- a/src/compositor/compositor_api/qwaylandquickitem.h +++ b/src/compositor/compositor_api/qwaylandquickitem.h @@ -51,7 +51,7 @@ Q_DECLARE_METATYPE(QWaylandQuickSurface*) QT_BEGIN_NAMESPACE -class QWaylandInputDevice; +class QWaylandSeat; class QWaylandQuickItemPrivate; class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandQuickItem : public QQuickItem @@ -129,7 +129,7 @@ protected: virtual void surfaceChangedEvent(QWaylandSurface *newSurface, QWaylandSurface *oldSurface); public Q_SLOTS: - virtual void takeFocus(QWaylandInputDevice *device = nullptr); + virtual void takeFocus(QWaylandSeat *device = nullptr); void setPaintEnabled(bool paintEnabled); void raise(); void lower(); diff --git a/src/compositor/compositor_api/qwaylandinput.cpp b/src/compositor/compositor_api/qwaylandseat.cpp index 4c2a0b439..1f5fd026e 100644 --- a/src/compositor/compositor_api/qwaylandinput.cpp +++ b/src/compositor/compositor_api/qwaylandseat.cpp @@ -34,8 +34,8 @@ ** ****************************************************************************/ -#include "qwaylandinput.h" -#include "qwaylandinput_p.h" +#include "qwaylandseat.h" +#include "qwaylandseat_p.h" #include "qwaylandcompositor.h" #include "qwaylandinputmethodcontrol.h" @@ -44,7 +44,7 @@ #include <QtWaylandCompositor/QWaylandTouch> #include <QtWaylandCompositor/QWaylandPointer> #include <QtWaylandCompositor/QWaylandWlShellSurface> -#include <QtWaylandCompositor/private/qwaylandinput_p.h> +#include <QtWaylandCompositor/private/qwaylandseat_p.h> #include <QtWaylandCompositor/private/qwaylandcompositor_p.h> #include <QtWaylandCompositor/private/qwldatadevice_p.h> @@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE -QWaylandInputDevicePrivate::QWaylandInputDevicePrivate(QWaylandInputDevice *inputdevice, QWaylandCompositor *compositor) +QWaylandSeatPrivate::QWaylandSeatPrivate(QWaylandSeat *seat, QWaylandCompositor *compositor) : QObjectPrivate() , QtWaylandServer::wl_seat(compositor->display(), 4) , compositor(compositor) @@ -61,29 +61,29 @@ QWaylandInputDevicePrivate::QWaylandInputDevicePrivate(QWaylandInputDevice *inpu , keyboardFocus(nullptr) , capabilities() , data_device() - , drag_handle(new QWaylandDrag(inputdevice)) + , drag_handle(new QWaylandDrag(seat)) { } -QWaylandInputDevicePrivate::~QWaylandInputDevicePrivate() +QWaylandSeatPrivate::~QWaylandSeatPrivate() { } -void QWaylandInputDevicePrivate::setCapabilities(QWaylandInputDevice::CapabilityFlags caps) +void QWaylandSeatPrivate::setCapabilities(QWaylandSeat::CapabilityFlags caps) { - Q_Q(QWaylandInputDevice); + Q_Q(QWaylandSeat); if (capabilities != caps) { - QWaylandInputDevice::CapabilityFlags changed = caps ^ capabilities; + QWaylandSeat::CapabilityFlags changed = caps ^ capabilities; - if (changed & QWaylandInputDevice::Pointer) { + if (changed & QWaylandSeat::Pointer) { pointer.reset(pointer.isNull() ? QWaylandCompositorPrivate::get(compositor)->callCreatePointerDevice(q) : 0); } - if (changed & QWaylandInputDevice::Keyboard) { + if (changed & QWaylandSeat::Keyboard) { keyboard.reset(keyboard.isNull() ? QWaylandCompositorPrivate::get(compositor)->callCreateKeyboardDevice(q) : 0); } - if (changed & QWaylandInputDevice::Touch) { + if (changed & QWaylandSeat::Touch) { touch.reset(touch.isNull() ? QWaylandCompositorPrivate::get(compositor)->callCreateTouchDevice(q) : 0); } @@ -93,45 +93,45 @@ void QWaylandInputDevicePrivate::setCapabilities(QWaylandInputDevice::Capability wl_seat::send_capabilities(resources.at(i)->handle, (uint32_t)capabilities); } - if ((changed & caps & QWaylandInputDevice::Keyboard) && keyboardFocus != nullptr) + if ((changed & caps & QWaylandSeat::Keyboard) && keyboardFocus != nullptr) keyboard->setFocus(keyboardFocus); } } -void QWaylandInputDevicePrivate::clientRequestedDataDevice(QtWayland::DataDeviceManager *, struct wl_client *client, uint32_t id) +void QWaylandSeatPrivate::clientRequestedDataDevice(QtWayland::DataDeviceManager *, struct wl_client *client, uint32_t id) { - Q_Q(QWaylandInputDevice); + Q_Q(QWaylandSeat); if (!data_device) data_device.reset(new QtWayland::DataDevice(q)); data_device->add(client, id, 1); } -void QWaylandInputDevicePrivate::seat_destroy_resource(wl_seat::Resource *) +void QWaylandSeatPrivate::seat_destroy_resource(wl_seat::Resource *) { // cleanupDataDeviceForClient(resource->client(), true); } -void QWaylandInputDevicePrivate::seat_bind_resource(wl_seat::Resource *resource) +void QWaylandSeatPrivate::seat_bind_resource(wl_seat::Resource *resource) { // The order of capabilities matches the order defined in the wayland protocol wl_seat::send_capabilities(resource->handle, (uint32_t)capabilities); } -void QWaylandInputDevicePrivate::seat_get_pointer(wl_seat::Resource *resource, uint32_t id) +void QWaylandSeatPrivate::seat_get_pointer(wl_seat::Resource *resource, uint32_t id) { if (!pointer.isNull()) { pointer->addClient(QWaylandClient::fromWlClient(compositor, resource->client()), id, resource->version()); } } -void QWaylandInputDevicePrivate::seat_get_keyboard(wl_seat::Resource *resource, uint32_t id) +void QWaylandSeatPrivate::seat_get_keyboard(wl_seat::Resource *resource, uint32_t id) { if (!keyboard.isNull()) { keyboard->addClient(QWaylandClient::fromWlClient(compositor, resource->client()), id, resource->version()); } } -void QWaylandInputDevicePrivate::seat_get_touch(wl_seat::Resource *resource, uint32_t id) +void QWaylandSeatPrivate::seat_get_touch(wl_seat::Resource *resource, uint32_t id) { if (!touch.isNull()) { touch->addClient(QWaylandClient::fromWlClient(compositor, resource->client()), id, resource->version()); @@ -149,56 +149,56 @@ QWaylandKeymap::QWaylandKeymap(const QString &layout, const QString &variant, co /*! - * \class QWaylandInputDevice + * \class QWaylandSeat * \inmodule QtWaylandCompositor * \preliminary - * \brief The QWaylandInputDevice class provides access to keyboard, mouse and touch input. + * \brief The QWaylandSeat class provides access to keyboard, mouse and touch input. * - * The QWaylandInputDevice provides access to different types of user input and maintains + * The QWaylandSeat provides access to different types of user input and maintains * a keyboard focus and a mouse pointer. It corresponds to the wl_seat interface in the Wayland protocol. */ /*! - * \enum QWaylandInputDevice::CapabilityFlag + * \enum QWaylandSeat::CapabilityFlag * - * This enum type describes the capabilities of a QWaylandInputDevice. + * This enum type describes the capabilities of a QWaylandSeat. * - * \value Pointer The QWaylandInputDevice supports pointer input. - * \value Keyboard The QWaylandInputDevice supports keyboard input. - * \value Touch The QWaylandInputDevice supports touch input. + * \value Pointer The QWaylandSeat supports pointer input. + * \value Keyboard The QWaylandSeat supports keyboard input. + * \value Touch The QWaylandSeat supports touch input. */ /*! - * Constructs a QWaylandInputDevice for the given \a compositor and with the given \a capabilityFlags. + * Constructs a QWaylandSeat for the given \a compositor and with the given \a capabilityFlags. */ -QWaylandInputDevice::QWaylandInputDevice(QWaylandCompositor *compositor, CapabilityFlags capabilityFlags) - : QWaylandObject(*new QWaylandInputDevicePrivate(this,compositor)) +QWaylandSeat::QWaylandSeat(QWaylandCompositor *compositor, CapabilityFlags capabilityFlags) + : QWaylandObject(*new QWaylandSeatPrivate(this,compositor)) { d_func()->setCapabilities(capabilityFlags); } /*! - * Destroys the QWaylandInputDevice + * Destroys the QWaylandSeat */ -QWaylandInputDevice::~QWaylandInputDevice() +QWaylandSeat::~QWaylandSeat() { } /*! - * Sends a mouse press event for \a button to the QWaylandInputDevice's pointer device. + * Sends a mouse press event for \a button to the QWaylandSeat's pointer device. */ -void QWaylandInputDevice::sendMousePressEvent(Qt::MouseButton button) +void QWaylandSeat::sendMousePressEvent(Qt::MouseButton button) { - Q_D(QWaylandInputDevice); + Q_D(QWaylandSeat); d->pointer->sendMousePressEvent(button); } /*! - * Sends a mouse release event for \a button to the QWaylandInputDevice's pointer device. + * Sends a mouse release event for \a button to the QWaylandSeat's pointer device. */ -void QWaylandInputDevice::sendMouseReleaseEvent(Qt::MouseButton button) +void QWaylandSeat::sendMouseReleaseEvent(Qt::MouseButton button) { - Q_D(QWaylandInputDevice); + Q_D(QWaylandSeat); d->pointer->sendMouseReleaseEvent(button); } @@ -206,36 +206,36 @@ void QWaylandInputDevice::sendMouseReleaseEvent(Qt::MouseButton button) * Sets the mouse focus to \a view and sends a mouse move event to the pointer device with the * local position \a localPos and output space position \a outputSpacePos. **/ -void QWaylandInputDevice::sendMouseMoveEvent(QWaylandView *view, const QPointF &localPos, const QPointF &outputSpacePos) +void QWaylandSeat::sendMouseMoveEvent(QWaylandView *view, const QPointF &localPos, const QPointF &outputSpacePos) { - Q_D(QWaylandInputDevice); + Q_D(QWaylandSeat); d->pointer->sendMouseMoveEvent(view, localPos, outputSpacePos); } /*! - * Sends a mouse wheel event to the QWaylandInputDevice's pointer device with the given \a orientation and \a delta. + * Sends a mouse wheel event to the QWaylandSeat's pointer device with the given \a orientation and \a delta. */ -void QWaylandInputDevice::sendMouseWheelEvent(Qt::Orientation orientation, int delta) +void QWaylandSeat::sendMouseWheelEvent(Qt::Orientation orientation, int delta) { - Q_D(QWaylandInputDevice); + Q_D(QWaylandSeat); d->pointer->sendMouseWheelEvent(orientation, delta); } /*! * Sends a key press event with the key \a code to the keyboard device. */ -void QWaylandInputDevice::sendKeyPressEvent(uint code) +void QWaylandSeat::sendKeyPressEvent(uint code) { - Q_D(QWaylandInputDevice); + Q_D(QWaylandSeat); d->keyboard->sendKeyPressEvent(code); } /*! * Sends a key release event with the key \a code to the keyboard device. */ -void QWaylandInputDevice::sendKeyReleaseEvent(uint code) +void QWaylandSeat::sendKeyReleaseEvent(uint code) { - Q_D(QWaylandInputDevice); + Q_D(QWaylandSeat); d->keyboard->sendKeyReleaseEvent(code); } @@ -243,9 +243,9 @@ void QWaylandInputDevice::sendKeyReleaseEvent(uint code) * Sends a touch point event with the given \a id and \a state to the touch device. The position * of the touch point is given by \a point. */ -void QWaylandInputDevice::sendTouchPointEvent(int id, const QPointF &point, Qt::TouchPointState state) +void QWaylandSeat::sendTouchPointEvent(int id, const QPointF &point, Qt::TouchPointState state) { - Q_D(QWaylandInputDevice); + Q_D(QWaylandSeat); if (d->touch.isNull()) { return; } @@ -255,9 +255,9 @@ void QWaylandInputDevice::sendTouchPointEvent(int id, const QPointF &point, Qt:: /*! * Sends a frame event to the touch device. */ -void QWaylandInputDevice::sendTouchFrameEvent() +void QWaylandSeat::sendTouchFrameEvent() { - Q_D(QWaylandInputDevice); + Q_D(QWaylandSeat); if (!d->touch.isNull()) { d->touch->sendFrameEvent(); } @@ -266,9 +266,9 @@ void QWaylandInputDevice::sendTouchFrameEvent() /*! * Sends a cancel event to the touch device. */ -void QWaylandInputDevice::sendTouchCancelEvent() +void QWaylandSeat::sendTouchCancelEvent() { - Q_D(QWaylandInputDevice); + Q_D(QWaylandSeat); if (!d->touch.isNull()) { d->touch->sendCancelEvent(); } @@ -277,9 +277,9 @@ void QWaylandInputDevice::sendTouchCancelEvent() /*! * Sends the \a event to the touch device. */ -void QWaylandInputDevice::sendFullTouchEvent(QTouchEvent *event) +void QWaylandSeat::sendFullTouchEvent(QTouchEvent *event) { - Q_D(QWaylandInputDevice); + Q_D(QWaylandSeat); if (!mouseFocus()) { qWarning("Cannot send touch event, no pointer focus, fix the compositor"); return; @@ -294,9 +294,9 @@ void QWaylandInputDevice::sendFullTouchEvent(QTouchEvent *event) /*! * Sends the \a event to the keyboard device. */ -void QWaylandInputDevice::sendFullKeyEvent(QKeyEvent *event) +void QWaylandSeat::sendFullKeyEvent(QKeyEvent *event) { - Q_D(QWaylandInputDevice); + Q_D(QWaylandSeat); if (!keyboardFocus()) { qWarning("Cannot send key event, no keyboard focus, fix the compositor"); @@ -327,18 +327,18 @@ void QWaylandInputDevice::sendFullKeyEvent(QKeyEvent *event) /*! * Returns the keyboard for this input device. */ -QWaylandKeyboard *QWaylandInputDevice::keyboard() const +QWaylandKeyboard *QWaylandSeat::keyboard() const { - Q_D(const QWaylandInputDevice); + Q_D(const QWaylandSeat); return d->keyboard.data(); } /*! * Returns the current focused surface for keyboard input. */ -QWaylandSurface *QWaylandInputDevice::keyboardFocus() const +QWaylandSurface *QWaylandSeat::keyboardFocus() const { - Q_D(const QWaylandInputDevice); + Q_D(const QWaylandSeat); if (d->keyboard.isNull() || !d->keyboard->focus()) return Q_NULLPTR; @@ -348,9 +348,9 @@ QWaylandSurface *QWaylandInputDevice::keyboardFocus() const /*! * Sets the current keyboard focus to \a surface. */ -bool QWaylandInputDevice::setKeyboardFocus(QWaylandSurface *surface) +bool QWaylandSeat::setKeyboardFocus(QWaylandSurface *surface) { - Q_D(QWaylandInputDevice); + Q_D(QWaylandSeat); if (surface && surface->isDestroyed()) return false; @@ -372,47 +372,47 @@ bool QWaylandInputDevice::setKeyboardFocus(QWaylandSurface *surface) } /*! - * Sets the key map of this QWaylandInputDevice to \a keymap. + * Sets the key map of this QWaylandSeat to \a keymap. */ -void QWaylandInputDevice::setKeymap(const QWaylandKeymap &keymap) +void QWaylandSeat::setKeymap(const QWaylandKeymap &keymap) { if (keyboard()) keyboard()->setKeymap(keymap); } /*! - * Returns the pointer device for this QWaylandInputDevice. + * Returns the pointer device for this QWaylandSeat. */ -QWaylandPointer *QWaylandInputDevice::pointer() const +QWaylandPointer *QWaylandSeat::pointer() const { - Q_D(const QWaylandInputDevice); + Q_D(const QWaylandSeat); return d->pointer.data(); } /*! - * Returns the touch device for this QWaylandInputDevice. + * Returns the touch device for this QWaylandSeat. */ -QWaylandTouch *QWaylandInputDevice::touch() const +QWaylandTouch *QWaylandSeat::touch() const { - Q_D(const QWaylandInputDevice); + Q_D(const QWaylandSeat); return d->touch.data(); } /*! * Returns the view that currently has mouse focus. */ -QWaylandView *QWaylandInputDevice::mouseFocus() const +QWaylandView *QWaylandSeat::mouseFocus() const { - Q_D(const QWaylandInputDevice); + Q_D(const QWaylandSeat); return d->mouseFocus; } /*! * Sets the current mouse focus to \a view. */ -void QWaylandInputDevice::setMouseFocus(QWaylandView *view) +void QWaylandSeat::setMouseFocus(QWaylandView *view) { - Q_D(QWaylandInputDevice); + Q_D(QWaylandSeat); if (view == d->mouseFocus) return; @@ -422,52 +422,52 @@ void QWaylandInputDevice::setMouseFocus(QWaylandView *view) } /*! - * Returns the compositor for this QWaylandInputDevice. + * Returns the compositor for this QWaylandSeat. */ -QWaylandCompositor *QWaylandInputDevice::compositor() const +QWaylandCompositor *QWaylandSeat::compositor() const { - Q_D(const QWaylandInputDevice); + Q_D(const QWaylandSeat); return d->compositor; } /*! - * Returns the drag object for this QWaylandInputDevice. + * Returns the drag object for this QWaylandSeat. */ -QWaylandDrag *QWaylandInputDevice::drag() const +QWaylandDrag *QWaylandSeat::drag() const { - Q_D(const QWaylandInputDevice); + Q_D(const QWaylandSeat); return d->drag_handle.data(); } /*! - * Returns the capability flags for this QWaylandInputDevice. + * Returns the capability flags for this QWaylandSeat. */ -QWaylandInputDevice::CapabilityFlags QWaylandInputDevice::capabilities() const +QWaylandSeat::CapabilityFlags QWaylandSeat::capabilities() const { - Q_D(const QWaylandInputDevice); + Q_D(const QWaylandSeat); return d->capabilities; } /*! * \internal */ -bool QWaylandInputDevice::isOwner(QInputEvent *inputEvent) const +bool QWaylandSeat::isOwner(QInputEvent *inputEvent) const { Q_UNUSED(inputEvent); return true; } /*! - * Returns the QWaylandInputDevice corresponding to the \a resource. The \a resource is expected + * Returns the QWaylandSeat corresponding to the \a resource. The \a resource is expected * to have the type wl_seat. */ -QWaylandInputDevice *QWaylandInputDevice::fromSeatResource(struct ::wl_resource *resource) +QWaylandSeat *QWaylandSeat::fromSeatResource(struct ::wl_resource *resource) { - return static_cast<QWaylandInputDevicePrivate *>(QWaylandInputDevicePrivate::Resource::fromResource(resource)->seat_object)->q_func(); + return static_cast<QWaylandSeatPrivate *>(QWaylandSeatPrivate::Resource::fromResource(resource)->seat_object)->q_func(); } /*! - * \fn void QWaylandInputDevice::mouseFocusChanged(QWaylandView *newFocus, QWaylandView *oldFocus) + * \fn void QWaylandSeat::mouseFocusChanged(QWaylandView *newFocus, QWaylandView *oldFocus) * * This signal is emitted when the mouse focus has changed from \a oldFocus to \a newFocus. */ diff --git a/src/compositor/compositor_api/qwaylandinput.h b/src/compositor/compositor_api/qwaylandseat.h index 51e5ad0ec..bfd6e4041 100644 --- a/src/compositor/compositor_api/qwaylandinput.h +++ b/src/compositor/compositor_api/qwaylandseat.h @@ -34,8 +34,8 @@ ** ****************************************************************************/ -#ifndef QWAYLANDINPUT_H -#define QWAYLANDINPUT_H +#ifndef QWAYLANDSEAT_H +#define QWAYLANDSEAT_H #include <QtCore/qnamespace.h> #include <QtCore/QPoint> @@ -53,20 +53,16 @@ class QKeyEvent; class QTouchEvent; class QWaylandView; class QInputEvent; -class QWaylandInputDevicePrivate; +class QWaylandSeatPrivate; class QWaylandDrag; class QWaylandKeyboard; class QWaylandPointer; class QWaylandTouch; -namespace QtWayland { -class InputDevice; -} - -class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandInputDevice : public QWaylandObject +class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandSeat : public QWaylandObject { Q_OBJECT - Q_DECLARE_PRIVATE(QWaylandInputDevice) + Q_DECLARE_PRIVATE(QWaylandSeat) Q_PROPERTY(QWaylandDrag *drag READ drag CONSTANT) public: @@ -81,8 +77,8 @@ public: Q_DECLARE_FLAGS(CapabilityFlags, CapabilityFlag) Q_ENUM(CapabilityFlags) - QWaylandInputDevice(QWaylandCompositor *compositor, CapabilityFlags capabilityFlags = DefaultCapabilities); - virtual ~QWaylandInputDevice(); + QWaylandSeat(QWaylandCompositor *compositor, CapabilityFlags capabilityFlags = DefaultCapabilities); + virtual ~QWaylandSeat(); void sendMousePressEvent(Qt::MouseButton button); void sendMouseReleaseEvent(Qt::MouseButton button); @@ -118,11 +114,11 @@ public: QWaylandDrag *drag() const; - QWaylandInputDevice::CapabilityFlags capabilities() const; + QWaylandSeat::CapabilityFlags capabilities() const; virtual bool isOwner(QInputEvent *inputEvent) const; - static QWaylandInputDevice *fromSeatResource(struct ::wl_resource *resource); + static QWaylandSeat *fromSeatResource(struct ::wl_resource *resource); Q_SIGNALS: void mouseFocusChanged(QWaylandView *newFocus, QWaylandView *oldFocus); @@ -130,8 +126,8 @@ Q_SIGNALS: void cursorSurfaceRequest(QWaylandSurface *surface, int hotspotX, int hotspotY); }; -Q_DECLARE_OPERATORS_FOR_FLAGS(QWaylandInputDevice::CapabilityFlags) +Q_DECLARE_OPERATORS_FOR_FLAGS(QWaylandSeat::CapabilityFlags) QT_END_NAMESPACE -#endif // QWAYLANDINPUT_H +#endif // QWAYLANDSEAT_H diff --git a/src/compositor/compositor_api/qwaylandinput_p.h b/src/compositor/compositor_api/qwaylandseat_p.h index 5e57c43cc..6588600cf 100644 --- a/src/compositor/compositor_api/qwaylandinput_p.h +++ b/src/compositor/compositor_api/qwaylandseat_p.h @@ -34,8 +34,8 @@ ** ****************************************************************************/ -#ifndef QWAYLANDINPUT_P_H -#define QWAYLANDINPUT_P_H +#ifndef QWAYLANDSEAT_P_H +#define QWAYLANDSEAT_P_H // // W A R N I N G @@ -51,7 +51,7 @@ #include <stdint.h> #include <QtWaylandCompositor/qwaylandexport.h> -#include <QtWaylandCompositor/qwaylandinput.h> +#include <QtWaylandCompositor/qwaylandseat.h> #include <QtCore/QList> #include <QtCore/QPoint> @@ -68,7 +68,7 @@ QT_BEGIN_NAMESPACE class QKeyEvent; class QTouchEvent; -class QWaylandInputDevice; +class QWaylandSeat; class QWaylandDrag; class QWaylandView; @@ -85,18 +85,18 @@ class InputMethod; } -class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandInputDevicePrivate : public QObjectPrivate, public QtWaylandServer::wl_seat +class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandSeatPrivate : public QObjectPrivate, public QtWaylandServer::wl_seat { public: - Q_DECLARE_PUBLIC(QWaylandInputDevice) + Q_DECLARE_PUBLIC(QWaylandSeat) - QWaylandInputDevicePrivate(QWaylandInputDevice *device, QWaylandCompositor *compositor); - ~QWaylandInputDevicePrivate(); + QWaylandSeatPrivate(QWaylandSeat *seat, QWaylandCompositor *compositor); + ~QWaylandSeatPrivate(); void clientRequestedDataDevice(QtWayland::DataDeviceManager *dndSelection, struct wl_client *client, uint32_t id); - void setCapabilities(QWaylandInputDevice::CapabilityFlags caps); + void setCapabilities(QWaylandSeat::CapabilityFlags caps); - static QWaylandInputDevicePrivate *get(QWaylandInputDevice *device) { return device->d_func(); } + static QWaylandSeatPrivate *get(QWaylandSeat *device) { return device->d_func(); } QtWayland::DataDevice *dataDevice() const { return data_device.data(); } @@ -116,7 +116,7 @@ private: QWaylandCompositor *compositor; QWaylandView *mouseFocus; QWaylandSurface *keyboardFocus; - QWaylandInputDevice::CapabilityFlags capabilities; + QWaylandSeat::CapabilityFlags capabilities; QScopedPointer<QWaylandPointer> pointer; QScopedPointer<QWaylandKeyboard> keyboard; @@ -128,4 +128,4 @@ private: QT_END_NAMESPACE -#endif // QWAYLANDINPUT_P_H +#endif // QWAYLANDSEAT_P_H diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp index d039fc94f..98f6a1d28 100644 --- a/src/compositor/compositor_api/qwaylandsurface.cpp +++ b/src/compositor/compositor_api/qwaylandsurface.cpp @@ -52,7 +52,7 @@ #include <QtWaylandCompositor/private/qwaylandcompositor_p.h> #include <QtWaylandCompositor/private/qwaylandview_p.h> -#include <QtWaylandCompositor/private/qwaylandinput_p.h> +#include <QtWaylandCompositor/private/qwaylandseat_p.h> #include <QtCore/private/qobject_p.h> @@ -708,9 +708,9 @@ QWaylandInputMethodControl *QWaylandSurface::inputMethodControl() const void QWaylandSurface::updateSelection() { Q_D(QWaylandSurface); - QWaylandInputDevice *inputDevice = d->compositor->defaultInputDevice(); - if (inputDevice) { - const QtWayland::DataDevice *dataDevice = QWaylandInputDevicePrivate::get(inputDevice)->dataDevice(); + QWaylandSeat *seat = d->compositor->defaultSeat(); + if (seat) { + const QtWayland::DataDevice *dataDevice = QWaylandSeatPrivate::get(seat)->dataDevice(); if (dataDevice) { QWaylandCompositorPrivate::get(d->compositor)->dataDeviceManager()->offerRetainedSelection( dataDevice->resourceMap().value(d->resource()->client())->handle); diff --git a/src/compositor/compositor_api/qwaylandtouch.cpp b/src/compositor/compositor_api/qwaylandtouch.cpp index 481c29e7b..c07809e71 100644 --- a/src/compositor/compositor_api/qwaylandtouch.cpp +++ b/src/compositor/compositor_api/qwaylandtouch.cpp @@ -38,7 +38,7 @@ #include "qwaylandtouch_p.h" #include <QtWaylandCompositor/QWaylandCompositor> -#include <QtWaylandCompositor/QWaylandInputDevice> +#include <QtWaylandCompositor/QWaylandSeat> #include <QtWaylandCompositor/QWaylandView> #include <QtWaylandCompositor/QWaylandClient> @@ -46,7 +46,7 @@ QT_BEGIN_NAMESPACE -QWaylandTouchPrivate::QWaylandTouchPrivate(QWaylandTouch *touch, QWaylandInputDevice *seat) +QWaylandTouchPrivate::QWaylandTouchPrivate(QWaylandTouch *touch, QWaylandSeat *seat) : wl_touch() , seat(seat) , focusResource() @@ -113,15 +113,15 @@ void QWaylandTouchPrivate::sendMotion(uint32_t time, int touch_id, const QPointF * \preliminary * \brief The QWaylandTouch class provides access to a touch device. * - * This class provides access to the touch device in a QWaylandInputDevice. It corresponds to + * This class provides access to the touch device in a QWaylandSeat. It corresponds to * the Wayland interface wl_touch. */ /*! - * Constructs a QWaylandTouch for the \a inputDevice and with the given \a parent. + * Constructs a QWaylandTouch for the \a seat and with the given \a parent. */ -QWaylandTouch::QWaylandTouch(QWaylandInputDevice *inputDevice, QObject *parent) - : QWaylandObject(*new QWaylandTouchPrivate(this, inputDevice), parent) +QWaylandTouch::QWaylandTouch(QWaylandSeat *seat, QObject *parent) + : QWaylandObject(*new QWaylandTouchPrivate(this, seat), parent) { connect(&d_func()->focusDestroyListener, &QWaylandDestroyListener::fired, this, &QWaylandTouch::focusDestroyed); } @@ -129,7 +129,7 @@ QWaylandTouch::QWaylandTouch(QWaylandInputDevice *inputDevice, QObject *parent) /*! * Returns the input device for this QWaylandTouch. */ -QWaylandInputDevice *QWaylandTouch::inputDevice() const +QWaylandSeat *QWaylandTouch::seat() const { Q_D(const QWaylandTouch); return d->seat; diff --git a/src/compositor/compositor_api/qwaylandtouch.h b/src/compositor/compositor_api/qwaylandtouch.h index 670e892f4..c058d42ae 100644 --- a/src/compositor/compositor_api/qwaylandtouch.h +++ b/src/compositor/compositor_api/qwaylandtouch.h @@ -48,7 +48,7 @@ QT_BEGIN_NAMESPACE class QWaylandTouch; class QWaylandTouchPrivate; -class QWaylandInputDevice; +class QWaylandSeat; class QWaylandView; class QWaylandClient; @@ -57,9 +57,9 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandTouch : public QWaylandObject Q_OBJECT Q_DECLARE_PRIVATE(QWaylandTouch) public: - QWaylandTouch(QWaylandInputDevice *inputDevice, QObject *parent = nullptr); + QWaylandTouch(QWaylandSeat *seat, QObject *parent = nullptr); - QWaylandInputDevice *inputDevice() const; + QWaylandSeat *seat() const; QWaylandCompositor *compositor() const; virtual void sendTouchPointEvent(int id, const QPointF &position, Qt::TouchPointState state); diff --git a/src/compositor/compositor_api/qwaylandtouch_p.h b/src/compositor/compositor_api/qwaylandtouch_p.h index ea334eea1..2f60076a7 100644 --- a/src/compositor/compositor_api/qwaylandtouch_p.h +++ b/src/compositor/compositor_api/qwaylandtouch_p.h @@ -52,7 +52,7 @@ #include <QtWaylandCompositor/qwaylandexport.h> #include <QtWaylandCompositor/QWaylandDestroyListener> #include <QtWaylandCompositor/QWaylandTouch> -#include <QtWaylandCompositor/QWaylandInputDevice> +#include <QtWaylandCompositor/QWaylandSeat> #include <QtWaylandCompositor/QWaylandView> #include <QtWaylandCompositor/QWaylandCompositor> @@ -67,7 +67,7 @@ class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandTouchPrivate : public QObjectPrivate, { Q_DECLARE_PUBLIC(QWaylandTouch) public: - explicit QWaylandTouchPrivate(QWaylandTouch *touch, QWaylandInputDevice *seat); + explicit QWaylandTouchPrivate(QWaylandTouch *touch, QWaylandSeat *seat); QWaylandCompositor *compositor() const { return seat->compositor(); } @@ -92,7 +92,7 @@ private: void touch_destroy_resource(Resource *resource) Q_DECL_OVERRIDE; void touch_release(Resource *resource) Q_DECL_OVERRIDE; - QWaylandInputDevice *seat; + QWaylandSeat *seat; Resource *focusResource; QWaylandDestroyListener focusDestroyListener; diff --git a/src/compositor/compositor_api/qwaylandview.cpp b/src/compositor/compositor_api/qwaylandview.cpp index 8501c3f29..f6e086523 100644 --- a/src/compositor/compositor_api/qwaylandview.cpp +++ b/src/compositor/compositor_api/qwaylandview.cpp @@ -37,7 +37,7 @@ #include "qwaylandview.h" #include "qwaylandview_p.h" #include "qwaylandsurface.h" -#include <QtWaylandCompositor/QWaylandInputDevice> +#include <QtWaylandCompositor/QWaylandSeat> #include <QtWaylandCompositor/QWaylandCompositor> #include <QtWaylandCompositor/private/qwaylandsurface_p.h> @@ -94,7 +94,7 @@ QWaylandView::~QWaylandView() if (d->surface) { if (d->output) QWaylandOutputPrivate::get(d->output)->removeView(this, d->surface); - QWaylandInputDevice *i = d->surface->compositor()->defaultInputDevice(); + QWaylandSeat *i = d->surface->compositor()->defaultSeat(); if (i->mouseFocus() == this) i->setMouseFocus(Q_NULLPTR); diff --git a/src/compositor/extensions/qwaylandtextinput.cpp b/src/compositor/extensions/qwaylandtextinput.cpp index 973308f2f..14dafaab0 100644 --- a/src/compositor/extensions/qwaylandtextinput.cpp +++ b/src/compositor/extensions/qwaylandtextinput.cpp @@ -38,7 +38,7 @@ #include "qwaylandtextinput_p.h" #include <QtWaylandCompositor/QWaylandCompositor> -#include <QtWaylandCompositor/private/qwaylandinput_p.h> +#include <QtWaylandCompositor/private/qwaylandseat_p.h> #include "qwaylandsurface.h" #include "qwaylandview.h" diff --git a/src/compositor/extensions/qwaylandtextinputmanager.cpp b/src/compositor/extensions/qwaylandtextinputmanager.cpp index 9dd7ace8f..7be00b6dd 100644 --- a/src/compositor/extensions/qwaylandtextinputmanager.cpp +++ b/src/compositor/extensions/qwaylandtextinputmanager.cpp @@ -38,7 +38,7 @@ #include "qwaylandtextinputmanager_p.h" #include <QtWaylandCompositor/QWaylandCompositor> -#include <QtWaylandCompositor/QWaylandInputDevice> +#include <QtWaylandCompositor/QWaylandSeat> #include "qwaylandtextinput.h" @@ -50,14 +50,14 @@ QWaylandTextInputManagerPrivate::QWaylandTextInputManagerPrivate() { } -void QWaylandTextInputManagerPrivate::zwp_text_input_manager_v2_get_text_input(Resource *resource, uint32_t id, struct ::wl_resource *seat) +void QWaylandTextInputManagerPrivate::zwp_text_input_manager_v2_get_text_input(Resource *resource, uint32_t id, struct ::wl_resource *seatResource) { Q_Q(QWaylandTextInputManager); QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(q->extensionContainer()); - QWaylandInputDevice *inputDevice = QWaylandInputDevice::fromSeatResource(seat); - QWaylandTextInput *textInput = QWaylandTextInput::findIn(inputDevice); + QWaylandSeat *seat = QWaylandSeat::fromSeatResource(seatResource); + QWaylandTextInput *textInput = QWaylandTextInput::findIn(seat); if (!textInput) { - textInput = new QWaylandTextInput(inputDevice, compositor); + textInput = new QWaylandTextInput(seat, compositor); } textInput->add(resource->client(), id, wl_resource_get_version(resource->handle)); } diff --git a/src/compositor/extensions/qwaylandtextinputmanager_p.h b/src/compositor/extensions/qwaylandtextinputmanager_p.h index 4af717096..955a5cc8a 100644 --- a/src/compositor/extensions/qwaylandtextinputmanager_p.h +++ b/src/compositor/extensions/qwaylandtextinputmanager_p.h @@ -61,7 +61,7 @@ public: QWaylandTextInputManagerPrivate(); protected: - void zwp_text_input_manager_v2_get_text_input(Resource *resource, uint32_t id, struct ::wl_resource *seat) Q_DECL_OVERRIDE; + void zwp_text_input_manager_v2_get_text_input(Resource *resource, uint32_t id, struct ::wl_resource *seatResource) Q_DECL_OVERRIDE; }; QT_END_NAMESPACE diff --git a/src/compositor/extensions/qwaylandwlshell.cpp b/src/compositor/extensions/qwaylandwlshell.cpp index 0a8ba53d7..822f6f9ef 100644 --- a/src/compositor/extensions/qwaylandwlshell.cpp +++ b/src/compositor/extensions/qwaylandwlshell.cpp @@ -132,7 +132,7 @@ void QWaylandWlShellSurfacePrivate::shell_surface_move(Resource *resource, Q_UNUSED(serial); Q_Q(QWaylandWlShellSurface); - QWaylandInputDevice *input_device = QWaylandInputDevice::fromSeatResource(input_device_super); + QWaylandSeat *input_device = QWaylandSeat::fromSeatResource(input_device_super); emit q->startMove(input_device); } @@ -145,7 +145,7 @@ void QWaylandWlShellSurfacePrivate::shell_surface_resize(Resource *resource, Q_UNUSED(serial); Q_Q(QWaylandWlShellSurface); - QWaylandInputDevice *input_device = QWaylandInputDevice::fromSeatResource(input_device_super); + QWaylandSeat *input_device = QWaylandSeat::fromSeatResource(input_device_super); emit q->startResize(input_device, QWaylandWlShellSurface::ResizeEdge(edges)); } @@ -197,7 +197,7 @@ void QWaylandWlShellSurfacePrivate::shell_surface_set_popup(Resource *resource, Q_UNUSED(flags); Q_Q(QWaylandWlShellSurface); setFocusPolicy(QWaylandWlShellSurface::DefaultFocus); - QWaylandInputDevice *input = QWaylandInputDevice::fromSeatResource(input_device); + QWaylandSeat *input = QWaylandSeat::fromSeatResource(input_device); QWaylandSurface *parentSurface = QWaylandSurface::fromResource(parent); emit q->setPopup(input, parentSurface, QPoint(x,y)); diff --git a/src/compositor/extensions/qwaylandwlshell.h b/src/compositor/extensions/qwaylandwlshell.h index beed34121..d6f71439a 100644 --- a/src/compositor/extensions/qwaylandwlshell.h +++ b/src/compositor/extensions/qwaylandwlshell.h @@ -49,7 +49,7 @@ class QWaylandWlShellPrivate; class QWaylandWlShellSurfacePrivate; class QWaylandSurface; class QWaylandClient; -class QWaylandInputDevice; +class QWaylandSeat; class QWaylandOutput; class QWaylandSurfaceRole; class QWaylandWlShellSurface; @@ -150,13 +150,13 @@ Q_SIGNALS: void classNameChanged(); void focusPolicyChanged(); void pong(); - void startMove(QWaylandInputDevice *inputDevice); - void startResize(QWaylandInputDevice *inputDevice, ResizeEdge edges); + void startMove(QWaylandSeat *seat); + void startResize(QWaylandSeat *seat, ResizeEdge edges); void setDefaultToplevel(); void setTransient(QWaylandSurface *parentSurface, const QPoint &relativeToParent, FocusPolicy focusPolicy); void setFullScreen(FullScreenMethod method, uint framerate, QWaylandOutput *output); - void setPopup(QWaylandInputDevice *inputDevice, QWaylandSurface *parentSurface, const QPoint &relativeToParent); + void setPopup(QWaylandSeat *seat, QWaylandSurface *parentSurface, const QPoint &relativeToParent); void setMaximized(QWaylandOutput *output); private: diff --git a/src/compositor/extensions/qwaylandwlshell_p.h b/src/compositor/extensions/qwaylandwlshell_p.h index 8888e2eb5..3693845a9 100644 --- a/src/compositor/extensions/qwaylandwlshell_p.h +++ b/src/compositor/extensions/qwaylandwlshell_p.h @@ -41,7 +41,7 @@ #include <QtWaylandCompositor/qwaylandsurface.h> #include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h> #include <QtWaylandCompositor/QWaylandWlShellSurface> -#include <QtWaylandCompositor/QWaylandInputDevice> +#include <QtWaylandCompositor/QWaylandSeat> #include <wayland-server.h> #include <QHash> diff --git a/src/compositor/extensions/qwaylandwlshellintegration.cpp b/src/compositor/extensions/qwaylandwlshellintegration.cpp index fe878e795..ee4783ba9 100644 --- a/src/compositor/extensions/qwaylandwlshellintegration.cpp +++ b/src/compositor/extensions/qwaylandwlshellintegration.cpp @@ -39,7 +39,7 @@ #include <QtWaylandCompositor/QWaylandCompositor> #include <QtWaylandCompositor/QWaylandWlShellSurface> #include <QtWaylandCompositor/QWaylandQuickShellSurfaceItem> -#include <QtWaylandCompositor/QWaylandInputDevice> +#include <QtWaylandCompositor/QWaylandSeat> QT_BEGIN_NAMESPACE @@ -60,26 +60,26 @@ WlShellIntegration::WlShellIntegration(QWaylandQuickShellSurfaceItem *item) connect(m_shellSurface, &QWaylandWlShellSurface::destroyed, this, &WlShellIntegration::handleShellSurfaceDestroyed); } -void WlShellIntegration::handleStartMove(QWaylandInputDevice *inputDevice) +void WlShellIntegration::handleStartMove(QWaylandSeat *seat) { grabberState = GrabberState::Move; - moveState.inputDevice = inputDevice; + moveState.seat = seat; moveState.initialized = false; } -void WlShellIntegration::handleStartResize(QWaylandInputDevice *inputDevice, QWaylandWlShellSurface::ResizeEdge edges) +void WlShellIntegration::handleStartResize(QWaylandSeat *seat, QWaylandWlShellSurface::ResizeEdge edges) { grabberState = GrabberState::Resize; - resizeState.inputDevice = inputDevice; + resizeState.seat = seat; resizeState.resizeEdges = edges; float scaleFactor = m_item->view()->output()->scaleFactor(); resizeState.initialSize = m_shellSurface->surface()->size() / scaleFactor; resizeState.initialized = false; } -void WlShellIntegration::handleSetPopup(QWaylandInputDevice *inputDevice, QWaylandSurface *parent, const QPoint &relativeToParent) +void WlShellIntegration::handleSetPopup(QWaylandSeat *seat, QWaylandSurface *parent, const QPoint &relativeToParent) { - Q_UNUSED(inputDevice); + Q_UNUSED(seat); // Find the parent item on the same output QWaylandQuickShellSurfaceItem *parentItem = nullptr; @@ -158,7 +158,7 @@ void WlShellIntegration::adjustOffsetForNextFrame(const QPointF &offset) bool WlShellIntegration::mouseMoveEvent(QMouseEvent *event) { if (grabberState == GrabberState::Resize) { - Q_ASSERT(resizeState.inputDevice == m_item->compositor()->inputDeviceFor(event)); + Q_ASSERT(resizeState.seat == m_item->compositor()->seatFor(event)); if (!resizeState.initialized) { resizeState.initialMousePos = event->windowPos(); resizeState.initialized = true; @@ -169,7 +169,7 @@ bool WlShellIntegration::mouseMoveEvent(QMouseEvent *event) QSize newSize = m_shellSurface->sizeForResize(resizeState.initialSize, delta, resizeState.resizeEdges); m_shellSurface->sendConfigure(newSize, resizeState.resizeEdges); } else if (grabberState == GrabberState::Move) { - Q_ASSERT(moveState.inputDevice == m_item->compositor()->inputDeviceFor(event)); + Q_ASSERT(moveState.seat == m_item->compositor()->seatFor(event)); QQuickItem *moveItem = m_item->moveItem(); if (!moveState.initialized) { moveState.initialOffset = moveItem->mapFromItem(nullptr, event->windowPos()); diff --git a/src/compositor/extensions/qwaylandwlshellintegration_p.h b/src/compositor/extensions/qwaylandwlshellintegration_p.h index 3f063af39..69bbbcd9c 100644 --- a/src/compositor/extensions/qwaylandwlshellintegration_p.h +++ b/src/compositor/extensions/qwaylandwlshellintegration_p.h @@ -65,9 +65,9 @@ public: bool mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; private Q_SLOTS: - void handleStartMove(QWaylandInputDevice *inputDevice); - void handleStartResize(QWaylandInputDevice *inputDevice, QWaylandWlShellSurface::ResizeEdge edges); - void handleSetPopup(QWaylandInputDevice *inputDevice, QWaylandSurface *parent, const QPoint &relativeToParent); + void handleStartMove(QWaylandSeat *seat); + void handleStartResize(QWaylandSeat *seat, QWaylandWlShellSurface::ResizeEdge edges); + void handleSetPopup(QWaylandSeat *seat, QWaylandSurface *parent, const QPoint &relativeToParent); void handleShellSurfaceDestroyed(); void handleSurfaceUnmapped(); void adjustOffsetForNextFrame(const QPointF &offset); @@ -88,12 +88,12 @@ private: QWaylandWlShellSurface *m_shellSurface; GrabberState grabberState; struct { - QWaylandInputDevice *inputDevice; + QWaylandSeat *seat; QPointF initialOffset; bool initialized; } moveState; struct { - QWaylandInputDevice *inputDevice; + QWaylandSeat *seat; QWaylandWlShellSurface::ResizeEdge resizeEdges; QSizeF initialSize; QPointF initialMousePos; diff --git a/src/compositor/extensions/qwaylandxdgshell.cpp b/src/compositor/extensions/qwaylandxdgshell.cpp index d818736ff..93944fb32 100644 --- a/src/compositor/extensions/qwaylandxdgshell.cpp +++ b/src/compositor/extensions/qwaylandxdgshell.cpp @@ -45,7 +45,7 @@ #include <QtWaylandCompositor/QWaylandSurface> #include <QtWaylandCompositor/QWaylandSurfaceRole> #include <QtWaylandCompositor/QWaylandResource> -#include <QtWaylandCompositor/QWaylandInputDevice> +#include <QtWaylandCompositor/QWaylandSeat> #include <QtCore/QObject> @@ -174,7 +174,7 @@ void QWaylandXdgShellPrivate::xdg_shell_use_unstable_version(Resource *resource, void QWaylandXdgShellPrivate::xdg_shell_get_xdg_popup(Resource *resource, uint32_t id, wl_resource *surface_res, wl_resource *parent, - wl_resource *seat, uint32_t serial, + wl_resource *seatResource, uint32_t serial, int32_t x, int32_t y) { Q_UNUSED(serial); @@ -194,9 +194,9 @@ void QWaylandXdgShellPrivate::xdg_shell_get_xdg_popup(Resource *resource, uint32 QWaylandResource xdgPopupResource (wl_resource_create(resource->client(), &xdg_popup_interface, wl_resource_get_version(resource->handle), id)); - QWaylandInputDevice *inputDevice = QWaylandInputDevice::fromSeatResource(seat); + QWaylandSeat *seat = QWaylandSeat::fromSeatResource(seatResource); QPoint position(x, y); - emit q->xdgPopupRequested(surface, parentSurface, inputDevice, position, xdgPopupResource); + emit q->xdgPopupRequested(surface, parentSurface, seat, position, xdgPopupResource); QWaylandXdgPopup *xdgPopup = QWaylandXdgPopup::fromResource(xdgPopupResource.resource()); if (!xdgPopup) { @@ -290,7 +290,7 @@ void QWaylandXdgSurfacePrivate::xdg_surface_move(Resource *resource, wl_resource Q_UNUSED(serial); Q_Q(QWaylandXdgSurface); - QWaylandInputDevice *input_device = QWaylandInputDevice::fromSeatResource(seat); + QWaylandSeat *input_device = QWaylandSeat::fromSeatResource(seat); emit q->startMove(input_device); } @@ -301,7 +301,7 @@ void QWaylandXdgSurfacePrivate::xdg_surface_resize(Resource *resource, wl_resour Q_UNUSED(serial); Q_Q(QWaylandXdgSurface); - QWaylandInputDevice *input_device = QWaylandInputDevice::fromSeatResource(seat); + QWaylandSeat *input_device = QWaylandSeat::fromSeatResource(seat); emit q->startResize(input_device, QWaylandXdgSurface::ResizeEdge(edges)); } @@ -378,15 +378,15 @@ void QWaylandXdgSurfacePrivate::xdg_surface_set_app_id(Resource *resource, const emit q->appIdChanged(); } -void QWaylandXdgSurfacePrivate::xdg_surface_show_window_menu(Resource *resource, wl_resource *seat, +void QWaylandXdgSurfacePrivate::xdg_surface_show_window_menu(Resource *resource, wl_resource *seatResource, uint32_t serial, int32_t x, int32_t y) { Q_UNUSED(resource); Q_UNUSED(serial); QPoint position(x, y); - auto inputDevice = QWaylandInputDevice::fromSeatResource(seat); + auto seat = QWaylandSeat::fromSeatResource(seatResource); Q_Q(QWaylandXdgSurface); - emit q->showWindowMenu(inputDevice, position); + emit q->showWindowMenu(seat, position); } void QWaylandXdgSurfacePrivate::xdg_surface_ack_configure(Resource *resource, uint32_t serial) @@ -525,10 +525,10 @@ void QWaylandXdgShell::initialize() } d->init(compositor->display(), 1); - handleDefaultInputDeviceChanged(compositor->defaultInputDevice(), nullptr); + handleSeatChanged(compositor->defaultSeat(), nullptr); - connect(compositor, &QWaylandCompositor::defaultInputDeviceChanged, - this, &QWaylandXdgShell::handleDefaultInputDeviceChanged); + connect(compositor, &QWaylandCompositor::defaultSeatChanged, + this, &QWaylandXdgShell::handleSeatChanged); } /*! @@ -583,15 +583,15 @@ void QWaylandXdgShell::closeAllPopups() } } -void QWaylandXdgShell::handleDefaultInputDeviceChanged(QWaylandInputDevice *newDevice, QWaylandInputDevice *oldDevice) +void QWaylandXdgShell::handleSeatChanged(QWaylandSeat *newSeat, QWaylandSeat *oldSeat) { - if (oldDevice != nullptr) { - disconnect(oldDevice, &QWaylandInputDevice::keyboardFocusChanged, + if (oldSeat != nullptr) { + disconnect(oldSeat, &QWaylandSeat::keyboardFocusChanged, this, &QWaylandXdgShell::handleFocusChanged); } - if (newDevice != nullptr) { - connect(newDevice, &QWaylandInputDevice::keyboardFocusChanged, + if (newSeat != nullptr) { + connect(newSeat, &QWaylandSeat::keyboardFocusChanged, this, &QWaylandXdgShell::handleFocusChanged); } } diff --git a/src/compositor/extensions/qwaylandxdgshell.h b/src/compositor/extensions/qwaylandxdgshell.h index 420fb98bc..29b78699f 100644 --- a/src/compositor/extensions/qwaylandxdgshell.h +++ b/src/compositor/extensions/qwaylandxdgshell.h @@ -55,7 +55,7 @@ class QWaylandXdgPopupPrivate; class QWaylandSurface; class QWaylandSurfaceRole; -class QWaylandInputDevice; +class QWaylandSeat; class QWaylandOutput; class QWaylandClient; @@ -80,11 +80,11 @@ Q_SIGNALS: void xdgSurfaceRequested(QWaylandSurface *surface, const QWaylandResource &resource); void xdgSurfaceCreated(QWaylandXdgSurface *xdgSurface); void xdgPopupCreated(QWaylandXdgPopup *xdgPopup); - void xdgPopupRequested(QWaylandSurface *surface, QWaylandSurface *parent, QWaylandInputDevice *seat, const QPoint &position, const QWaylandResource &resource); + void xdgPopupRequested(QWaylandSurface *surface, QWaylandSurface *parent, QWaylandSeat *seat, const QPoint &position, const QWaylandResource &resource); void pong(uint serial); private Q_SLOTS: - void handleDefaultInputDeviceChanged(QWaylandInputDevice *newDevice, QWaylandInputDevice *oldDevice); + void handleSeatChanged(QWaylandSeat *newSeat, QWaylandSeat *oldSeat); void handleFocusChanged(QWaylandSurface *newSurface, QWaylandSurface *oldSurface); }; @@ -176,9 +176,9 @@ Q_SIGNALS: void resizingChanged(); void activatedChanged(); - void showWindowMenu(QWaylandInputDevice *inputDevice, const QPoint &localSurfacePosition); - void startMove(QWaylandInputDevice *inputDevice); - void startResize(QWaylandInputDevice *inputDevice, ResizeEdge edges); + void showWindowMenu(QWaylandSeat *seat, const QPoint &localSurfacePosition); + void startMove(QWaylandSeat *seat); + void startResize(QWaylandSeat *seat, ResizeEdge edges); void setTopLevel(); void setTransient(); void setMaximized(); diff --git a/src/compositor/extensions/qwaylandxdgshell_p.h b/src/compositor/extensions/qwaylandxdgshell_p.h index 0b2d22e6f..d7244c704 100644 --- a/src/compositor/extensions/qwaylandxdgshell_p.h +++ b/src/compositor/extensions/qwaylandxdgshell_p.h @@ -85,7 +85,7 @@ protected: struct ::wl_resource *surface) Q_DECL_OVERRIDE; void xdg_shell_use_unstable_version(Resource *resource, int32_t version) Q_DECL_OVERRIDE; void xdg_shell_get_xdg_popup(Resource *resource, uint32_t id, struct ::wl_resource *surface, - struct ::wl_resource *parent, struct ::wl_resource *seat, + struct ::wl_resource *parent, struct ::wl_resource *seatResource, uint32_t serial, int32_t x, int32_t y) Q_DECL_OVERRIDE; void xdg_shell_pong(Resource *resource, uint32_t serial) Q_DECL_OVERRIDE; }; @@ -147,7 +147,7 @@ private: void xdg_surface_set_minimized(Resource *resource) Q_DECL_OVERRIDE; void xdg_surface_set_parent(Resource *resource, struct ::wl_resource *parent) Q_DECL_OVERRIDE; void xdg_surface_set_app_id(Resource *resource, const QString &app_id) Q_DECL_OVERRIDE; - void xdg_surface_show_window_menu(Resource *resource, struct ::wl_resource *seat, + void xdg_surface_show_window_menu(Resource *resource, struct ::wl_resource *seatResource, uint32_t serial, int32_t x, int32_t y) Q_DECL_OVERRIDE; void xdg_surface_ack_configure(Resource *resource, uint32_t serial) Q_DECL_OVERRIDE; void xdg_surface_set_title(Resource *resource, const QString &title) Q_DECL_OVERRIDE; diff --git a/src/compositor/extensions/qwaylandxdgshellintegration.cpp b/src/compositor/extensions/qwaylandxdgshellintegration.cpp index cb3b7ea23..90c7a7b36 100644 --- a/src/compositor/extensions/qwaylandxdgshellintegration.cpp +++ b/src/compositor/extensions/qwaylandxdgshellintegration.cpp @@ -38,7 +38,7 @@ #include <QtWaylandCompositor/QWaylandQuickShellSurfaceItem> #include <QtWaylandCompositor/QWaylandCompositor> -#include <QtWaylandCompositor/QWaylandInputDevice> +#include <QtWaylandCompositor/QWaylandSeat> #include <QtWaylandCompositor/private/qwaylandxdgshell_p.h> #include <QMouseEvent> #include <QGuiApplication> @@ -66,7 +66,7 @@ XdgShellIntegration::XdgShellIntegration(QWaylandQuickShellSurfaceItem *item) bool XdgShellIntegration::mouseMoveEvent(QMouseEvent *event) { if (grabberState == GrabberState::Resize) { - Q_ASSERT(resizeState.inputDevice == m_item->compositor()->inputDeviceFor(event)); + Q_ASSERT(resizeState.seat == m_item->compositor()->seatFor(event)); if (!resizeState.initialized) { resizeState.initialMousePos = event->windowPos(); resizeState.initialized = true; @@ -76,7 +76,7 @@ bool XdgShellIntegration::mouseMoveEvent(QMouseEvent *event) QSize newSize = m_xdgSurface->sizeForResize(resizeState.initialWindowSize, delta, resizeState.resizeEdges); m_xdgSurface->sendResizing(newSize); } else if (grabberState == GrabberState::Move) { - Q_ASSERT(moveState.inputDevice == m_item->compositor()->inputDeviceFor(event)); + Q_ASSERT(moveState.seat == m_item->compositor()->seatFor(event)); QQuickItem *moveItem = m_item->moveItem(); if (!moveState.initialized) { moveState.initialOffset = moveItem->mapFromItem(nullptr, event->windowPos()); @@ -106,17 +106,17 @@ bool XdgShellIntegration::mouseReleaseEvent(QMouseEvent *event) return false; } -void XdgShellIntegration::handleStartMove(QWaylandInputDevice *inputDevice) +void XdgShellIntegration::handleStartMove(QWaylandSeat *seat) { grabberState = GrabberState::Move; - moveState.inputDevice = inputDevice; + moveState.seat = seat; moveState.initialized = false; } -void XdgShellIntegration::handleStartResize(QWaylandInputDevice *inputDevice, QWaylandXdgSurface::ResizeEdge edges) +void XdgShellIntegration::handleStartResize(QWaylandSeat *seat, QWaylandXdgSurface::ResizeEdge edges) { grabberState = GrabberState::Resize; - resizeState.inputDevice = inputDevice; + resizeState.seat = seat; resizeState.resizeEdges = edges; resizeState.initialWindowSize = m_xdgSurface->windowGeometry().size(); resizeState.initialPosition = m_item->moveItem()->position(); diff --git a/src/compositor/extensions/qwaylandxdgshellintegration_p.h b/src/compositor/extensions/qwaylandxdgshellintegration_p.h index c3021c080..8a000ff6a 100644 --- a/src/compositor/extensions/qwaylandxdgshellintegration_p.h +++ b/src/compositor/extensions/qwaylandxdgshellintegration_p.h @@ -64,8 +64,8 @@ public: bool mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE; private Q_SLOTS: - void handleStartMove(QWaylandInputDevice *inputDevice); - void handleStartResize(QWaylandInputDevice *inputDevice, QWaylandXdgSurface::ResizeEdge edges); + void handleStartMove(QWaylandSeat *seat); + void handleStartResize(QWaylandSeat *seat, QWaylandXdgSurface::ResizeEdge edges); void handleSetMaximized(); void handleUnsetMaximized(); void handleMaximizedChanged(); @@ -83,13 +83,13 @@ private: GrabberState grabberState; struct { - QWaylandInputDevice *inputDevice; + QWaylandSeat *seat; QPointF initialOffset; bool initialized; } moveState; struct { - QWaylandInputDevice *inputDevice; + QWaylandSeat *seat; QWaylandXdgSurface::ResizeEdge resizeEdges; QSizeF initialWindowSize; QPointF initialMousePos; diff --git a/src/compositor/wayland_wrapper/qwldatadevice.cpp b/src/compositor/wayland_wrapper/qwldatadevice.cpp index 521e5dda5..0d196b82e 100644 --- a/src/compositor/wayland_wrapper/qwldatadevice.cpp +++ b/src/compositor/wayland_wrapper/qwldatadevice.cpp @@ -45,7 +45,7 @@ #include "qwaylandview.h" #include <QtWaylandCompositor/QWaylandClient> #include <QtWaylandCompositor/private/qwaylandcompositor_p.h> -#include <QtWaylandCompositor/private/qwaylandinput_p.h> +#include <QtWaylandCompositor/private/qwaylandseat_p.h> #include <QtWaylandCompositor/private/qwaylandpointer_p.h> #include <QtCore/QPointF> @@ -55,10 +55,10 @@ QT_BEGIN_NAMESPACE namespace QtWayland { -DataDevice::DataDevice(QWaylandInputDevice *inputDevice) +DataDevice::DataDevice(QWaylandSeat *seat) : wl_data_device() - , m_compositor(inputDevice->compositor()) - , m_inputDevice(inputDevice) + , m_compositor(seat->compositor()) + , m_seat(seat) , m_selectionSource(0) , m_dragClient(0) , m_dragDataSource(0) @@ -168,7 +168,7 @@ void DataDevice::data_device_start_drag(Resource *resource, struct ::wl_resource m_dragClient = resource->client(); m_dragDataSource = source ? DataSource::fromResource(source) : 0; m_dragOrigin = QWaylandSurface::fromResource(origin); - QWaylandDrag *drag = m_inputDevice->drag(); + QWaylandDrag *drag = m_seat->drag(); setDragIcon(icon ? QWaylandSurface::fromResource(icon) : nullptr); Q_EMIT drag->dragStarted(); Q_EMIT m_dragOrigin->dragStarted(drag); @@ -191,7 +191,7 @@ void DataDevice::data_device_set_selection(Resource *, struct ::wl_resource *sou if (m_selectionSource) m_selectionSource->setDevice(this); - QWaylandClient *focusClient = m_inputDevice->keyboard()->focusClient(); + QWaylandClient *focusClient = m_seat->keyboard()->focusClient(); Resource *resource = focusClient ? resourceMap().value(focusClient->client()) : 0; if (resource && m_selectionSource) { @@ -207,7 +207,7 @@ void DataDevice::setDragIcon(QWaylandSurface *icon) if (icon == m_dragIcon) return; m_dragIcon = icon; - Q_EMIT m_inputDevice->drag()->iconChanged(); + Q_EMIT m_seat->drag()->iconChanged(); } } diff --git a/src/compositor/wayland_wrapper/qwldatadevice_p.h b/src/compositor/wayland_wrapper/qwldatadevice_p.h index 6a8e4e381..17591ae27 100644 --- a/src/compositor/wayland_wrapper/qwldatadevice_p.h +++ b/src/compositor/wayland_wrapper/qwldatadevice_p.h @@ -49,7 +49,7 @@ // #include <QtWaylandCompositor/private/qwayland-server-wayland.h> -#include <QtWaylandCompositor/QWaylandInputDevice> +#include <QtWaylandCompositor/QWaylandSeat> QT_BEGIN_NAMESPACE @@ -57,13 +57,13 @@ namespace QtWayland { class Compositor; class DataSource; -class InputDevice; +class Seat; class Surface; class DataDevice : public QtWaylandServer::wl_data_device { public: - DataDevice(QWaylandInputDevice *inputDevice); + DataDevice(QWaylandSeat *seat); void setFocus(QWaylandClient *client); @@ -86,7 +86,7 @@ private: void setDragIcon(QWaylandSurface *icon); QWaylandCompositor *m_compositor; - QWaylandInputDevice *m_inputDevice; + QWaylandSeat *m_seat; DataSource *m_selectionSource; diff --git a/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp b/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp index 2f40b0e43..5fed6ef18 100644 --- a/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp +++ b/src/compositor/wayland_wrapper/qwldatadevicemanager.cpp @@ -39,7 +39,7 @@ #include <QtWaylandCompositor/QWaylandCompositor> #include <QtWaylandCompositor/private/qwaylandcompositor_p.h> -#include <QtWaylandCompositor/private/qwaylandinput_p.h> +#include <QtWaylandCompositor/private/qwaylandseat_p.h> #include "qwldatadevice_p.h" #include "qwldatasource_p.h" #include "qwldataoffer_p.h" @@ -199,11 +199,11 @@ void DataDeviceManager::overrideSelection(const QMimeData &mimeData) m_compositorOwnsSelection = true; - QWaylandInputDevice *dev = m_compositor->defaultInputDevice(); + QWaylandSeat *dev = m_compositor->defaultSeat(); QWaylandSurface *focusSurface = dev->keyboardFocus(); if (focusSurface) offerFromCompositorToClient( - QWaylandInputDevicePrivate::get(dev)->dataDevice()->resourceMap().value(focusSurface->waylandClient())->handle); + QWaylandSeatPrivate::get(dev)->dataDevice()->resourceMap().value(focusSurface->waylandClient())->handle); } bool DataDeviceManager::offerFromCompositorToClient(wl_resource *clientDataDeviceResource) @@ -243,8 +243,8 @@ void DataDeviceManager::data_device_manager_create_data_source(Resource *resourc void DataDeviceManager::data_device_manager_get_data_device(Resource *resource, uint32_t id, struct ::wl_resource *seat) { - QWaylandInputDevice *input_device = QWaylandInputDevice::fromSeatResource(seat); - QWaylandInputDevicePrivate::get(input_device)->clientRequestedDataDevice(this, resource->client(), id); + QWaylandSeat *input_device = QWaylandSeat::fromSeatResource(seat); + QWaylandSeatPrivate::get(input_device)->clientRequestedDataDevice(this, resource->client(), id); } void DataDeviceManager::comp_accept(wl_client *, wl_resource *, uint32_t, const char *) diff --git a/src/imports/compositor/WaylandCursorItem.qml b/src/imports/compositor/WaylandCursorItem.qml index af2b76aa8..931acbb08 100644 --- a/src/imports/compositor/WaylandCursorItem.qml +++ b/src/imports/compositor/WaylandCursorItem.qml @@ -39,7 +39,7 @@ import QtWayland.Compositor 1.0 WaylandQuickItem { id: cursorItem - property QtObject inputDevice + property QtObject seat property int hotspotX: 0 property int hotspotY: 0 @@ -48,10 +48,10 @@ WaylandQuickItem { enabled: false transform: Translate { x: -hotspotX; y: -hotspotY } - onInputDeviceChanged: { - if (!inputDevice) + onSeatChanged: { + if (!seat) return; - inputDevice.cursorSurfaceRequest.connect(setCursorSurface); + seat.cursorSurfaceRequest.connect(setCursorSurface); } function setCursorSurface(surface, hotspotX, hotspotY) { @@ -67,7 +67,7 @@ WaylandQuickItem { x: cursorItem.hotspotX + offset.x y: cursorItem.hotspotY + offset.y z: -1 - surface: cursorItem.inputDevice.drag.icon + surface: cursorItem.seat.drag.icon Connections { target: dragIcon.surface diff --git a/src/imports/compositor/plugins.qmltypes b/src/imports/compositor/plugins.qmltypes index 7720176e3..2cd5a0e33 100644 --- a/src/imports/compositor/plugins.qmltypes +++ b/src/imports/compositor/plugins.qmltypes @@ -35,8 +35,8 @@ Module { Property { name: "defaultOutput"; type: "QWaylandOutput"; isPointer: true } Property { name: "useHardwareIntegrationExtension"; type: "bool" } Property { - name: "defaultInputDevice" - type: "QWaylandInputDevice" + name: "defaultSeat" + type: "QWaylandSeat" isReadonly: true isPointer: true } @@ -60,9 +60,9 @@ Module { Parameter { name: "parent"; type: "QWaylandSurface"; isPointer: true } } Signal { - name: "defaultInputDeviceChanged" - Parameter { name: "newDevice"; type: "QWaylandInputDevice"; isPointer: true } - Parameter { name: "oldDevice"; type: "QWaylandInputDevice"; isPointer: true } + name: "defaultSeatChanged" + Parameter { name: "newDevice"; type: "QWaylandSeat"; isPointer: true } + Parameter { name: "oldDevice"; type: "QWaylandSeat"; isPointer: true } } Method { name: "processWaylandEvents" } Method { @@ -104,9 +104,9 @@ Module { Method { name: "cancelDrag" } } Component { - name: "QWaylandInputDevice" + name: "QWaylandSeat" prototype: "QObject" - exports: ["QtWayland.Compositor/WaylandInputDevice 1.0"] + exports: ["QtWayland.Compositor/WaylandSeat 1.0"] isCreatable: false exportMetaObjectRevisions: [0] Enum { @@ -251,7 +251,7 @@ Module { Signal { name: "mouseRelease" } Method { name: "takeFocus" - Parameter { name: "device"; type: "QWaylandInputDevice"; isPointer: true } + Parameter { name: "device"; type: "QWaylandSeat"; isPointer: true } } Method { name: "takeFocus" } Method { @@ -469,11 +469,11 @@ Module { Signal { name: "pong" } Signal { name: "startMove" - Parameter { name: "inputDevice"; type: "QWaylandInputDevice"; isPointer: true } + Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true } } Signal { name: "startResize" - Parameter { name: "inputDevice"; type: "QWaylandInputDevice"; isPointer: true } + Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true } Parameter { name: "edges"; type: "ResizeEdge" } } Signal { name: "setDefaultToplevel" } @@ -491,7 +491,7 @@ Module { } Signal { name: "setPopup" - Parameter { name: "inputDevice"; type: "QWaylandInputDevice"; isPointer: true } + Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true } Parameter { name: "parentSurface"; type: "QWaylandSurface"; isPointer: true } Parameter { name: "relativeToParent"; type: "QPoint" } } @@ -540,7 +540,7 @@ Module { name: "xdgPopupRequested" Parameter { name: "surface"; type: "QWaylandSurface"; isPointer: true } Parameter { name: "parent"; type: "QWaylandSurface"; isPointer: true } - Parameter { name: "seat"; type: "QWaylandInputDevice"; isPointer: true } + Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true } Parameter { name: "position"; type: "QPoint" } Parameter { name: "resource"; type: "QWaylandResource" } } @@ -603,16 +603,16 @@ Module { Property { name: "activated"; type: "bool"; isReadonly: true } Signal { name: "showWindowMenu" - Parameter { name: "inputDevice"; type: "QWaylandInputDevice"; isPointer: true } + Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true } Parameter { name: "localSurfacePosition"; type: "QPoint" } } Signal { name: "startMove" - Parameter { name: "inputDevice"; type: "QWaylandInputDevice"; isPointer: true } + Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true } } Signal { name: "startResize" - Parameter { name: "inputDevice"; type: "QWaylandInputDevice"; isPointer: true } + Parameter { name: "seat"; type: "QWaylandSeat"; isPointer: true } Parameter { name: "edges"; type: "ResizeEdge" } } Signal { name: "setMaximized" } @@ -682,7 +682,7 @@ Module { exportMetaObjectRevisions: [0] isComposite: true defaultProperty: "data" - Property { name: "inputDevice"; type: "QObject"; isPointer: true } + Property { name: "seat"; type: "QObject"; isPointer: true } Property { name: "hotspotX"; type: "int" } Property { name: "hotspotY"; type: "int" } Method { @@ -710,7 +710,7 @@ Module { Signal { name: "mouseRelease" } Method { name: "takeFocus" - Parameter { name: "device"; type: "QWaylandInputDevice"; isPointer: true } + Parameter { name: "device"; type: "QWaylandSeat"; isPointer: true } } Method { name: "takeFocus" } Method { diff --git a/src/imports/compositor/qwaylandquickcompositorplugin.cpp b/src/imports/compositor/qwaylandquickcompositorplugin.cpp index 0403f8d39..a5f520433 100644 --- a/src/imports/compositor/qwaylandquickcompositorplugin.cpp +++ b/src/imports/compositor/qwaylandquickcompositorplugin.cpp @@ -46,7 +46,7 @@ #include <QtWaylandCompositor/QWaylandQuickOutput> #include <QtWaylandCompositor/QWaylandCompositorExtension> #include <QtWaylandCompositor/QWaylandQuickExtension> -#include <QtWaylandCompositor/QWaylandInputDevice> +#include <QtWaylandCompositor/QWaylandSeat> #include <QtWaylandCompositor/QWaylandDrag> #include <QtWaylandCompositor/QWaylandQuickShellSurfaceItem> #include <QtWaylandCompositor/QWaylandResource> @@ -122,7 +122,7 @@ public: qmlRegisterUncreatableType<QWaylandClient>(uri, 1, 0, "WaylandClient", QObject::tr("Cannot create instance of WaylandClient")); qmlRegisterUncreatableType<QWaylandOutput>(uri, 1, 0, "WaylandOutputBase", QObject::tr("Cannot create instance of WaylandOutputBase, use WaylandOutput instead")); qmlRegisterUncreatableType<QWaylandView>(uri, 1, 0, "WaylandView", QObject::tr("Cannot create instance of WaylandView, it can be retrieved by accessor on WaylandQuickItem")); - qmlRegisterUncreatableType<QWaylandInputDevice>(uri, 1, 0, "WaylandInputDevice", QObject::tr("Cannot create instance of WaylandInputDevice")); + qmlRegisterUncreatableType<QWaylandSeat>(uri, 1, 0, "WaylandSeat", QObject::tr("Cannot create instance of WaylandSeat")); qmlRegisterUncreatableType<QWaylandDrag>(uri, 1, 0, "WaylandDrag", QObject::tr("Cannot create instance of WaylandDrag")); qmlRegisterUncreatableType<QWaylandCompositor>(uri, 1, 0, "WaylandCompositorBase", QObject::tr("Cannot create instance of WaylandCompositorBase, use WaylandCompositor instead")); qmlRegisterUncreatableType<QWaylandSurface>(uri, 1, 0, "WaylandSurfaceBase", QObject::tr("Cannot create instance of WaylandSurfaceBase, use WaylandSurface instead")); diff --git a/tests/auto/compositor/compositor.pro b/tests/auto/compositor/compositor.pro index 9f9044fdf..50378c6d4 100644 --- a/tests/auto/compositor/compositor.pro +++ b/tests/auto/compositor/compositor.pro @@ -29,10 +29,10 @@ SOURCES += tst_compositor.cpp \ testkeyboardgrabber.cpp \ mockclient.cpp \ mockseat.cpp \ - testinputdevice.cpp + testseat.cpp HEADERS += testcompositor.h \ testkeyboardgrabber.h \ mockclient.h \ mockseat.h \ - testinputdevice.h + testseat.h diff --git a/tests/auto/compositor/testcompositor.cpp b/tests/auto/compositor/testcompositor.cpp index dfa26a542..733bea5b3 100644 --- a/tests/auto/compositor/testcompositor.cpp +++ b/tests/auto/compositor/testcompositor.cpp @@ -27,7 +27,7 @@ ****************************************************************************/ #include "testcompositor.h" -#include "testinputdevice.h" +#include "testseat.h" #include "testkeyboardgrabber.h" #include <wayland-server.h> @@ -35,7 +35,7 @@ TestCompositor::TestCompositor(bool createInputDev) : QWaylandCompositor() , shell(new QWaylandWlShell(this)) - , m_createInputDevice(createInputDev) + , m_createSeat(createInputDev) { setSocketName("wayland-qt-test-0"); } @@ -64,14 +64,14 @@ void TestCompositor::onSurfaceAboutToBeDestroyed(QWaylandSurface *surface) surfaces.removeOne(surface); } -QWaylandInputDevice *TestCompositor::createInputDevice() +QWaylandSeat *TestCompositor::createSeat() { - if (m_createInputDevice) - return new TestInputDevice(this, QWaylandInputDevice::Pointer | QWaylandInputDevice::Keyboard); + if (m_createSeat) + return new TestSeat(this, QWaylandSeat::Pointer | QWaylandSeat::Keyboard); else - return QWaylandCompositor::createInputDevice(); + return QWaylandCompositor::createSeat(); } -QWaylandKeyboard *TestCompositor::createKeyboardDevice(QWaylandInputDevice *inputDevice) { - return new TestKeyboardGrabber(inputDevice); +QWaylandKeyboard *TestCompositor::createKeyboardDevice(QWaylandSeat *seat) { + return new TestKeyboardGrabber(seat); } diff --git a/tests/auto/compositor/testcompositor.h b/tests/auto/compositor/testcompositor.h index fb5909d19..8eeb7ade6 100644 --- a/tests/auto/compositor/testcompositor.h +++ b/tests/auto/compositor/testcompositor.h @@ -43,12 +43,12 @@ public slots: void onSurfaceAboutToBeDestroyed(QWaylandSurface *surface); protected: - QWaylandInputDevice *createInputDevice() Q_DECL_OVERRIDE; - QWaylandKeyboard *createKeyboardDevice(QWaylandInputDevice *inputDevice) Q_DECL_OVERRIDE; + QWaylandSeat *createSeat() Q_DECL_OVERRIDE; + QWaylandKeyboard *createKeyboardDevice(QWaylandSeat *seat) Q_DECL_OVERRIDE; public: QList<QWaylandSurface *> surfaces; QWaylandWlShell* shell; - bool m_createInputDevice; + bool m_createSeat; }; diff --git a/tests/auto/compositor/testkeyboardgrabber.cpp b/tests/auto/compositor/testkeyboardgrabber.cpp index 315b7f4fd..a3aa42ac2 100644 --- a/tests/auto/compositor/testkeyboardgrabber.cpp +++ b/tests/auto/compositor/testkeyboardgrabber.cpp @@ -28,8 +28,8 @@ #include "testkeyboardgrabber.h" -TestKeyboardGrabber::TestKeyboardGrabber(QWaylandInputDevice *inputDevice) - : QWaylandKeyboard(inputDevice) +TestKeyboardGrabber::TestKeyboardGrabber(QWaylandSeat *seat) + : QWaylandKeyboard(seat) { } diff --git a/tests/auto/compositor/testkeyboardgrabber.h b/tests/auto/compositor/testkeyboardgrabber.h index ca5f51628..0ef595987 100644 --- a/tests/auto/compositor/testkeyboardgrabber.h +++ b/tests/auto/compositor/testkeyboardgrabber.h @@ -32,7 +32,7 @@ class TestKeyboardGrabber : public QWaylandKeyboard { Q_OBJECT public: - TestKeyboardGrabber(QWaylandInputDevice *inputDevice); + TestKeyboardGrabber(QWaylandSeat *seat); void setFocus(QWaylandSurface *surface) Q_DECL_OVERRIDE; void sendKeyModifiers(QWaylandClient *client, uint32_t serial) Q_DECL_OVERRIDE; diff --git a/tests/auto/compositor/testinputdevice.cpp b/tests/auto/compositor/testseat.cpp index 5c02dff85..38227872b 100644 --- a/tests/auto/compositor/testinputdevice.cpp +++ b/tests/auto/compositor/testseat.cpp @@ -26,27 +26,27 @@ ** ****************************************************************************/ -#include "testinputdevice.h" +#include "testseat.h" #include <QMouseEvent> -TestInputDevice::TestInputDevice(QWaylandCompositor *compositor, QWaylandInputDevice::CapabilityFlags caps) - : QWaylandInputDevice(compositor, caps) +TestSeat::TestSeat(QWaylandCompositor *compositor, QWaylandSeat::CapabilityFlags caps) + : QWaylandSeat(compositor, caps) { m_queryCount = 0; } -TestInputDevice::~TestInputDevice() +TestSeat::~TestSeat() { } -bool TestInputDevice::isOwner(QInputEvent *event) const +bool TestSeat::isOwner(QInputEvent *event) const { m_queryCount++; QMouseEvent *me = dynamic_cast<QMouseEvent *>(event); return m_events.contains(me); } -QList<QMouseEvent *> TestInputDevice::createMouseEvents(int count) +QList<QMouseEvent *> TestSeat::createMouseEvents(int count) { for (int i = 0; i < count; i++) { m_events.append(new QMouseEvent(QEvent::MouseMove, QPointF(10 + i, 10 + i), Qt::NoButton, Qt::NoButton, Qt::NoModifier)); diff --git a/tests/auto/compositor/testinputdevice.h b/tests/auto/compositor/testseat.h index e6134aa18..54641c07d 100644 --- a/tests/auto/compositor/testinputdevice.h +++ b/tests/auto/compositor/testseat.h @@ -26,7 +26,7 @@ ** ****************************************************************************/ -#include <QWaylandInputDevice> +#include <QWaylandSeat> #include <QList> QT_BEGIN_NAMESPACE @@ -34,13 +34,13 @@ class QInputEvent; class QMouseEvent; QT_END_NAMESPACE -class TestInputDevice : public QWaylandInputDevice +class TestSeat : public QWaylandSeat { public: - TestInputDevice(QWaylandCompositor *compositor, QWaylandInputDevice::CapabilityFlags caps); - ~TestInputDevice(); + TestSeat(QWaylandCompositor *compositor, QWaylandSeat::CapabilityFlags caps); + ~TestSeat(); bool isOwner(QInputEvent *inputEvent) const Q_DECL_OVERRIDE; diff --git a/tests/auto/compositor/tst_compositor.cpp b/tests/auto/compositor/tst_compositor.cpp index cf7178ed8..606a7e7a8 100644 --- a/tests/auto/compositor/tst_compositor.cpp +++ b/tests/auto/compositor/tst_compositor.cpp @@ -29,11 +29,11 @@ #include "mockclient.h" #include "testcompositor.h" #include "testkeyboardgrabber.h" -#include "testinputdevice.h" +#include "testseat.h" #include "qwaylandview.h" #include "qwaylandbufferref.h" -#include "qwaylandinput.h" +#include "qwaylandseat.h" #include <QtWaylandCompositor/QWaylandXdgShell> #include <QtWaylandCompositor/QWaylandSurface> @@ -48,10 +48,10 @@ class tst_WaylandCompositor : public QObject private slots: void init(); - void inputDeviceCapabilities(); + void seatCapabilities(); void keyboardGrab(); - void inputDeviceCreation(); - void inputDeviceKeyboardFocus(); + void seatCreation(); + void seatKeyboardFocus(); void singleClient(); void multipleClients(); void geometry(); @@ -152,38 +152,38 @@ void tst_WaylandCompositor::keyboardGrab() // Set the focused surface so that key event will flow through QWaylandSurface *waylandSurface = compositor.surfaces.at(0); - QWaylandInputDevice* inputDevice = compositor.defaultInputDevice(); + QWaylandSeat* seat = compositor.defaultSeat(); - TestKeyboardGrabber* grab = static_cast<TestKeyboardGrabber *>(inputDevice->keyboard()); - QTRY_COMPARE(grab, inputDevice->keyboard()); + TestKeyboardGrabber* grab = static_cast<TestKeyboardGrabber *>(seat->keyboard()); + QTRY_COMPARE(grab, seat->keyboard()); QSignalSpy grabFocusSpy(grab, SIGNAL(focusedCalled())); QSignalSpy grabKeyPressSpy(grab, SIGNAL(keyPressCalled())); QSignalSpy grabKeyReleaseSpy(grab, SIGNAL(keyReleaseCalled())); //QSignalSpy grabModifierSpy(grab, SIGNAL(modifiersCalled())); - inputDevice->setKeyboardFocus(waylandSurface); + seat->setKeyboardFocus(waylandSurface); QTRY_COMPARE(grabFocusSpy.count(), 1); QKeyEvent ke(QEvent::KeyPress, Qt::Key_A, Qt::NoModifier, 30, 0, 0); QKeyEvent ke1(QEvent::KeyRelease, Qt::Key_A, Qt::NoModifier, 30, 0, 0); - inputDevice->sendFullKeyEvent(&ke); - inputDevice->sendFullKeyEvent(&ke1); + seat->sendFullKeyEvent(&ke); + seat->sendFullKeyEvent(&ke1); QTRY_COMPARE(grabKeyPressSpy.count(), 1); QTRY_COMPARE(grabKeyReleaseSpy.count(), 1); QKeyEvent ke2(QEvent::KeyPress, Qt::Key_Shift, Qt::NoModifier, 50, 0, 0); QKeyEvent ke3(QEvent::KeyRelease, Qt::Key_Shift, Qt::NoModifier, 50, 0, 0); - inputDevice->sendFullKeyEvent(&ke2); - inputDevice->sendFullKeyEvent(&ke3); + seat->sendFullKeyEvent(&ke2); + seat->sendFullKeyEvent(&ke3); //QTRY_COMPARE(grabModifierSpy.count(), 2); // Modifiers are also keys QTRY_COMPARE(grabKeyPressSpy.count(), 2); QTRY_COMPARE(grabKeyReleaseSpy.count(), 2); // Stop grabbing - inputDevice->setKeyboardFocus(Q_NULLPTR); - inputDevice->sendFullKeyEvent(&ke); - inputDevice->sendFullKeyEvent(&ke1); + seat->setKeyboardFocus(Q_NULLPTR); + seat->sendFullKeyEvent(&ke); + seat->sendFullKeyEvent(&ke1); QTRY_COMPARE(grabKeyPressSpy.count(), 2); } @@ -309,7 +309,7 @@ void tst_WaylandCompositor::frameCallback() wl_surface_destroy(surface); } -void tst_WaylandCompositor::inputDeviceCapabilities() +void tst_WaylandCompositor::seatCapabilities() { TestCompositor compositor; compositor.create(); @@ -317,19 +317,19 @@ void tst_WaylandCompositor::inputDeviceCapabilities() MockClient client; Q_UNUSED(client); - QWaylandInputDevice dev(&compositor, QWaylandInputDevice::Pointer); + QWaylandSeat dev(&compositor, QWaylandSeat::Pointer); QTRY_VERIFY(dev.pointer()); QTRY_VERIFY(!dev.keyboard()); QTRY_VERIFY(!dev.touch()); - QWaylandInputDevice dev2(&compositor, QWaylandInputDevice::Keyboard | QWaylandInputDevice::Touch); + QWaylandSeat dev2(&compositor, QWaylandSeat::Keyboard | QWaylandSeat::Touch); QTRY_VERIFY(!dev2.pointer()); QTRY_VERIFY(dev2.keyboard()); QTRY_VERIFY(dev2.touch()); } -void tst_WaylandCompositor::inputDeviceCreation() +void tst_WaylandCompositor::seatCreation() { TestCompositor compositor(true); compositor.create(); @@ -337,15 +337,15 @@ void tst_WaylandCompositor::inputDeviceCreation() MockClient client; Q_UNUSED(client); - TestInputDevice* dev = static_cast<TestInputDevice*>(compositor.defaultInputDevice()); + TestSeat* dev = static_cast<TestSeat*>(compositor.defaultSeat()); // The compositor will create the default input device - QTRY_COMPARE(compositor.defaultInputDevice(), dev); + QTRY_COMPARE(compositor.defaultSeat(), dev); QList<QMouseEvent *> allEvents; allEvents += dev->createMouseEvents(5); foreach (QMouseEvent *me, allEvents) { - compositor.inputDeviceFor(me); + compositor.seatFor(me); } // The default input device will get called exatly the number of times it has created @@ -353,7 +353,7 @@ void tst_WaylandCompositor::inputDeviceCreation() QTRY_COMPARE(dev->queryCount(), 5); } -void tst_WaylandCompositor::inputDeviceKeyboardFocus() +void tst_WaylandCompositor::seatKeyboardFocus() { TestCompositor compositor(true); compositor.create(); @@ -365,14 +365,14 @@ void tst_WaylandCompositor::inputDeviceKeyboardFocus() QTRY_COMPARE(compositor.surfaces.size(), 1); QWaylandSurface *waylandSurface = compositor.surfaces.at(0); - QWaylandInputDevice* dev = compositor.defaultInputDevice(); + QWaylandSeat* dev = compositor.defaultSeat(); dev->setKeyboardFocus(waylandSurface); - QTRY_COMPARE(compositor.defaultInputDevice()->keyboardFocus(), waylandSurface); + QTRY_COMPARE(compositor.defaultSeat()->keyboardFocus(), waylandSurface); wl_surface_destroy(surface); QTRY_VERIFY(compositor.surfaces.size() == 0); - QTRY_VERIFY(!compositor.defaultInputDevice()->keyboardFocus()); + QTRY_VERIFY(!compositor.defaultSeat()->keyboardFocus()); } class XdgTestCompositor: public TestCompositor { |