KWayland

xdgoutput_interface.h
1 /*
2  SPDX-FileCopyrightText: 2018 David Edmundson <[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_XDGOUTPUT_INTERFACE_H
7 #define KWAYLAND_SERVER_XDGOUTPUT_INTERFACE_H
8 
9 #include "global.h"
10 #include "resource.h"
11 
12 #include <KWayland/Server/kwaylandserver_export.h>
13 
14 /*
15  * In terms of protocol XdgOutputInterface are a resource
16  * but for the sake of sanity, we should treat XdgOutputs as globals like Output is
17  * Hence this doesn't match most of kwayland API paradigms.
18  */
19 
20 namespace KWayland
21 {
22 namespace Server
23 {
24 class Display;
25 class OutputInterface;
26 class XdgOutputInterface;
27 
28 /**
29  * Global manager for XdgOutputs
30  * @since 5.47
31  */
32 class KWAYLANDSERVER_EXPORT XdgOutputManagerInterface : public Global
33 {
34  Q_OBJECT
35 public:
36  ~XdgOutputManagerInterface() override;
37  /**
38  * Creates an XdgOutputInterface object for an existing Output
39  * which exposes XDG specific properties of outputs
40  *
41  * @arg output the wl_output interface this XDG output is for
42  * @parent the parent of the newly created object
43  */
44  XdgOutputInterface *createXdgOutput(OutputInterface *output, QObject *parent);
45 
46 private:
47  explicit XdgOutputManagerInterface(Display *display, QObject *parent = nullptr);
48  friend class Display;
49  class Private;
50  Private *d_func() const;
51 };
52 
53 /**
54  * Extension to Output
55  * Users should set all relevant values on creation and on future changes.
56  * done() should be explicitly called after change batches including initial setting.
57  * @since 5.47
58  */
59 class KWAYLANDSERVER_EXPORT XdgOutputInterface : public QObject
60 {
61  Q_OBJECT
62 public:
63  ~XdgOutputInterface() override;
64 
65  /**
66  * Sets the size of this output in logical coordinates.
67  * Users should call done() after setting all values
68  */
69  void setLogicalSize(const QSize &size);
70 
71  /**
72  * Returns the last set logical size on this output
73  */
74  QSize logicalSize() const;
75 
76  /**
77  * Sets the topleft position of this output in logical coordinates.
78  * Users should call done() after setting all values
79  * @see OutputInterface::setPosition
80  */
81  void setLogicalPosition(const QPoint &pos);
82 
83  /**
84  * Returns the last set logical position on this output
85  */
86  QPoint logicalPosition() const;
87 
88  /**
89  * @brief Sets a short name of the output
90  * This should be consistent across reboots for the same monitor
91  * It should be set once before the first done call
92  * @since 5.XDGOUTPUT
93  */
94  void setName(const QString &name);
95  /**
96  * The last set name
97  * @since 5.XDGOUTPUT
98  */
99  void name() const;
100 
101  /**
102  * @brief Sets a longer description of the output
103  * This should be consistent across reboots for the same monitor
104  * It should be set once before the first done call
105  * @since 5.XDGOUTPUT
106  */
107  void setDescription(const QString &description);
108  /**
109  * The last set description
110  * @since 5.XDGOUTPUT
111  */
112  void description() const;
113 
114  /**
115  * Submit changes to all clients
116  */
117  void done();
118 
119 private:
120  explicit XdgOutputInterface(QObject *parent);
121  friend class XdgOutputManagerInterface;
122 
123  class Private;
125 };
126 
127 }
128 }
129 
130 #endif
Class holding the Wayland server display loop.
Definition: display.h:86
Global for the wl_output interface.
Extension to Output Users should set all relevant values on creation and on future changes.
Base class for all Globals.
Definition: global.h:46
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Wed Feb 8 2023 03:59:22 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.