summaryrefslogtreecommitdiffstats
path: root/src/compositor/compositor_api/qwaylandquickitem.h
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@theqtcompany.com>2015-08-24 16:51:01 +0200
committerJørgen Lind <jorgen.lind@theqtcompany.com>2015-08-28 13:10:33 +0200
commitd2d70779224b067f6035f431319036054272ce65 (patch)
tree0ea297990553ff75cf82fb840d59dde903903dcd /src/compositor/compositor_api/qwaylandquickitem.h
parent88f821e189bd1d4d4550c1864f622ca7df2a7c34 (diff)
Make the default wl_shell available from QML
This finaly ties together how to use QWaylandQuickItems with different shells It was required to decouple QWaylandView from the QWaylandQuickItem since QML doesn't play to well with muliple inheritance. The QWaylandQuickItem can be retrieved from the QWaylandView which is now conveniently a QObject. Also the QWaylandQuickItem owns the QWaylandView. This architecture also leaves room for creating a QWaylandWidget :) Change-Id: Ib8a00e6f17f0f1bfc3ff244753f021c76db22cb1
Diffstat (limited to 'src/compositor/compositor_api/qwaylandquickitem.h')
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.h38
1 files changed, 13 insertions, 25 deletions
diff --git a/src/compositor/compositor_api/qwaylandquickitem.h b/src/compositor/compositor_api/qwaylandquickitem.h
index 33234cfce..93fa276dc 100644
--- a/src/compositor/compositor_api/qwaylandquickitem.h
+++ b/src/compositor/compositor_api/qwaylandquickitem.h
@@ -55,26 +55,28 @@ class QWaylandSurfaceTextureProvider;
class QMutex;
class QWaylandInputDevice;
-class Q_COMPOSITOR_EXPORT QWaylandQuickItem : public QQuickItem, public QWaylandView
+class Q_COMPOSITOR_EXPORT QWaylandQuickItem : public QQuickItem
{
Q_OBJECT
- Q_PROPERTY(QWaylandQuickSurface* surface READ surface WRITE setSurface NOTIFY surfaceChanged)
+ Q_PROPERTY(QWaylandView *view READ view CONSTANT)
+ Q_PROPERTY(QWaylandCompositor *compositor READ compositor)
+ Q_PROPERTY(QWaylandSurface *surface READ surface WRITE setSurface NOTIFY surfaceChanged)
Q_PROPERTY(bool paintEnabled READ paintEnabled WRITE setPaintEnabled)
Q_PROPERTY(bool touchEventsEnabled READ touchEventsEnabled WRITE setTouchEventsEnabled NOTIFY touchEventsEnabledChanged)
Q_PROPERTY(QWaylandSurface::Origin origin READ origin NOTIFY originChanged)
Q_PROPERTY(bool resizeSurfaceToItem READ resizeSurfaceToItem WRITE setResizeSurfaceToItem NOTIFY resizeSurfaceToItemChanged)
Q_PROPERTY(bool followRequestedPosition READ followRequestedPosition WRITE setFollowRequestedPosition NOTIFY followRequestedPositionChanged)
- Q_PROPERTY(qreal requestedXPosition READ requestedXPosition WRITE setRequestedXPosition NOTIFY requestedXPositionChanged)
- Q_PROPERTY(qreal requestedYPosition READ requestedYPosition WRITE setRequestedYPosition NOTIFY requestedYPositionChanged)
Q_PROPERTY(bool inputEventsEnabled READ inputEventsEnabled WRITE setInputEventsEnabled NOTIFY inputEventsEnabledChanged)
- Q_PROPERTY(bool lockedBuffer READ lockedBuffer WRITE setLockedBuffer NOTIFY lockedBufferChanged)
public:
QWaylandQuickItem(QQuickItem *parent = 0);
~QWaylandQuickItem();
- QWaylandQuickSurface *surface() const;
- void setSurface(QWaylandQuickSurface *surface);
+ QWaylandCompositor *compositor() const;
+ QWaylandView *view() const;
+
+ QWaylandSurface *surface() const;
+ void setSurface(QWaylandSurface *surface);
QWaylandSurface::Origin origin() const;
@@ -91,21 +93,11 @@ public:
bool inputEventsEnabled() const { return m_inputEventsEnabled; }
void setInputEventsEnabled(bool enabled);
- void setRequestedPosition(const QPointF &pos) Q_DECL_OVERRIDE;
- QPointF pos() const Q_DECL_OVERRIDE;
-
bool followRequestedPosition() const;
void setFollowRequestedPosition(bool follow);
- qreal requestedXPosition() const;
- void setRequestedXPosition(qreal xPos);
- qreal requestedYPosition() const;
- void setRequestedYPosition(qreal yPos);
Q_INVOKABLE void syncGraphicsState();
- bool lockedBuffer() const;
- void setLockedBuffer(bool locked);
-
protected:
void mousePressEvent(QMouseEvent *event);
void mouseMoveEvent(QMouseEvent *event);
@@ -121,21 +113,18 @@ protected:
void touchEvent(QTouchEvent *event);
void mouseUngrabEvent() Q_DECL_OVERRIDE;
- void waylandSurfaceChanged(QWaylandSurface *newSurface, QWaylandSurface *oldSurface) Q_DECL_OVERRIDE;
- void waylandSurfaceDestroyed() Q_DECL_OVERRIDE;
-
public Q_SLOTS:
virtual void takeFocus(QWaylandInputDevice *device = 0);
void setPaintEnabled(bool paintEnabled);
private Q_SLOTS:
void surfaceMappedChanged();
+ void handleSurfaceChanged();
void parentChanged(QWaylandSurface *newParent, QWaylandSurface *oldParent);
void updateSize();
void updateBuffer(bool hasBuffer);
void updateWindow();
void beforeSync();
- void outputHasChanged();
Q_SIGNALS:
void surfaceChanged();
@@ -144,10 +133,7 @@ Q_SIGNALS:
void resizeSurfaceToItemChanged();
void surfaceDestroyed();
void followRequestedPositionChanged();
- void requestedXPositionChanged();
- void requestedYPositionChanged();
void inputEventsEnabledChanged();
- void lockedBufferChanged();
protected:
QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *);
@@ -155,10 +141,12 @@ protected:
private:
friend class QWaylandSurfaceNode;
friend class QWaylandQuickSurface;
- bool shouldSendInputEvents() const { return surface() && m_inputEventsEnabled; }
+ bool shouldSendInputEvents() const { return m_view->surface() && m_inputEventsEnabled; }
static QMutex *mutex;
+ QScopedPointer<QWaylandView> m_view;
+ QWaylandSurface *m_oldSurface;
mutable QWaylandSurfaceTextureProvider *m_provider;
bool m_paintEnabled;
bool m_touchEventsEnabled;