KWayland

output.h
1 /*
2  SPDX-FileCopyrightText: 2013 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_OUTPUT_H
7 #define WAYLAND_OUTPUT_H
8 
9 #include <QObject>
10 #include <QPointer>
11 #include <QSize>
12 
13 #include <KWayland/Client/kwaylandclient_export.h>
14 
15 struct wl_output;
16 class QPoint;
17 class QRect;
18 
19 namespace KWayland
20 {
21 namespace Client
22 {
23 
24 class EventQueue;
25 
55 class KWAYLANDCLIENT_EXPORT Output : public QObject
56 {
57  Q_OBJECT
58 public:
59  enum class SubPixel {
60  Unknown,
61  None,
62  HorizontalRGB,
63  HorizontalBGR,
64  VerticalRGB,
65  VerticalBGR
66  };
67  enum class Transform {
68  Normal,
69  Rotated90,
70  Rotated180,
71  Rotated270,
72  Flipped,
73  Flipped90,
74  Flipped180,
75  Flipped270
76  };
77  struct Mode {
78  enum class Flag {
79  None = 0,
80  Current = 1 << 0,
81  Preferred = 1 << 1
82  };
83  Q_DECLARE_FLAGS(Flags, Flag)
87  QSize size;
91  int refreshRate = 0;
96  Flags flags = Flag::None;
100  QPointer<Output> output;
101 
102  bool operator==(const Mode &m) const;
103  };
104  explicit Output(QObject *parent = nullptr);
105  virtual ~Output();
106 
112  void setup(wl_output *output);
113 
117  bool isValid() const;
118  operator wl_output*();
119  operator wl_output*() const;
120  wl_output *output();
124  QSize physicalSize() const;
128  QPoint globalPosition() const;
132  QString manufacturer() const;
136  QString model() const;
140  QSize pixelSize() const;
147  QRect geometry() const;
151  int refreshRate() const;
159  int scale() const;
163  SubPixel subPixel() const;
171  Transform transform() const;
172 
176  QList<Mode> modes() const;
177 
181  void setEventQueue(EventQueue *queue);
185  EventQueue *eventQueue() const;
186 
191  static Output *get(wl_output *native);
192 
204  void destroy();
205 
206 Q_SIGNALS:
210  void changed();
218  void modeAdded(const KWayland::Client::Output::Mode &mode);
224  void modeChanged(const KWayland::Client::Output::Mode &mode);
225 
234  void removed();
235 
236 private:
237  class Private;
239 };
240 
241 Q_DECLARE_OPERATORS_FOR_FLAGS(Output::Mode::Flags)
242 
243 }
244 }
245 
246 Q_DECLARE_METATYPE(KWayland::Client::Output*)
247 Q_DECLARE_METATYPE(KWayland::Client::Output::SubPixel)
248 Q_DECLARE_METATYPE(KWayland::Client::Output::Transform)
249 Q_DECLARE_METATYPE(KWayland::Client::Output::Mode)
250 
251 #endif
Wrapper class for wl_event_queue interface.
Definition: event_queue.h:55
Wrapper for the wl_output interface.
Definition: output.h:55
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Nov 30 2020 22:50:51 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.