From ad44b0f08c9940c70a50216b25781ab5fa2160bd Mon Sep 17 00:00:00 2001 From: Vlad Zahorodnii Date: Sat, 22 Feb 2020 00:13:08 +0200 Subject: [PATCH] [server] Add some sub-surface life cycle signals Summary: These signals can be very useful when one wants to monitor changes in a sub-surface tree. Reviewers: #kwin, apol Reviewed By: apol Subscribers: apol, kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D27860 --- src/wayland/surface_interface.cpp | 2 ++ src/wayland/surface_interface.h | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/wayland/surface_interface.cpp b/src/wayland/surface_interface.cpp index 3b78664436..e61d5794ba 100644 --- a/src/wayland/surface_interface.cpp +++ b/src/wayland/surface_interface.cpp @@ -43,6 +43,7 @@ void SurfaceInterface::Private::addChild(QPointer< SubSurfaceInterface > child) subSurfacePending.children.append(child); current.children.append(child); Q_Q(SurfaceInterface); + emit q->childSubSurfaceAdded(child); emit q->subSurfaceTreeChanged(); QObject::connect(child.data(), &SubSurfaceInterface::positionChanged, q, &SurfaceInterface::subSurfaceTreeChanged); QObject::connect(child->surface().data(), &SurfaceInterface::damaged, q, &SurfaceInterface::subSurfaceTreeChanged); @@ -57,6 +58,7 @@ void SurfaceInterface::Private::removeChild(QPointer< SubSurfaceInterface > chil subSurfacePending.children.removeAll(child); current.children.removeAll(child); Q_Q(SurfaceInterface); + emit q->childSubSurfaceRemoved(child); emit q->subSurfaceTreeChanged(); QObject::disconnect(child.data(), &SubSurfaceInterface::positionChanged, q, &SurfaceInterface::subSurfaceTreeChanged); if (!child->surface().isNull()) { diff --git a/src/wayland/surface_interface.h b/src/wayland/surface_interface.h index fb61978fda..ad8f24e415 100644 --- a/src/wayland/surface_interface.h +++ b/src/wayland/surface_interface.h @@ -330,6 +330,16 @@ Q_SIGNALS: * @since 5.22 **/ void subSurfaceTreeChanged(); + /** + * Emitted whenever a new child sub-surface @p subSurface is added. + * @since 5.70 + */ + void childSubSurfaceAdded(SubSurfaceInterface *subSurface); + /** + * Emitted whenver the child sub-surface @p subSurface is removed. + * @since 5.70 + */ + void childSubSurfaceRemoved(SubSurfaceInterface *subSurface); /** * Emitted whenever a pointer constraint get (un)installed on this SurfaceInterface.