KWayland

outputmanagement.h
1 /*
2  SPDX-FileCopyrightText: 2015 Sebastian Kügler <[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_CLIENT_OUTPUTMANAGEMENT_H
7 #define KWAYLAND_CLIENT_OUTPUTMANAGEMENT_H
8 
9 #include <QObject>
10 
11 #include <KWayland/Client/kwaylandclient_export.h>
12 
13 struct org_kde_kwin_outputmanagement;
14 struct org_kde_kwin_outputconfiguration;
15 
16 namespace KWayland
17 {
18 namespace Client
19 {
20 class EventQueue;
21 class OutputConfiguration;
22 
23 /**
24  * @short Wrapper for the org_kde_kwin_outputmanagement interface.
25  *
26  * This class provides a convenient wrapper for the org_kde_kwin_outputmanagement interface.
27  *
28  * To use this class one needs to interact with the Registry. There are two
29  * possible ways to create the OutputManagement interface:
30  * @code
31  * OutputManagement *c = registry->createOutputManagement(name, version);
32  * @endcode
33  *
34  * This creates the OutputManagement and sets it up directly. As an alternative this
35  * can also be done in a more low level way:
36  * @code
37  * OutputManagement *c = new OutputManagement;
38  * c->setup(registry->bindOutputManagement(name, version));
39  * @endcode
40  *
41  * The OutputManagement can be used as a drop-in replacement for any org_kde_kwin_outputmanagement
42  * pointer as it provides matching cast operators.
43  *
44  * @see Registry
45  * @since 5.5
46  **/
47 class KWAYLANDCLIENT_EXPORT OutputManagement : public QObject
48 {
49  Q_OBJECT
50 public:
51  /**
52  * Creates a new OutputManagement.
53  * Note: after constructing the OutputManagement it is not yet valid and one needs
54  * to call setup. In order to get a ready to use OutputManagement prefer using
55  * Registry::createOutputManagement.
56  **/
57  explicit OutputManagement(QObject *parent = nullptr);
58  virtual ~OutputManagement();
59 
60  /**
61  * Setup this OutputManagement to manage the @p outputmanagement.
62  * When using Registry::createOutputManagement there is no need to call this
63  * method.
64  **/
65  void setup(org_kde_kwin_outputmanagement *outputmanagement);
66  /**
67  * @returns @c true if managing a org_kde_kwin_outputmanagement.
68  **/
69  bool isValid() const;
70  /**
71  * Releases the org_kde_kwin_outputmanagement interface.
72  * After the interface has been released the OutputManagement instance is no
73  * longer valid and can be setup with another org_kde_kwin_outputmanagement interface.
74  **/
75  void release();
76  /**
77  * Destroys the data hold by this OutputManagement.
78  * This method is supposed to be used when the connection to the Wayland
79  * server goes away. If the connection is not valid any more, it's not
80  * possible to call release any more as that calls into the Wayland
81  * connection and the call would fail. This method cleans up the data, so
82  * that the instance can be deleted or setup to a new org_kde_kwin_outputmanagement interface
83  * once there is a new connection available.
84  *
85  * This method is automatically invoked when the Registry which created this
86  * OutputManagement gets destroyed.
87  *
88  * @see release
89  **/
90  void destroy();
91 
92  /**
93  * Sets the @p queue to use for creating objects with this OutputManagement.
94  **/
95  void setEventQueue(EventQueue *queue);
96  /**
97  * @returns The event queue to use for creating objects with this OutputManagement.
98  **/
99  EventQueue *eventQueue();
100 
101  OutputConfiguration *createConfiguration(QObject *parent = nullptr);
102 
103  operator org_kde_kwin_outputmanagement *();
104  operator org_kde_kwin_outputmanagement *() const;
105 
106 Q_SIGNALS:
107  /**
108  * The corresponding global for this interface on the Registry got removed.
109  *
110  * This signal gets only emitted if the OutputManagement got created by
111  * Registry::createOutputManagement
112  **/
113  void removed();
114 
115 private:
116  class Private;
118 };
119 
120 }
121 }
122 
123 #endif
Wrapper class for wl_event_queue interface.
Definition: event_queue.h:54
OutputConfiguration provides access to changing OutputDevices.
Wrapper for the org_kde_kwin_outputmanagement interface.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Thu Sep 23 2021 22:51:08 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.