diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index f78bf2dd2a0..79cec09af93 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -652,6 +652,9 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin #if QT_CONFIG(tabletevent) } else if (interface == QLatin1String(QWaylandTabletManagerV2::interface()->name)) { mGlobals.tabletManager.reset(new QWaylandTabletManagerV2(this, id, qMin(1, int(version)))); + for (QWaylandInputDevice *inputDevice : std::as_const(mInputDevices)) + inputDevice->setTabletSeat( + new QWaylandTabletSeatV2(mGlobals.tabletManager.get(), inputDevice)); #endif } else if (interface == QLatin1String(QWaylandPointerGestures::interface()->name)) { mGlobals.pointerGestures.reset(new QWaylandPointerGestures(this, id, 1)); diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 416894fd439..c72c2a81452 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -563,6 +563,18 @@ void QWaylandInputDevice::setTextInput(QWaylandTextInputInterface *textInput) mTextInput.reset(textInput); } +#if QT_CONFIG(tabletevent) +void QWaylandInputDevice::setTabletSeat(QWaylandTabletSeatV2 *tabletSeat) +{ + mTabletSeat.reset(tabletSeat); +} + +QWaylandTabletSeatV2 *QWaylandInputDevice::tabletSeat() const +{ + return mTabletSeat.get(); +} +#endif + void QWaylandInputDevice::setTextInputMethod(QWaylandTextInputMethod *textInputMethod) { mTextInputMethod.reset(textInputMethod); diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp index be8f1977008..e15185f08ef 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2.cpp +++ b/src/plugins/platforms/wayland/qwaylandtabletv2.cpp @@ -13,11 +13,6 @@ namespace QtWaylandClient { QWaylandTabletManagerV2::QWaylandTabletManagerV2(QWaylandDisplay *display, uint id, uint version) : zwp_tablet_manager_v2(display->wl_registry(), id, qMin(version, uint(1))) { - // Create tabletSeats for all seats. - // This only works if we get the manager after all seats - const auto seats = display->inputDevices(); - for (auto *seat : seats) - createTabletSeat(seat); } QWaylandTabletManagerV2::~QWaylandTabletManagerV2() @@ -25,11 +20,6 @@ QWaylandTabletManagerV2::~QWaylandTabletManagerV2() destroy(); } -QWaylandTabletSeatV2 *QWaylandTabletManagerV2::createTabletSeat(QWaylandInputDevice *seat) -{ - return new QWaylandTabletSeatV2(this, seat); -} - QWaylandTabletSeatV2::QWaylandTabletSeatV2(QWaylandTabletManagerV2 *manager, QWaylandInputDevice *seat) : QtWayland::zwp_tablet_seat_v2(manager->get_tablet_seat(seat->wl_seat())) , m_seat(seat) diff --git a/src/plugins/platforms/wayland/qwaylandtabletv2_p.h b/src/plugins/platforms/wayland/qwaylandtabletv2_p.h index 20a8a4f5a24..f6f1daa9886 100644 --- a/src/plugins/platforms/wayland/qwaylandtabletv2_p.h +++ b/src/plugins/platforms/wayland/qwaylandtabletv2_p.h @@ -43,7 +43,6 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandTabletManagerV2 : public QtWayland::zwp_tab public: explicit QWaylandTabletManagerV2(QWaylandDisplay *display, uint id, uint version); ~QWaylandTabletManagerV2() override; - QWaylandTabletSeatV2 *createTabletSeat(QWaylandInputDevice *seat); }; class Q_WAYLANDCLIENT_EXPORT QWaylandTabletSeatV2 : public QObject, public QtWayland::zwp_tablet_seat_v2