1 | // Copyright (C) 2017 Jolla Ltd, author: <giulio.camuffo@jollamobile.com> |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
3 | |
4 | #ifndef QWAYLANDSURFACEVIEW_H |
5 | #define QWAYLANDSURFACEVIEW_H |
6 | |
7 | #include <QtWaylandCompositor/QWaylandBufferRef> |
8 | #include <QtWaylandCompositor/qtwaylandcompositorglobal.h> |
9 | |
10 | #include <QtCore/QPointF> |
11 | #include <QtCore/QObject> |
12 | |
13 | QT_BEGIN_NAMESPACE |
14 | |
15 | class QWaylandSurface; |
16 | class QWaylandViewPrivate; |
17 | class QWaylandOutput; |
18 | |
19 | class Q_WAYLANDCOMPOSITOR_EXPORT QWaylandView : public QObject |
20 | { |
21 | Q_OBJECT |
22 | Q_DECLARE_PRIVATE(QWaylandView) |
23 | Q_PROPERTY(QObject *renderObject READ renderObject CONSTANT) |
24 | Q_PROPERTY(QWaylandSurface *surface READ surface WRITE setSurface NOTIFY surfaceChanged) |
25 | Q_PROPERTY(QWaylandOutput *output READ output WRITE setOutput NOTIFY outputChanged) |
26 | Q_PROPERTY(bool bufferLocked READ isBufferLocked WRITE setBufferLocked NOTIFY bufferLockedChanged) |
27 | Q_PROPERTY(bool allowDiscardFrontBuffer READ allowDiscardFrontBuffer WRITE setAllowDiscardFrontBuffer NOTIFY allowDiscardFrontBufferChanged) |
28 | Q_MOC_INCLUDE("qwaylandoutput.h" ) |
29 | public: |
30 | QWaylandView(QObject *renderObject = nullptr, QObject *parent = nullptr); |
31 | ~QWaylandView() override; |
32 | |
33 | QObject *renderObject() const; |
34 | |
35 | QWaylandSurface *surface() const; |
36 | void setSurface(QWaylandSurface *surface); |
37 | |
38 | QWaylandOutput *output() const; |
39 | void setOutput(QWaylandOutput *output); |
40 | |
41 | virtual void bufferCommitted(const QWaylandBufferRef &buffer, const QRegion &damage); |
42 | virtual bool advance(); |
43 | virtual void discardCurrentBuffer(); |
44 | virtual QWaylandBufferRef currentBuffer(); |
45 | virtual QRegion currentDamage(); |
46 | |
47 | bool isBufferLocked() const; |
48 | void setBufferLocked(bool locked); |
49 | |
50 | bool allowDiscardFrontBuffer() const; |
51 | void setAllowDiscardFrontBuffer(bool discard); |
52 | |
53 | void setPrimary(); |
54 | bool isPrimary() const; |
55 | |
56 | struct wl_resource *surfaceResource() const; |
57 | |
58 | Q_SIGNALS: |
59 | void surfaceChanged(); |
60 | void surfaceDestroyed(); |
61 | void outputChanged(); |
62 | void bufferLockedChanged(); |
63 | void allowDiscardFrontBufferChanged(); |
64 | }; |
65 | |
66 | QT_END_NAMESPACE |
67 | |
68 | #endif |
69 | |