KWayland

output_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_OUTPUT_INTERFACE_H
7 #define WAYLAND_SERVER_OUTPUT_INTERFACE_H
8 
9 #include <QObject>
10 #include <QPoint>
11 #include <QSize>
12 
13 #include <KWayland/Server/kwaylandserver_export.h>
14 #include "global.h"
15 
16 struct wl_global;
17 struct wl_client;
18 struct wl_resource;
19 
20 namespace KWayland
21 {
22 namespace Server
23 {
24 
25 class ClientConnection;
26 class Display;
27 
32 class KWAYLANDSERVER_EXPORT OutputInterface : public Global
33 {
34  Q_OBJECT
35  Q_PROPERTY(QSize physicalSize READ physicalSize WRITE setPhysicalSize NOTIFY physicalSizeChanged)
36  Q_PROPERTY(QPoint globalPosition READ globalPosition WRITE setGlobalPosition NOTIFY globalPositionChanged)
37  Q_PROPERTY(QString manufacturer READ manufacturer WRITE setManufacturer NOTIFY manufacturerChanged)
38  Q_PROPERTY(QString model READ model WRITE setModel NOTIFY modelChanged)
39  Q_PROPERTY(QSize pixelSize READ pixelSize NOTIFY pixelSizeChanged)
40  Q_PROPERTY(int refreshRate READ refreshRate NOTIFY refreshRateChanged)
41  Q_PROPERTY(int scale READ scale WRITE setScale NOTIFY scaleChanged)
42 public:
43  enum class SubPixel {
44  Unknown,
45  None,
46  HorizontalRGB,
47  HorizontalBGR,
48  VerticalRGB,
49  VerticalBGR
50  };
51  enum class Transform {
52  Normal,
53  Rotated90,
54  Rotated180,
55  Rotated270,
56  Flipped,
57  Flipped90,
58  Flipped180,
59  Flipped270
60  };
61  enum class ModeFlag {
62  Current = 1,
63  Preferred = 2
64  };
65  Q_DECLARE_FLAGS(ModeFlags, ModeFlag)
66  struct Mode {
67  QSize size = QSize();
68  int refreshRate = 60000;
69  ModeFlags flags;
70  };
71  enum class DpmsMode {
72  On,
73  Standby,
74  Suspend,
75  Off
76  };
77  virtual ~OutputInterface();
78 
79  QSize physicalSize() const;
80  QPoint globalPosition() const;
81  QString manufacturer() const;
82  QString model() const;
83  QSize pixelSize() const;
84  int refreshRate() const;
85  int scale() const;
86  SubPixel subPixel() const;
87  Transform transform() const;
88  QList<Mode> modes() const;
89  bool isDpmsSupported() const;
90  DpmsMode dpmsMode() const;
91 
92  void setPhysicalSize(const QSize &size);
93  void setGlobalPosition(const QPoint &pos);
94  void setManufacturer(const QString &manufacturer);
95  void setModel(const QString &model);
96  void setScale(int scale);
97  void setSubPixel(SubPixel subPixel);
98  void setTransform(Transform transform);
99  void addMode(const QSize &size, ModeFlags flags = ModeFlags(), int refreshRate = 60000);
100  void setCurrentMode(const QSize &size, int refreshRate = 60000);
101 
107  void setDpmsSupported(bool supported);
113  void setDpmsMode(DpmsMode mode);
114 
119  QVector<wl_resource *> clientResources(ClientConnection *client) const;
120 
121  static OutputInterface *get(wl_resource *native);
122 
123 Q_SIGNALS:
124  void physicalSizeChanged(const QSize&);
125  void globalPositionChanged(const QPoint&);
126  void manufacturerChanged(const QString&);
127  void modelChanged(const QString&);
128  void pixelSizeChanged(const QSize&);
129  void refreshRateChanged(int);
130  void scaleChanged(int);
131  void subPixelChanged(SubPixel);
132  void transformChanged(Transform);
133  void modesChanged();
134  void currentModeChanged();
135  void dpmsModeChanged();
136  void dpmsSupportedChanged();
137 
143  void dpmsModeRequested(KWayland::Server::OutputInterface::DpmsMode mode);
144 
145 private:
146  friend class Display;
147  explicit OutputInterface(Display *display, QObject *parent = nullptr);
148  class Private;
149  Private *d_func() const;
150 };
151 
152 }
153 }
154 
155 Q_DECLARE_OPERATORS_FOR_FLAGS(KWayland::Server::OutputInterface::ModeFlags)
156 Q_DECLARE_METATYPE(KWayland::Server::OutputInterface::SubPixel)
157 Q_DECLARE_METATYPE(KWayland::Server::OutputInterface::Transform)
158 Q_DECLARE_METATYPE(KWayland::Server::OutputInterface::DpmsMode)
159 
160 #endif
Global for the wl_output interface.
Class holding the Wayland server display loop.
Definition: display.h:89
Base class for all Globals.
Definition: global.h:46
Convenient Class which represents a wl_client.
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.