KWayland

resource.h
1 /*
2  SPDX-FileCopyrightText: 2014 Martin Gräßlin <[email protected]>
3 
4  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
5 */
6 #ifndef WAYLAND_SERVER_RESOURCE_H
7 #define WAYLAND_SERVER_RESOURCE_H
8 
9 #include <QObject>
10 
11 #include <KWayland/Server/kwaylandserver_export.h>
12 
13 struct wl_client;
14 struct wl_resource;
15 
16 namespace KWayland
17 {
18 namespace Server
19 {
20 class ClientConnection;
21 class Global;
22 
23 /**
24  * @brief Represents a bound Resource.
25  *
26  * A Resource normally gets created by a @link Global @endlink.
27  *
28  * The Resource is a base class for all specific resources and provides
29  * access to various common aspects.
30  **/
31 class KWAYLANDSERVER_EXPORT Resource : public QObject
32 {
33  Q_OBJECT
34 public:
35  virtual ~Resource();
36  void create(ClientConnection *client, quint32 version, quint32 id);
37 
38  /**
39  * @returns the native wl_resource this Resource was created for.
40  **/
41  wl_resource *resource();
42  /**
43  * @returns The ClientConnection for which the Resource was created.
44  **/
45  ClientConnection *client();
46  /**
47  * @returns The Global which created the Resource.
48  **/
49  Global *global();
50  /**
51  * @returns the native parent wl_resource, e.g. the wl_resource bound on the Global
52  **/
53  wl_resource *parentResource() const;
54  /**
55  * @returns The id of this Resource if it is created, otherwise @c 0.
56  *
57  * This is a convenient wrapper for wl_resource_get_id.
58  * @since 5.3
59  **/
60  quint32 id() const;
61 
62 Q_SIGNALS:
63  /**
64  * This signal is emitted when the client unbound this Resource.
65  * The Resource will be deleted in the next event cycle after this event.
66  * @since 5.24
67  **/
68  void unbound();
69  /**
70  * This signal is emitted when the client is in the process of unbinding the Resource.
71  * In opposite to @link{unbound} the @link{resource} is still valid and allows to perform
72  * cleanup tasks. Example: send a keyboard leave for the Surface which is in the process of
73  * getting destroyed.
74  *
75  * @see unbound
76  * @since 5.37
77  **/
78  void aboutToBeUnbound();
79 
80 protected:
81  class Private;
82  explicit Resource(Private *d, QObject *parent = nullptr);
84 };
85 
86 }
87 }
88 #endif
Base class for all Globals.
Definition: global.h:46
Represents a bound Resource.
Definition: resource.h:31
Convenient Class which represents a wl_client.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Sep 23 2021 22:51:09 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.