[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
This commit is contained in:
Vlad Zahorodnii 2020-02-22 00:13:08 +02:00
parent 4967a1b507
commit ad44b0f08c
2 changed files with 12 additions and 0 deletions

View file

@ -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()) {

View file

@ -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.