KWayland

xdgforeign_interface.h
1 /*
2  SPDX-FileCopyrightText: 2017 Marco Martin <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6 #ifndef KWAYLAND_SERVER_XDGFOREIGN_INTERFACE_H
7 #define KWAYLAND_SERVER_XDGFOREIGN_INTERFACE_H
8 
9 #include "global.h"
10 #include "resource.h"
11 
12 #include <KWayland/Server/kwaylandserver_export.h>
13 
14 namespace KWayland
15 {
16 namespace Server
17 {
18 class Display;
19 class SurfaceInterface;
20 class XdgExporterUnstableV2Interface;
21 class XdgImporterUnstableV2Interface;
22 
23 /**
24  * This class encapsulates the server side logic of the XdgForeign protocol.
25  * a process can export a surface to be identifiable by a server-wide unique
26  * string handle, and another process can in turn import that surface, and set it
27  * as transient parent for one of its own surfaces.
28  * This parent relationship is traced by the transientChanged signal and the
29  * transientFor method.
30  *
31  * @since 5.40
32  */
33 class KWAYLANDSERVER_EXPORT XdgForeignInterface : public QObject
34 {
35  Q_OBJECT
36 public:
37  XdgForeignInterface(Display *display, QObject *parent = nullptr);
38  ~XdgForeignInterface() override;
39 
40  /**
41  * Creates the native zxdg_exporter_v2 and zxdg_importer_v2 interfaces
42  * and announces them to the client.
43  */
44  void create();
45 
46  /**
47  * @returns true if theimporter and exporter are valid and functional
48  */
49  bool isValid();
50 
51  /**
52  * If a client did import a surface and set one of its own as child of the
53  * imported one, this returns the mapping.
54  * @param surface the child surface we want to search an imported transientParent for.
55  * @returns the transient parent of the surface, if found, nullptr otherwise.
56  */
57  SurfaceInterface *transientFor(SurfaceInterface *surface);
58 
59 Q_SIGNALS:
60  /**
61  * A surface got a new imported transient parent
62  * @param parent is the surface exported by one client and imported into another, which will act as parent.
63  * @param child is the surface that the importer client did set as child of the surface
64  * that it imported.
65  * If one of the two parameters is nullptr, it means that a previously relation is not
66  * valid anymore and either one of the surfaces has been unmapped, or the parent surface
67  * is not exported anymore.
68  */
69  void transientChanged(KWayland::Server::SurfaceInterface *child, KWayland::Server::SurfaceInterface *parent);
70 
71 private:
72  friend class Display;
73  friend class XdgExporterUnstableV2Interface;
74  friend class XdgImporterUnstableV2Interface;
75  class Private;
76  Private *d;
77 };
78 
79 }
80 }
81 
82 #endif
Class holding the Wayland server display loop.
Definition: display.h:86
This class encapsulates the server side logic of the XdgForeign protocol.
Resource representing a wl_surface.
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Tue Oct 3 2023 04:08:58 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.