KWayland

surface.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_SURFACE_H
7 #define WAYLAND_SURFACE_H
8 
9 #include "buffer.h"
10 
11 #include <QObject>
12 #include <QPoint>
13 #include <QSize>
14 #include <QWindow>
15 
16 #include <KWayland/Client/kwaylandclient_export.h>
17 
18 struct wl_buffer;
19 struct wl_surface;
20 
21 class QWindow;
22 
23 namespace KWayland
24 {
25 namespace Client
26 {
27 
28 class Output;
29 class Region;
30 
44 class KWAYLANDCLIENT_EXPORT Surface : public QObject
45 {
46  Q_OBJECT
47 public:
48  explicit Surface(QObject *parent = nullptr);
49  virtual ~Surface();
50 
60  static Surface *fromWindow(QWindow *window);
61 
72  static Surface *fromQtWinId(WId wid);
73 
79  void setup(wl_surface *surface);
85  void release();
100  void destroy();
104  bool isValid() const;
118  void setupFrameCallback();
131  enum class CommitFlag {
132  None,
133  FrameCallback
134  };
135  void commit(CommitFlag flag = CommitFlag::FrameCallback);
140  void damage(const QRect &rect);
145  void damage(const QRegion &region);
151  void damageBuffer(const QRect &rect);
157  void damageBuffer(const QRegion &region);
163  void attachBuffer(wl_buffer *buffer, const QPoint &offset = QPoint());
167  void attachBuffer(Buffer *buffer, const QPoint &offset = QPoint());
171  void attachBuffer(Buffer::Ptr buffer, const QPoint &offset = QPoint());
186  void setInputRegion(const Region *region = nullptr);
201  void setOpaqueRegion(const Region *region = nullptr);
202  void setSize(const QSize &size);
203  QSize size() const;
204 
222  void setScale(qint32 scale);
228  qint32 scale() const;
229 
230  operator wl_surface*();
231  operator wl_surface*() const;
232 
237  quint32 id() const;
238 
245  QVector<Output *> outputs() const;
246 
251  static const QList<Surface*> &all(); // krazy:exclude=constref
255  static Surface *get(wl_surface *native);
256 
257 Q_SIGNALS:
265  void frameRendered();
266  void sizeChanged(const QSize&);
267 
277  void outputEntered(KWayland::Client::Output *o);
278 
288  void outputLeft(KWayland::Client::Output *o);
289 
290 private:
291  class Private;
293 };
294 
295 }
296 }
297 
298 #endif
Wrapper class for wl_buffer interface.
Definition: buffer.h:31
CommitFlag
Flags to be added to commit.
Definition: surface.h:131
Wrapper for the wl_output interface.
Definition: output.h:55
Wrapper for the wl_surface interface.
Definition: surface.h:44
Wrapper for the wl_region interface.
Definition: region.h:32
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat Aug 8 2020 22:48:58 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.