KWayland

outputdevice_interface.h
1 /*
2  SPDX-FileCopyrightText: 2014 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_SERVER_OUTPUTDEVICE_INTERFACE_H
7 #define WAYLAND_SERVER_OUTPUTDEVICE_INTERFACE_H
8 
9 #include <QObject>
10 #include <QPoint>
11 #include <QSize>
12 #include <QVector>
13 
14 #include <KWayland/Server/kwaylandserver_export.h>
15 #include "global.h"
16 
17 struct wl_resource;
18 
19 namespace KWayland
20 {
21 namespace Server
22 {
23 
24 class Display;
25 
34 class KWAYLANDSERVER_EXPORT OutputDeviceInterface : public Global
35 {
36  Q_OBJECT
37  Q_PROPERTY(QSize physicalSize READ physicalSize WRITE setPhysicalSize NOTIFY physicalSizeChanged)
38  Q_PROPERTY(QPoint globalPosition READ globalPosition WRITE setGlobalPosition NOTIFY globalPositionChanged)
39  Q_PROPERTY(QString manufacturer READ manufacturer WRITE setManufacturer NOTIFY manufacturerChanged)
40  Q_PROPERTY(QString model READ model WRITE setModel NOTIFY modelChanged)
41  Q_PROPERTY(QString serialNumber READ serialNumber WRITE setSerialNumber NOTIFY serialNumberChanged)
42  Q_PROPERTY(QString eisaId READ eisaId WRITE setEisaId NOTIFY eisaIdChanged)
43  Q_PROPERTY(QSize pixelSize READ pixelSize NOTIFY pixelSizeChanged)
44  Q_PROPERTY(int refreshRate READ refreshRate NOTIFY refreshRateChanged)
45  Q_PROPERTY(qreal scale READ scaleF WRITE setScaleF NOTIFY scaleFChanged)
46  Q_PROPERTY(QByteArray edid READ edid WRITE setEdid NOTIFY edidChanged)
47  Q_PROPERTY(OutputDeviceInterface::Enablement enabled READ enabled WRITE setEnabled NOTIFY enabledChanged)
48  Q_PROPERTY(QByteArray uuid READ uuid WRITE setUuid NOTIFY uuidChanged)
49 public:
50  enum class SubPixel {
51  Unknown,
52  None,
53  HorizontalRGB,
54  HorizontalBGR,
55  VerticalRGB,
56  VerticalBGR
57  };
58  enum class Transform {
59  Normal,
60  Rotated90,
61  Rotated180,
62  Rotated270,
63  Flipped,
64  Flipped90,
65  Flipped180,
66  Flipped270
67  };
68  enum class Enablement {
69  Disabled = 0,
70  Enabled = 1
71  };
72  enum class ModeFlag {
73  Current = 1,
74  Preferred = 2
75  };
76  Q_DECLARE_FLAGS(ModeFlags, ModeFlag)
77  struct Mode {
78  QSize size = QSize();
79  int refreshRate = 60000;
80  ModeFlags flags;
81  int id = -1;
82  };
83  struct ColorCurves {
84  QVector<quint16> red, green, blue;
85  bool operator==(const ColorCurves &cc) const;
86  bool operator!=(const ColorCurves &cc) const;
87  };
88  virtual ~OutputDeviceInterface();
89 
90  QSize physicalSize() const;
91  QPoint globalPosition() const;
92  QString manufacturer() const;
93  QString model() const;
94  QString serialNumber() const;
95  QString eisaId() const;
96  QSize pixelSize() const;
97  int refreshRate() const;
98 #if KWAYLANDSERVER_ENABLE_DEPRECATED_SINCE(5, 50)
99  KWAYLANDSERVER_DEPRECATED_VERSION(5, 50, "Use OutputDeviceInterface::scaleF()")
101  int scale() const;
102 #endif
103  qreal scaleF() const;
105  SubPixel subPixel() const;
106  Transform transform() const;
107  ColorCurves colorCurves() const;
108  QList<Mode> modes() const;
109  int currentModeId() const;
110 
111  QByteArray edid() const;
112  OutputDeviceInterface::Enablement enabled() const;
113  QByteArray uuid() const;
114 
115  void setPhysicalSize(const QSize &size);
116  void setGlobalPosition(const QPoint &pos);
117  void setManufacturer(const QString &manufacturer);
118  void setModel(const QString &model);
119  void setSerialNumber(const QString &serialNumber);
120  void setEisaId(const QString &eisaId);
121 #if KWAYLANDSERVER_ENABLE_DEPRECATED_SINCE(5, 50)
122  KWAYLANDSERVER_DEPRECATED_VERSION(5, 50, "Use OutputDeviceInterface::setScale(qreal)")
124  void setScale(int scale);
125 #endif
126  void setScaleF(qreal scale);
128  void setSubPixel(SubPixel subPixel);
129  void setTransform(Transform transform);
130  void setColorCurves(const ColorCurves &colorCurves);
131 
138  void addMode(Mode &mode);
139  void setCurrentMode(const int modeId);
140 
141  void setEdid(const QByteArray &edid);
142  void setEnabled(OutputDeviceInterface::Enablement enabled);
143  void setUuid(const QByteArray &uuid);
144 
145  static OutputDeviceInterface *get(wl_resource *native);
146  static QList<OutputDeviceInterface *>list();
147 
148 Q_SIGNALS:
149  void physicalSizeChanged(const QSize&);
150  void globalPositionChanged(const QPoint&);
151  void manufacturerChanged(const QString&);
152  void modelChanged(const QString&);
153  void serialNumberChanged(const QString&);
154  void eisaIdChanged(const QString &);
155  void pixelSizeChanged(const QSize&);
156  void refreshRateChanged(int);
157 #if KWAYLANDSERVER_ENABLE_DEPRECATED_SINCE(5, 50)
158  KWAYLANDSERVER_DEPRECATED_VERSION(5, 50, "Use OutputDeviceInterface::scaleFChanged(qreal)")
160  void scaleChanged(int);
161 #endif
162  void scaleFChanged(qreal);
164  void subPixelChanged(SubPixel);
165  void transformChanged(Transform);
166  void colorCurvesChanged(ColorCurves);
167  void modesChanged();
168  void currentModeChanged();
169 
170  void edidChanged();
171  void enabledChanged();
172  void uuidChanged();
173 
174 private:
175  friend class Display;
176  explicit OutputDeviceInterface(Display *display, QObject *parent = nullptr);
177  class Private;
178  Private *d_func() const;
179 };
180 
181 }
182 }
183 
184 Q_DECLARE_OPERATORS_FOR_FLAGS(KWayland::Server::OutputDeviceInterface::ModeFlags)
185 Q_DECLARE_METATYPE(KWayland::Server::OutputDeviceInterface::Enablement)
186 Q_DECLARE_METATYPE(KWayland::Server::OutputDeviceInterface::SubPixel)
187 Q_DECLARE_METATYPE(KWayland::Server::OutputDeviceInterface::Transform)
188 Q_DECLARE_METATYPE(KWayland::Server::OutputDeviceInterface::ColorCurves)
189 
190 #endif
Class holding the Wayland server display loop.
Definition: display.h:89
Base class for all Globals.
Definition: global.h:46
Represents an output device, the difference to Output is that this output can be disabled, so not currently used to display content.
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Aug 7 2020 22:48:18 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.