File indexing completed on 2024-05-19 16:34:58

0001 /*
0002     KWin - the KDE window manager
0003     This file is part of the KDE project.
0004 
0005     SPDX-FileCopyrightText: 2020 Vlad Zahorodnii <vlad.zahorodnii@kde.org>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #pragma once
0011 
0012 #include <QObject>
0013 
0014 namespace KWaylandServer
0015 {
0016 class SurfaceInterface;
0017 class SubSurfaceInterface;
0018 }
0019 
0020 namespace KWin
0021 {
0022 
0023 /**
0024  * The SubSurfaceMonitor class provides a convenient way for monitoring changes in
0025  * sub-surface trees, e.g. addition or removal of sub-surfaces, etc.
0026  */
0027 class SubSurfaceMonitor : public QObject
0028 {
0029     Q_OBJECT
0030 
0031 public:
0032     /**
0033      * Constructs a SubSurfaceTreeMonitor with the given @a surface and @a parent.
0034      */
0035     SubSurfaceMonitor(KWaylandServer::SurfaceInterface *surface, QObject *parent);
0036 
0037 Q_SIGNALS:
0038     /**
0039      * This signal is emitted when a new sub-surface has been added to the tree.
0040      */
0041     void subSurfaceAdded();
0042     /**
0043      * This signal is emitted when a sub-surface has been removed from the tree.
0044      */
0045     void subSurfaceRemoved();
0046     /**
0047      * This signal is emitted when a sub-surface has been moved relative to its parent.
0048      */
0049     void subSurfaceMoved();
0050     /**
0051      * This signal is emitted when a sub-surface has been resized.
0052      */
0053     void subSurfaceResized();
0054     /**
0055      * This signal is emitted when a sub-surface is mapped.
0056      */
0057     void subSurfaceMapped();
0058     /**
0059      * This signal is emitted when a sub-surface is unmapped.
0060      */
0061     void subSurfaceUnmapped();
0062     /**
0063      * This signal is emitted when the mapping between the surface-local coordinate space
0064      * and the buffer coordinate space for a sub-surface has changed.
0065      */
0066     void subSurfaceSurfaceToBufferMatrixChanged();
0067     /**
0068      * This signal is emitted when the buffer size of a subsurface has changed.
0069      */
0070     void subSurfaceBufferSizeChanged();
0071     void subSurfaceCommitted(KWaylandServer::SubSurfaceInterface *subSurface);
0072 
0073 private:
0074     void registerSubSurface(KWaylandServer::SubSurfaceInterface *subSurface);
0075     void unregisterSubSurface(KWaylandServer::SubSurfaceInterface *subSurface);
0076     void registerSurface(KWaylandServer::SurfaceInterface *surface);
0077     void unregisterSurface(KWaylandServer::SurfaceInterface *surface);
0078 };
0079 
0080 } // namespace KWin