File indexing completed on 2024-05-19 16:35:32
0001 /* 0002 SPDX-FileCopyrightText: 2017 Marco Martin <notmart@gmail.com> 0003 SPDX-FileCopyrightText: 2021 Vlad Zahorodnii <vlad.zahorodnii@kde.org> 0004 0005 SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL 0006 */ 0007 #pragma once 0008 0009 #include "kwin_export.h" 0010 0011 #include <QObject> 0012 0013 namespace KWaylandServer 0014 { 0015 class Display; 0016 class SurfaceInterface; 0017 class XdgForeignV2InterfacePrivate; 0018 0019 /** 0020 * This class encapsulates the server side logic of the XdgForeign protocol. 0021 * a process can export a surface to be identifiable by a server-wide unique 0022 * string handle, and another process can in turn import that surface, and set it 0023 * as transient parent for one of its own surfaces. 0024 * This parent relationship is traced by the transientChanged signal and the 0025 * transientFor method. 0026 */ 0027 class KWIN_EXPORT XdgForeignV2Interface : public QObject 0028 { 0029 Q_OBJECT 0030 public: 0031 XdgForeignV2Interface(Display *display, QObject *parent = nullptr); 0032 ~XdgForeignV2Interface() override; 0033 0034 /** 0035 * If a client did import a surface and set one of its own as child of the 0036 * imported one, this returns the mapping. 0037 * @param surface the child surface we want to search an imported transientParent for. 0038 * @returns the transient parent of the surface, if found, nullptr otherwise. 0039 */ 0040 SurfaceInterface *transientFor(SurfaceInterface *surface); 0041 0042 Q_SIGNALS: 0043 /** 0044 * A surface got a new imported transient parent 0045 * @param parent is the surface exported by one client and imported into another, which will act as parent. 0046 * @param child is the surface that the importer client did set as child of the surface 0047 * that it imported. 0048 * If one of the two paramenters is nullptr, it means that a previously relation is not 0049 * valid anymore and either one of the surfaces has been unmapped, or the parent surface 0050 * is not exported anymore. 0051 */ 0052 void transientChanged(KWaylandServer::SurfaceInterface *child, KWaylandServer::SurfaceInterface *parent); 0053 0054 private: 0055 friend class XdgExporterV2Interface; 0056 friend class XdgImporterV2Interface; 0057 std::unique_ptr<XdgForeignV2InterfacePrivate> d; 0058 }; 0059 0060 }