[neon/qt6/qt6-wayland/Neon/release] debian/patches: backport tablet patch as recommended by dredondo
Carlos De Maine
null at kde.org
Thu Nov 28 04:29:02 GMT 2024
Git commit 9c74dc9cb630e8ea95e1905eeec1d06d7cd913d4 by Carlos De Maine.
Committed on 28/11/2024 at 04:29.
Pushed by carlosdem into branch 'Neon/release'.
backport tablet patch as recommended by dredondo
A +236 -0 debian/patches/24002ac6cbd01dbde4944b63c1f7c87ed2bd72b5.diff
M +1 -0 debian/patches/series
https://invent.kde.org/neon/qt6/qt6-wayland/-/commit/9c74dc9cb630e8ea95e1905eeec1d06d7cd913d4
diff --git a/debian/patches/24002ac6cbd01dbde4944b63c1f7c87ed2bd72b5.diff b/debian/patches/24002ac6cbd01dbde4944b63c1f7c87ed2bd72b5.diff
new file mode 100644
index 0000000..3863831
--- /dev/null
+++ b/debian/patches/24002ac6cbd01dbde4944b63c1f7c87ed2bd72b5.diff
@@ -0,0 +1,236 @@
+diff --git a/src/client/qwaylandtabletv2.cpp b/src/client/qwaylandtabletv2.cpp
+index 305aae50c348ea529551179a7c783699d2c07281..c3f665df203b164f05e1304d18134dd1d6def510 100644
+--- a/src/client/qwaylandtabletv2.cpp
++++ b/src/client/qwaylandtabletv2.cpp
+@@ -185,12 +185,6 @@ QWaylandTabletSeatV2::QWaylandTabletSeatV2(QWaylandTabletManagerV2 *manager, QWa
+
+ QWaylandTabletSeatV2::~QWaylandTabletSeatV2()
+ {
+- for (auto *tablet : m_tablets)
+- tablet->destroy();
+- for (auto *tool : m_tools)
+- tool->destroy();
+- for (auto *pad : m_pads)
+- pad->destroy();
+ qDeleteAll(m_tablets);
+ qDeleteAll(m_tools);
+ qDeleteAll(m_deadTools);
+@@ -252,6 +246,11 @@ QWaylandTabletV2::QWaylandTabletV2(::zwp_tablet_v2 *tablet, const QString &seatN
+ d->seatName = seatName;
+ }
+
++QWaylandTabletV2::~QWaylandTabletV2()
++{
++ destroy();
++}
++
+ void QWaylandTabletV2::zwp_tablet_v2_name(const QString &name)
+ {
+ QPointingDevicePrivate *d = QPointingDevicePrivate::get(this);
+@@ -290,7 +289,6 @@ void QWaylandTabletSeatV2::toolRemoved(QWaylandTabletToolV2 *tool)
+
+ void QWaylandTabletV2::zwp_tablet_v2_removed()
+ {
+- destroy();
+ deleteLater();
+ }
+
+@@ -314,7 +312,10 @@ QWaylandTabletToolV2::QWaylandTabletToolV2(QWaylandTabletSeatV2 *tabletSeat, ::z
+ #endif
+ }
+
+-QWaylandTabletToolV2::~QWaylandTabletToolV2() = default;
++QWaylandTabletToolV2::~QWaylandTabletToolV2()
++{
++ destroy();
++}
+
+ void QWaylandTabletToolV2::zwp_tablet_tool_v2_type(uint32_t tool_type)
+ {
+@@ -408,7 +409,6 @@ void QWaylandTabletToolV2::zwp_tablet_tool_v2_done()
+
+ void QWaylandTabletToolV2::zwp_tablet_tool_v2_removed()
+ {
+- destroy();
+ m_tabletSeat->toolRemoved(this);
+ }
+
+@@ -600,6 +600,11 @@ QWaylandTabletPadV2::QWaylandTabletPadV2(::zwp_tablet_pad_v2 *pad)
+ {
+ }
+
++QWaylandTabletPadV2::~QWaylandTabletPadV2()
++{
++ destroy();
++}
++
+ void QWaylandTabletPadV2::zwp_tablet_pad_v2_path(const QString &path)
+ {
+ QPointingDevicePrivate *d = QPointingDevicePrivate::get(this);
+@@ -619,7 +624,6 @@ void QWaylandTabletPadV2::zwp_tablet_pad_v2_done()
+
+ void QWaylandTabletPadV2::zwp_tablet_pad_v2_removed()
+ {
+- destroy();
+ delete this;
+ }
+
+diff --git a/src/client/qwaylandtabletv2_p.h b/src/client/qwaylandtabletv2_p.h
+index 94b687ee3eacb0394587fe1bd38d59542cefe45b..f0d7cd189bbf5703c9c01ee9416414274d3f9473 100644
+--- a/src/client/qwaylandtabletv2_p.h
++++ b/src/client/qwaylandtabletv2_p.h
+@@ -83,6 +83,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandTabletV2 : public QPointingDevice, public Q
+ Q_OBJECT
+ public:
+ explicit QWaylandTabletV2(::zwp_tablet_v2 *tablet, const QString &seatName);
++ ~QWaylandTabletV2();
+
+ protected:
+ // callbacks which act as setters
+@@ -98,7 +99,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandTabletToolV2 : public QPointingDevice, publ
+ Q_OBJECT
+ public:
+ QWaylandTabletToolV2(QWaylandTabletSeatV2 *tabletSeat, ::zwp_tablet_tool_v2 *tool);
+- ~QWaylandTabletToolV2() override;
++ ~QWaylandTabletToolV2();
+
+ void updateCursor();
+
+@@ -181,6 +182,7 @@ class Q_WAYLANDCLIENT_EXPORT QWaylandTabletPadV2 : public QPointingDevice, publi
+ Q_OBJECT
+ public:
+ explicit QWaylandTabletPadV2(::zwp_tablet_pad_v2 *pad);
++ ~QWaylandTabletPadV2();
+
+ protected:
+ // void zwp_tablet_pad_v2_group(struct ::zwp_tablet_pad_group_v2 *pad_group) override;
+diff --git a/tests/auto/client/tabletv2/tst_tabletv2.cpp b/tests/auto/client/tabletv2/tst_tabletv2.cpp
+index 85df099f90c37121f0dcfd7438058f7ae9bc5e44..d5c2ccb36659720464b4b014e661de901ff1a20a 100644
+--- a/tests/auto/client/tabletv2/tst_tabletv2.cpp
++++ b/tests/auto/client/tabletv2/tst_tabletv2.cpp
+@@ -186,9 +186,9 @@ public:
+ QList<TabletV2 *> m_tablets;
+ QList<TabletV2 *> m_tabletsWaitingForDestroy;
+ QList<TabletToolV2 *> m_tools;
+- QList<TabletToolV2 *> m_toolsWaitingForDestroy;
++ QList<TabletToolV2::Resource *> m_toolsWaitingForDestroy;
+ QList<TabletPadV2 *> m_pads;
+- QList<TabletPadV2 *> m_padsWaitingForDestroy;
++ QList<TabletPadV2::Resource *> m_padsWaitingForDestroy;
+
+ protected:
+ void zwp_tablet_seat_v2_bind_resource(Resource *resource) override
+@@ -274,11 +274,12 @@ void TabletV2::zwp_tablet_v2_destroy(QtWaylandServer::zwp_tablet_v2::Resource *r
+
+ void TabletToolV2::sendRemoved()
+ {
+- for (auto *resource : resourceMap())
++ for (auto *resource : resourceMap()) {
+ zwp_tablet_tool_v2_send_removed(resource->handle);
++ m_tabletSeat->m_toolsWaitingForDestroy.append(resource);
++ }
+ bool removed = m_tabletSeat->m_tools.removeOne(this);
+ QVERIFY(removed);
+- m_tabletSeat->m_toolsWaitingForDestroy.append(this);
+ }
+
+ uint TabletToolV2::sendProximityIn(TabletV2 *tablet, Surface *surface)
+@@ -333,26 +334,25 @@ uint TabletToolV2::sendFrame()
+ void TabletToolV2::zwp_tablet_tool_v2_destroy(QtWaylandServer::zwp_tablet_tool_v2::Resource *resource)
+ {
+ if (m_tabletSeat) {
+- bool removed = m_tabletSeat->m_toolsWaitingForDestroy.removeOne(this);
+- QVERIFY(removed);
++ m_tabletSeat->m_toolsWaitingForDestroy.removeOne(resource);
+ }
+ wl_resource_destroy(resource->handle);
+ }
+
+ void TabletPadV2::sendRemoved()
+ {
+- for (auto *resource : resourceMap())
++ for (auto *resource : resourceMap()) {
+ zwp_tablet_pad_v2_send_removed(resource->handle);
++ m_tabletSeat->m_padsWaitingForDestroy.append(resource);
++ }
+ bool removed = m_tabletSeat->m_pads.removeOne(this);
+ QVERIFY(removed);
+- m_tabletSeat->m_padsWaitingForDestroy.append(this);
+ }
+
+ void TabletPadV2::zwp_tablet_pad_v2_destroy(QtWaylandServer::zwp_tablet_pad_v2::Resource *resource)
+ {
+ if (m_tabletSeat) {
+- bool removed = m_tabletSeat->m_padsWaitingForDestroy.removeOne(this);
+- QVERIFY(removed);
++ m_tabletSeat->m_padsWaitingForDestroy.removeOne(resource);
+ }
+ wl_resource_destroy(resource->handle);
+ }
+@@ -405,6 +405,8 @@ private slots:
+ void destroysTablet();
+ void destroysTool();
+ void destroysPad();
++ void removeTabletBeforeTool();
++ void removeTabletBeforePad();
+ void proximityEvents();
+ void moveEvent();
+ void pointerType_data();
+@@ -502,12 +504,14 @@ void tst_tabletv2::destroysTool()
+ {
+ QCOMPOSITOR_TRY_VERIFY(tabletSeat());
+ exec([&] {
++ tabletSeat()->addTablet();
+ tabletSeat()->addTool();
+ });
+ QCOMPOSITOR_TRY_VERIFY(tabletTool());
+
+ exec([&] {
+ tabletTool()->sendRemoved();
++ tablet()->sendRemoved();
+ });
+
+ QCOMPOSITOR_TRY_VERIFY(!tabletTool());
+@@ -530,6 +534,42 @@ void tst_tabletv2::destroysPad()
+ QCOMPOSITOR_TRY_VERIFY(tabletSeat()->m_padsWaitingForDestroy.empty());
+ }
+
++void tst_tabletv2::removeTabletBeforeTool()
++{
++ QCOMPOSITOR_TRY_VERIFY(tabletSeat());
++ exec([&] {
++ tabletSeat()->addTablet();
++ tabletSeat()->addTool();
++ });
++ QCOMPOSITOR_TRY_VERIFY(tablet());
++ QCOMPOSITOR_TRY_VERIFY(tabletTool());
++
++ exec([&] { tablet()->sendRemoved(); });
++ QCOMPOSITOR_TRY_VERIFY(tabletSeat()->m_tabletsWaitingForDestroy.empty());
++
++ exec([&] { tabletTool()->sendRemoved(); });
++ QCOMPOSITOR_TRY_VERIFY(!tabletTool());
++ QCOMPOSITOR_TRY_VERIFY(tabletSeat()->m_toolsWaitingForDestroy.empty());
++}
++
++void tst_tabletv2::removeTabletBeforePad()
++{
++ QCOMPOSITOR_TRY_VERIFY(tabletSeat());
++ exec([&] {
++ tabletSeat()->addTablet();
++ tabletSeat()->addPad();
++ });
++ QCOMPOSITOR_TRY_VERIFY(tablet());
++ QCOMPOSITOR_TRY_VERIFY(tabletPad());
++
++ exec([&] { tablet()->sendRemoved(); });
++ QCOMPOSITOR_TRY_VERIFY(tabletSeat()->m_tabletsWaitingForDestroy.empty());
++
++ exec([&] { tabletPad()->sendRemoved(); });
++ QCOMPOSITOR_TRY_VERIFY(!tabletPad());
++ QCOMPOSITOR_TRY_VERIFY(tabletSeat()->m_padsWaitingForDestroy.empty());
++}
++
+ void tst_tabletv2::proximityEvents()
+ {
+ ProximityFilter filter;
diff --git a/debian/patches/series b/debian/patches/series
index 9183732..027f89d 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1 +1,2 @@
c2f61bc47baacf2e6a44c6c3c4e4cbf0abfa4095.diff
+24002ac6cbd01dbde4944b63c1f7c87ed2bd72b5.diff
\ No newline at end of file
More information about the Neon-commits
mailing list