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  enum class Transform {
71  Normal,
72  Rotated90,
73  Rotated180,
74  Rotated270,
75  Flipped,
76  Flipped90,
77  Flipped180,
78  Flipped270
79  };
80  enum class Enablement {
81  Disabled = 0,
82  Enabled = 1
83  };
84  struct Mode {
85  enum class Flag {
86  None = 0,
87  Current = 1 << 0,
88  Preferred = 1 << 1
89  };
90  Q_DECLARE_FLAGS(Flags, Flag)
94  QSize size;
98  int refreshRate = 0;
103  Flags flags = Flag::None;
107  QPointer<OutputDevice> output;
113  int id;
114 
115  bool operator==(const Mode &m) const;
116  };
117  struct ColorCurves {
118  QVector<quint16> red, green, blue;
119 
120  bool operator==(const ColorCurves &cc) const;
121  bool operator!=(const ColorCurves &cc) const;
122  };
123  explicit OutputDevice(QObject *parent = nullptr);
124  virtual ~OutputDevice();
125 
131  void setup(org_kde_kwin_outputdevice *output);
132 
136  bool isValid() const;
137  operator org_kde_kwin_outputdevice*();
138  operator org_kde_kwin_outputdevice*() const;
139  org_kde_kwin_outputdevice *output();
143  QSize physicalSize() const;
147  QPoint globalPosition() const;
151  QString manufacturer() const;
155  QString model() const;
159  QString serialNumber() const;
163  QString eisaId() const;
167  QSize pixelSize() const;
174  QRect geometry() const;
178  int refreshRate() const;
179 
180 #if KWAYLANDCLIENT_ENABLE_DEPRECATED_SINCE(5, 50)
181 
189  KWAYLANDCLIENT_DEPRECATED_VERSION(5, 50, "Use OutputDevice::scaleF()")
190  int scale() const;
191 #endif
192 
201  qreal scaleF() const;
205  SubPixel subPixel() const;
213  Transform transform() const;
218  ColorCurves colorCurves() const;
219 
223  QList<Mode> modes() const;
224 
225  KWayland::Client::OutputDevice::Mode currentMode() const;
226 
227 
231  void setEventQueue(EventQueue *queue);
235  EventQueue *eventQueue() const;
236 
240  QByteArray edid() const;
241 
245  OutputDevice::Enablement enabled() const;
246 
250  QByteArray uuid() const;
251 
262  void destroy();
263 
264 Q_SIGNALS:
268  void done();
272  void changed();
276  void enabledChanged(OutputDevice::Enablement enabled);
280  void uuidChanged(const QByteArray &uuid);
288  void modeAdded(const KWayland::Client::OutputDevice::Mode &mode);
294  void modeChanged(const KWayland::Client::OutputDevice::Mode &mode);
300  void colorCurvesChanged();
309  void removed();
310 
311 private:
312  class Private;
314 };
315 
316 }
317 }
318 
319 Q_DECLARE_METATYPE(KWayland::Client::OutputDevice::SubPixel)
320 Q_DECLARE_METATYPE(KWayland::Client::OutputDevice::Transform)
321 Q_DECLARE_METATYPE(KWayland::Client::OutputDevice::Enablement)
322 Q_DECLARE_METATYPE(KWayland::Client::OutputDevice::Mode)
323 Q_DECLARE_METATYPE(KWayland::Client::OutputDevice::ColorCurves)
324 Q_DECLARE_OPERATORS_FOR_FLAGS(KWayland::Client::OutputDevice::Mode::Flags)
325 
326 #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-2020 The KDE developers.
Generated on Thu Aug 6 2020 22:49:25 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.