diff options
author | Jørgen Lind <jorgen.lind@theqtcompany.com> | 2015-09-03 12:40:19 +0200 |
---|---|---|
committer | Jørgen Lind <jorgen.lind@theqtcompany.com> | 2015-09-04 16:12:47 +0200 |
commit | 4c5a796e96a66c18afbde0577d8b912a618fe710 (patch) | |
tree | e9b3aa53541f67d58dbf1599ae3181ac2cdae2ae /src/compositor/compositor_api/qwaylandoutput.h | |
parent | a814616ff34bf5901fc299c6ba91c80cad39922d (diff) |
Make it possible to construct QWaylandOutput
This requires QWaylandOutput to be initialized. This will happend when
the QWaylandCompositor of the QWaylandOutputSpace that is set on the
QWaylandOutput is created. QWaylandCompositor will send or post a Polish
event to the QWaylandOutput which again will call
QWaylandOutput::initialize. This function will create the global that
will be put on the wl_displays registry
This makes it possible to Create WaylandOutputs in QML (see the pure-qml
example) and also gives a
better programming model in C++
Change-Id: Iaf907ae18a283678eda6d04390dc9790ae0bced8
Diffstat (limited to 'src/compositor/compositor_api/qwaylandoutput.h')
-rw-r--r-- | src/compositor/compositor_api/qwaylandoutput.h | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/src/compositor/compositor_api/qwaylandoutput.h b/src/compositor/compositor_api/qwaylandoutput.h index dcf06c02b..63ef384b7 100644 --- a/src/compositor/compositor_api/qwaylandoutput.h +++ b/src/compositor/compositor_api/qwaylandoutput.h @@ -61,6 +61,8 @@ class Q_COMPOSITOR_EXPORT QWaylandOutput : public QObject, public QWaylandExtens { Q_OBJECT Q_DECLARE_PRIVATE(QWaylandOutput) + Q_PROPERTY(QWindow *window READ window WRITE setWindow NOTIFY windowChanged) + Q_PROPERTY(QWaylandOutputSpace *outputSpace READ outputSpace WRITE setOutputSpace NOTIFY outputSpaceChanged) Q_PROPERTY(QString manufacturer READ manufacturer WRITE setManufacturer NOTIFY manufacturerChanged) Q_PROPERTY(QString model READ model WRITE setModel NOTIFY modelChanged) Q_PROPERTY(QPoint position READ position WRITE setPosition NOTIFY positionChanged) @@ -72,9 +74,7 @@ class Q_COMPOSITOR_EXPORT QWaylandOutput : public QObject, public QWaylandExtens Q_PROPERTY(QWaylandOutput::Transform transform READ transform WRITE setTransform NOTIFY transformChanged) Q_PROPERTY(int scaleFactor READ scaleFactor WRITE setScaleFactor NOTIFY scaleFactorChanged) Q_PROPERTY(QWaylandCompositor *compositor READ compositor CONSTANT) - Q_PROPERTY(QWindow *window READ window CONSTANT) Q_PROPERTY(bool sizeFollowsWindow READ sizeFollowsWindow WRITE setSizeFollowsWindow NOTIFY sizeFollowsWindowChanged) - Q_PROPERTY(QWaylandOutputSpace *outputSpace READ outputSpace WRITE setOutputSpace NOTIFY outputSpaceChanged) Q_ENUMS(Subpixel Transform) public: @@ -104,18 +104,21 @@ public: int refreshRate; }; + QWaylandOutput(); QWaylandOutput(QWaylandOutputSpace *outputSpace, QWindow *window); ~QWaylandOutput(); static QWaylandOutput *fromResource(wl_resource *resource); + //### rename to resourceForClient struct ::wl_resource *outputForClient(QWaylandClient *client) const; QWaylandCompositor *compositor() const; + QWindow *window() const; + void setWindow(QWindow *window); - void setOutputSpace(QWaylandOutputSpace *outputSpace); QWaylandOutputSpace *outputSpace() const; - + void setOutputSpace(QWaylandOutputSpace *outputSpace); QString manufacturer() const; void setManufacturer(const QString &manufacturer); @@ -169,6 +172,8 @@ public: Q_INVOKABLE QPointF mapToOutputSpace(const QPointF &point); Q_SIGNALS: + void outputSpaceChanged(); + void windowChanged(); void positionChanged(); void geometryChanged(); void modeChanged(); @@ -179,13 +184,17 @@ Q_SIGNALS: void transformChanged(); void sizeFollowsWindowChanged(); void physicalSizeFollowsSizeChanged(); - void outputSpaceChanged(); void manufacturerChanged(); void modelChanged(); + void windowDestroyed(); private Q_SLOTS: - void windowDestroyed(); + void handleWindowDestroyed(); + +protected: + bool event(QEvent *event) Q_DECL_OVERRIDE; + virtual void initialize(); }; Q_DECLARE_METATYPE(QWaylandOutput::Mode) |