KWayland

outputdevice.h
1 /*
2  SPDX-FileCopyrightText: 2013 Martin Gräßlin <[email protected]>
3  SPDX-FileCopyrightText: 2018 Roman Gilg <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
6 */
7 #ifndef WAYLAND_OUTPUTDEVICE_H
8 #define WAYLAND_OUTPUTDEVICE_H
9 
10 #include <QObject>
11 #include <QPointer>
12 #include <QSize>
13 #include <QVector>
14 
15 #include <KWayland/Client/kwaylandclient_export.h>
16 
17 struct org_kde_kwin_outputdevice;
18 class QPoint;
19 class QRect;
20 
21 namespace KWayland
22 {
23 namespace Client
24 {
25 
26 class EventQueue;
27 
58 class KWAYLANDCLIENT_EXPORT OutputDevice : public QObject
59 {
60  Q_OBJECT
61 public:
62  enum class SubPixel {
63  Unknown,
64  None,
65  HorizontalRGB,
66  HorizontalBGR,
67  VerticalRGB,
68  VerticalBGR
69  };
70  Q_ENUM(SubPixel)
71  enum class Transform {
72  Normal,
73  Rotated90,
74  Rotated180,
75  Rotated270,
76  Flipped,
77  Flipped90,
78  Flipped180,
79  Flipped270
80  };
81  Q_ENUM(Transform)
82  enum class Enablement {
83  Disabled = 0,
84  Enabled = 1
85  };
86  Q_ENUM(Enablement)
87  struct Mode {
88  enum class Flag {
89  None = 0,
90  Current = 1 << 0,
91  Preferred = 1 << 1
92  };
93  Q_DECLARE_FLAGS(Flags, Flag)
97  QSize size;
101  int refreshRate = 0;
106  Flags flags = Flag::None;
110  QPointer<OutputDevice> output;
116  int id;
117 
118  bool operator==(const Mode &m) const;
119  };
120  struct ColorCurves {
121  QVector<quint16> red, green, blue;
122 
123  bool operator==(const ColorCurves &cc) const;
124  bool operator!=(const ColorCurves &cc) const;
125  };
126  explicit OutputDevice(QObject *parent = nullptr);
127  virtual ~OutputDevice();
128 
134  void setup(org_kde_kwin_outputdevice *output);
135 
139  bool isValid() const;
140  operator org_kde_kwin_outputdevice*();
141  operator org_kde_kwin_outputdevice*() const;
142  org_kde_kwin_outputdevice *output();
146  QSize physicalSize() const;
150  QPoint globalPosition() const;
154  QString manufacturer() const;
158  QString model() const;
162  QString serialNumber() const;
166  QString eisaId() const;
170  QSize pixelSize() const;
177  QRect geometry() const;
181  int refreshRate() const;
182 
183 #if KWAYLANDCLIENT_ENABLE_DEPRECATED_SINCE(5, 50)
184 
192  KWAYLANDCLIENT_DEPRECATED_VERSION(5, 50, "Use OutputDevice::scaleF()")
193  int scale() const;
194 #endif
195 
204  qreal scaleF() const;
208  SubPixel subPixel() const;
216  Transform transform() const;
221  ColorCurves colorCurves() const;
222 
226  QList<Mode> modes() const;
227 
228  KWayland::Client::OutputDevice::Mode currentMode() const;
229 
230 
234  void setEventQueue(EventQueue *queue);
238  EventQueue *eventQueue() const;
239 
243  QByteArray edid() const;
244 
248  OutputDevice::Enablement enabled() const;
249 
253  QByteArray uuid() const;
254 
265  void destroy();
266 
267 Q_SIGNALS:
271  void done();
275  void changed();
279  void enabledChanged(OutputDevice::Enablement enabled);
283  void uuidChanged(const QByteArray &uuid);
291  void modeAdded(const KWayland::Client::OutputDevice::Mode &mode);
297  void modeChanged(const KWayland::Client::OutputDevice::Mode &mode);
303  void colorCurvesChanged();
312  void removed();
313 
314 private:
315  class Private;
317 };
318 
319 Q_DECLARE_OPERATORS_FOR_FLAGS(OutputDevice::Mode::Flags)
320 
321 }
322 }
323 
324 Q_DECLARE_METATYPE(KWayland::Client::OutputDevice::SubPixel)
325 Q_DECLARE_METATYPE(KWayland::Client::OutputDevice::Transform)
326 Q_DECLARE_METATYPE(KWayland::Client::OutputDevice::Enablement)
327 Q_DECLARE_METATYPE(KWayland::Client::OutputDevice::Mode)
328 Q_DECLARE_METATYPE(KWayland::Client::OutputDevice::ColorCurves)
329 
330 #endif
Wrapper class for wl_event_queue interface.
Definition: event_queue.h:55
Wrapper for the org_kde_kwin_outputdevice interface.
Definition: outputdevice.h:58
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sat Jan 23 2021 03:00:31 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.