summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@theqtcompany.com>2015-07-29 14:38:18 +0200
committerJørgen Lind <jorgen.lind@theqtcompany.com>2015-08-28 13:09:41 +0200
commit0a7ae4374e9b3c0128388e5b68075f6f06347c71 (patch)
tree639304bdf32aaf4a42521c989c338ed407d97a53
parent42d052afccd9a968bc9897a84866f25b80ec2646 (diff)
Make it possible to set a QWaylandSurface on the QWaylandSurfaceView
This will allow us to use QWaylandSurfaceItem from within QML Change-Id: I6ecfbf3a5de5f5a748a6a85295b9741316fef976
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor.cpp12
-rw-r--r--src/compositor/compositor_api/qwaylandcompositor.h3
-rw-r--r--src/compositor/compositor_api/qwaylandquickcompositor.cpp10
-rw-r--r--src/compositor/compositor_api/qwaylandquickcompositor.h2
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.cpp34
-rw-r--r--src/compositor/compositor_api/qwaylandsurface.h2
-rw-r--r--src/compositor/compositor_api/qwaylandsurface_p.h3
-rw-r--r--src/compositor/compositor_api/qwaylandsurfaceitem.cpp61
-rw-r--r--src/compositor/compositor_api/qwaylandsurfaceitem.h12
-rw-r--r--src/compositor/compositor_api/qwaylandsurfaceview.cpp32
-rw-r--r--src/compositor/compositor_api/qwaylandsurfaceview.h7
-rw-r--r--src/compositor/wayland_wrapper/qwldatadevice.cpp2
-rw-r--r--src/compositor/wayland_wrapper/qwlshellsurface.cpp2
-rw-r--r--src/compositor/wayland_wrapper/qwlsurface.cpp1
-rw-r--r--src/compositor/wayland_wrapper/qwlsurface_p.h2
-rw-r--r--src/imports/compositor/WaylandCursorItem.qml66
-rw-r--r--src/imports/compositor/qwaylandquickcompositorplugin.cpp2
17 files changed, 210 insertions, 43 deletions
diff --git a/src/compositor/compositor_api/qwaylandcompositor.cpp b/src/compositor/compositor_api/qwaylandcompositor.cpp
index 906287a1c..a94abffcf 100644
--- a/src/compositor/compositor_api/qwaylandcompositor.cpp
+++ b/src/compositor/compositor_api/qwaylandcompositor.cpp
@@ -202,6 +202,11 @@ void QWaylandCompositor::cleanupGraphicsResources()
m_compositor->cleanupGraphicsResources();
}
+QWaylandSurfaceView *QWaylandCompositor::createView()
+{
+ return new QWaylandSurfaceView();
+}
+
QWaylandSurfaceView *QWaylandCompositor::pickView(const QPointF &globalPosition) const
{
Q_FOREACH (QWaylandOutput *output, outputs()) {
@@ -370,9 +375,12 @@ void QWaylandCompositor::configureTouchExtension(TouchExtensionFlags flags)
m_compositor->configureTouchExtension(flags);
}
-QWaylandSurfaceView *QWaylandCompositor::createView(QWaylandSurface *surface)
+
+QWaylandSurfaceView *QWaylandCompositor::createSurfaceView(QWaylandSurface *surface)
{
- return new QWaylandSurfaceView(surface);
+ QWaylandSurfaceView *view = createView();
+ view->setSurface(surface);
+ return view;
}
QWaylandInputDevice *QWaylandCompositor::inputDeviceFor(QInputEvent *inputEvent)
diff --git a/src/compositor/compositor_api/qwaylandcompositor.h b/src/compositor/compositor_api/qwaylandcompositor.h
index fc96da35e..a203fa265 100644
--- a/src/compositor/compositor_api/qwaylandcompositor.h
+++ b/src/compositor/compositor_api/qwaylandcompositor.h
@@ -166,7 +166,7 @@ public:
Q_DECLARE_FLAGS(TouchExtensionFlags, TouchExtensionFlag)
void configureTouchExtension(TouchExtensionFlags flags);
- virtual QWaylandSurfaceView *createView(QWaylandSurface *surface);
+ QWaylandSurfaceView *createSurfaceView(QWaylandSurface *surface);
QWaylandInputDevice *inputDeviceFor(QInputEvent *inputEvent);
@@ -185,6 +185,7 @@ protected:
const QString &manufacturer,
const QString &model);
virtual QWaylandSurface *createSurface(QWaylandClient *client, quint32 id, int version);
+ virtual QWaylandSurfaceView *createView();
friend class QtWayland::Compositor;
QtWayland::Compositor *m_compositor;
diff --git a/src/compositor/compositor_api/qwaylandquickcompositor.cpp b/src/compositor/compositor_api/qwaylandquickcompositor.cpp
index 977b8a4a5..15923659d 100644
--- a/src/compositor/compositor_api/qwaylandquickcompositor.cpp
+++ b/src/compositor/compositor_api/qwaylandquickcompositor.cpp
@@ -97,11 +97,6 @@ void QWaylandQuickCompositor::setExposeDefaultShell(bool defaultShell)
m_exposeDefaultShell = defaultShell;
}
-QWaylandSurfaceView *QWaylandQuickCompositor::createView(QWaylandSurface *surf)
-{
- return new QWaylandSurfaceItem(static_cast<QWaylandQuickSurface *>(surf));
-}
-
QWaylandOutput *QWaylandQuickCompositor::createOutput(QWindow *window,
const QString &manufacturer,
const QString &model)
@@ -113,6 +108,11 @@ QWaylandOutput *QWaylandQuickCompositor::createOutput(QWindow *window,
return new QWaylandQuickOutput(this, quickWindow, manufacturer, model);
}
+QWaylandSurfaceView *QWaylandQuickCompositor::createView()
+{
+ return new QWaylandSurfaceItem();
+}
+
QWaylandSurface *QWaylandQuickCompositor::createSurface(QWaylandClient *client, quint32 id, int version)
{
return new QWaylandQuickSurface(client->client(), id, version, this);
diff --git a/src/compositor/compositor_api/qwaylandquickcompositor.h b/src/compositor/compositor_api/qwaylandquickcompositor.h
index b84587931..de4b2f2b7 100644
--- a/src/compositor/compositor_api/qwaylandquickcompositor.h
+++ b/src/compositor/compositor_api/qwaylandquickcompositor.h
@@ -59,10 +59,10 @@ public:
bool exposeDefaultShell() const;
void setExposeDefaultShell(bool defaultShell);
- QWaylandSurfaceView *createView(QWaylandSurface *surf) Q_DECL_OVERRIDE;
QWaylandOutput *createOutput(QWindow *window,
const QString &manufacturer,
const QString &model) Q_DECL_OVERRIDE;
+ QWaylandSurfaceView *createView() Q_DECL_OVERRIDE;
QWaylandSurface *createSurface(QWaylandClient *client, quint32 id, int version) Q_DECL_OVERRIDE;
protected:
diff --git a/src/compositor/compositor_api/qwaylandsurface.cpp b/src/compositor/compositor_api/qwaylandsurface.cpp
index 393b0138b..bec39a184 100644
--- a/src/compositor/compositor_api/qwaylandsurface.cpp
+++ b/src/compositor/compositor_api/qwaylandsurface.cpp
@@ -412,9 +412,7 @@ bool QWaylandSurface::inputRegionContains(const QPoint &p) const
void QWaylandSurface::destroy()
{
- Q_D(QWaylandSurface);
- if (--d->refCount == 0)
- compositor()->handle()->destroySurface(d);
+ deref();
}
void QWaylandSurface::destroySurface()
@@ -448,6 +446,13 @@ void QWaylandSurface::ref()
++d->refCount;
}
+void QWaylandSurface::deref()
+{
+ Q_D(QWaylandSurface);
+ if (--d->refCount == 0)
+ compositor()->handle()->destroySurface(d);
+}
+
void QWaylandSurface::setMapped(bool mapped)
{
Q_D(QWaylandSurface);
@@ -486,6 +491,11 @@ QWaylandSurface *QWaylandSurface::fromResource(::wl_resource *res)
return Q_NULLPTR;
}
+QWaylandSurfacePrivate *QWaylandSurfacePrivate::get(QWaylandSurface *surface)
+{
+ return surface ? surface->d_func() : Q_NULLPTR;
+}
+
void QWaylandSurfacePrivate::setTitle(const QString &title)
{
Q_Q(QWaylandSurface);
@@ -513,6 +523,24 @@ void QWaylandSurfacePrivate::setType(QWaylandSurface::WindowType type)
}
}
+void QWaylandSurfacePrivate::refView(QWaylandSurfaceView *view)
+{
+ if (views.contains(view))
+ return;
+
+ views.append(view);
+ waylandSurface()->ref();
+}
+
+void QWaylandSurfacePrivate::derefView(QWaylandSurfaceView *view)
+{
+ int nViews = views.removeAll(view);
+
+ for (int i = 0; i < nViews && refCount > 0; i++) {
+ waylandSurface()->deref();
+ }
+}
+
class QWaylandUnmapLockPrivate
{
public:
diff --git a/src/compositor/compositor_api/qwaylandsurface.h b/src/compositor/compositor_api/qwaylandsurface.h
index f3346446e..a8ce58495 100644
--- a/src/compositor/compositor_api/qwaylandsurface.h
+++ b/src/compositor/compositor_api/qwaylandsurface.h
@@ -214,6 +214,7 @@ public:
Q_INVOKABLE void ping();
void ref();
+ void deref();
void setMapped(bool mapped);
void setBufferAttacher(QWaylandBufferAttacher *attacher);
@@ -261,7 +262,6 @@ Q_SIGNALS:
void configure(bool hasBuffer);
void redraw();
- friend class QWaylandSurfaceView;
friend class QWaylandSurfaceInterface;
friend class QtWayland::Surface;
};
diff --git a/src/compositor/compositor_api/qwaylandsurface_p.h b/src/compositor/compositor_api/qwaylandsurface_p.h
index 9edd9de73..bef6a49e0 100644
--- a/src/compositor/compositor_api/qwaylandsurface_p.h
+++ b/src/compositor/compositor_api/qwaylandsurface_p.h
@@ -54,10 +54,13 @@ class Q_COMPOSITOR_EXPORT QWaylandSurfacePrivate : public QObjectPrivate, public
{
Q_DECLARE_PUBLIC(QWaylandSurface)
public:
+ static QWaylandSurfacePrivate *get(QWaylandSurface *surface);
QWaylandSurfacePrivate(wl_client *wlClient, quint32 id, int version, QWaylandCompositor *compositor, QWaylandSurface *surface);
void setType(QWaylandSurface::WindowType type);
void setTitle(const QString &title);
void setClassName(const QString &className);
+ void refView(QWaylandSurfaceView *view);
+ void derefView(QWaylandSurfaceView *view);
bool closing;
int refCount;
diff --git a/src/compositor/compositor_api/qwaylandsurfaceitem.cpp b/src/compositor/compositor_api/qwaylandsurfaceitem.cpp
index 5ace77dbc..b6434ad8b 100644
--- a/src/compositor/compositor_api/qwaylandsurfaceitem.cpp
+++ b/src/compositor/compositor_api/qwaylandsurfaceitem.cpp
@@ -69,12 +69,13 @@ public:
QSGTexture *t;
};
-QWaylandSurfaceItem::QWaylandSurfaceItem(QWaylandQuickSurface *surface, QQuickItem *parent)
+QWaylandSurfaceItem::QWaylandSurfaceItem(QQuickItem *parent)
: QQuickItem(parent)
- , QWaylandSurfaceView(surface)
+ , QWaylandSurfaceView()
, m_provider(0)
, m_paintEnabled(true)
, m_touchEventsEnabled(false)
+ , m_yInverted(false)
, m_resizeSurfaceToItem(false)
, m_newTexture(false)
, m_followRequestedPos(true)
@@ -86,11 +87,6 @@ QWaylandSurfaceItem::QWaylandSurfaceItem(QWaylandQuickSurface *surface, QQuickIt
update();
- if (surface) {
- setWidth(surface->size().width());
- setHeight(surface->size().height());
- }
-
setSmooth(true);
setAcceptedMouseButtons(Qt::LeftButton | Qt::MiddleButton | Qt::RightButton |
@@ -99,20 +95,11 @@ QWaylandSurfaceItem::QWaylandSurfaceItem(QWaylandQuickSurface *surface, QQuickIt
Qt::ExtraButton9 | Qt::ExtraButton10 | Qt::ExtraButton11 |
Qt::ExtraButton12 | Qt::ExtraButton13);
setAcceptHoverEvents(true);
- if (surface) {
- connect(surface, &QWaylandSurface::mapped, this, &QWaylandSurfaceItem::surfaceMapped);
- connect(surface, &QWaylandSurface::unmapped, this, &QWaylandSurfaceItem::surfaceUnmapped);
- connect(surface, &QWaylandSurface::surfaceDestroyed, this, &QWaylandSurfaceItem::surfaceDestroyed);
- connect(surface, &QWaylandSurface::parentChanged, this, &QWaylandSurfaceItem::parentChanged);
- connect(surface, &QWaylandSurface::sizeChanged, this, &QWaylandSurfaceItem::updateSize);
- connect(surface, &QWaylandSurface::configure, this, &QWaylandSurfaceItem::updateBuffer);
- connect(surface, &QWaylandSurface::redraw, this, &QQuickItem::update);
- }
+
connect(this, &QWaylandSurfaceItem::widthChanged, this, &QWaylandSurfaceItem::updateSurfaceSize);
connect(this, &QWaylandSurfaceItem::heightChanged, this, &QWaylandSurfaceItem::updateSurfaceSize);
- m_yInverted = surface ? surface->isYInverted() : true;
emit yInvertedChanged();
}
@@ -123,6 +110,16 @@ QWaylandSurfaceItem::~QWaylandSurfaceItem()
m_provider->deleteLater();
}
+QWaylandQuickSurface *QWaylandSurfaceItem::surface() const
+{
+ return static_cast<QWaylandQuickSurface *>(QWaylandSurfaceView::surface());
+}
+
+void QWaylandSurfaceItem::setSurface(QWaylandQuickSurface *surface)
+{
+ QWaylandSurfaceView::setSurface(surface);
+}
+
bool QWaylandSurfaceItem::isYInverted() const
{
return m_yInverted;
@@ -259,6 +256,36 @@ void QWaylandSurfaceItem::mouseUngrabEvent()
}
}
+void QWaylandSurfaceItem::waylandSurfaceChanged(QWaylandSurface *newSurface, QWaylandSurface *oldSurface)
+{
+ if (oldSurface) {
+ disconnect(oldSurface, &QWaylandSurface::mapped, this, &QWaylandSurfaceItem::surfaceMapped);
+ disconnect(oldSurface, &QWaylandSurface::unmapped, this, &QWaylandSurfaceItem::surfaceUnmapped);
+ disconnect(oldSurface, &QWaylandSurface::surfaceDestroyed, this, &QWaylandSurfaceItem::surfaceDestroyed);
+ disconnect(oldSurface, &QWaylandSurface::parentChanged, this, &QWaylandSurfaceItem::parentChanged);
+ disconnect(oldSurface, &QWaylandSurface::sizeChanged, this, &QWaylandSurfaceItem::updateSize);
+ disconnect(oldSurface, &QWaylandSurface::configure, this, &QWaylandSurfaceItem::updateBuffer);
+ disconnect(oldSurface, &QWaylandSurface::redraw, this, &QQuickItem::update);
+ }
+ if (newSurface) {
+ connect(newSurface, &QWaylandSurface::mapped, this, &QWaylandSurfaceItem::surfaceMapped);
+ connect(newSurface, &QWaylandSurface::unmapped, this, &QWaylandSurfaceItem::surfaceUnmapped);
+ connect(newSurface, &QWaylandSurface::surfaceDestroyed, this, &QWaylandSurfaceItem::surfaceDestroyed);
+ connect(newSurface, &QWaylandSurface::parentChanged, this, &QWaylandSurfaceItem::parentChanged);
+ connect(newSurface, &QWaylandSurface::sizeChanged, this, &QWaylandSurfaceItem::updateSize);
+ connect(newSurface, &QWaylandSurface::configure, this, &QWaylandSurfaceItem::updateBuffer);
+ connect(newSurface, &QWaylandSurface::redraw, this, &QQuickItem::update);
+ setWidth(surface()->size().width());
+ setHeight(surface()->size().height());
+ if (newSurface->isYInverted() != m_yInverted) {
+ m_yInverted = newSurface->isYInverted();
+ emit yInvertedChanged();
+ }
+ }
+
+ emit surfaceChanged();
+}
+
void QWaylandSurfaceItem::takeFocus(QWaylandInputDevice *device)
{
setFocus(true);
diff --git a/src/compositor/compositor_api/qwaylandsurfaceitem.h b/src/compositor/compositor_api/qwaylandsurfaceitem.h
index ab4889e68..c2a73de18 100644
--- a/src/compositor/compositor_api/qwaylandsurfaceitem.h
+++ b/src/compositor/compositor_api/qwaylandsurfaceitem.h
@@ -58,7 +58,7 @@ class QWaylandInputDevice;
class Q_COMPOSITOR_EXPORT QWaylandSurfaceItem : public QQuickItem, public QWaylandSurfaceView
{
Q_OBJECT
- Q_PROPERTY(QWaylandSurface* surface READ surface CONSTANT)
+ Q_PROPERTY(QWaylandQuickSurface* 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(bool isYInverted READ isYInverted NOTIFY yInvertedChanged)
@@ -68,10 +68,13 @@ class Q_COMPOSITOR_EXPORT QWaylandSurfaceItem : public QQuickItem, public QWayla
Q_PROPERTY(qreal requestedYPosition READ requestedYPosition WRITE setRequestedYPosition NOTIFY requestedYPositionChanged)
public:
- QWaylandSurfaceItem(QWaylandQuickSurface *surface, QQuickItem *parent = 0);
+ QWaylandSurfaceItem(QQuickItem *parent = 0);
~QWaylandSurfaceItem();
- Q_INVOKABLE bool isYInverted() const;
+ QWaylandQuickSurface *surface() const;
+ void setSurface(QWaylandQuickSurface *surface);
+
+ bool isYInverted() const;
bool isTextureProvider() const { return true; }
QSGTextureProvider *textureProvider() const;
@@ -108,6 +111,8 @@ protected:
void touchEvent(QTouchEvent *event);
void mouseUngrabEvent() Q_DECL_OVERRIDE;
+ void waylandSurfaceChanged(QWaylandSurface *newSurface, QWaylandSurface *oldSurface) Q_DECL_OVERRIDE;
+
public Q_SLOTS:
virtual void takeFocus(QWaylandInputDevice *device = 0);
void setPaintEnabled(bool paintEnabled);
@@ -121,6 +126,7 @@ private Q_SLOTS:
void updateBuffer(bool hasBuffer);
Q_SIGNALS:
+ void surfaceChanged();
void touchEventsEnabledChanged();
void yInvertedChanged();
void resizeSurfaceToItemChanged();
diff --git a/src/compositor/compositor_api/qwaylandsurfaceview.cpp b/src/compositor/compositor_api/qwaylandsurfaceview.cpp
index 1c63fb2c4..88bd61fea 100644
--- a/src/compositor/compositor_api/qwaylandsurfaceview.cpp
+++ b/src/compositor/compositor_api/qwaylandsurfaceview.cpp
@@ -45,18 +45,16 @@ QT_BEGIN_NAMESPACE
class QWaylandSurfaceViewPrivate
{
public:
+ QWaylandSurfaceViewPrivate()
+ : surface(Q_NULLPTR)
+ { }
QWaylandSurface *surface;
QPointF requestedPos;
};
-QWaylandSurfaceView::QWaylandSurfaceView(QWaylandSurface *surf)
+QWaylandSurfaceView::QWaylandSurfaceView()
: d(new QWaylandSurfaceViewPrivate)
{
- d->surface = surf;
- if (surf) {
- surf->d_func()->views << this;
- surf->ref();
- }
}
QWaylandSurfaceView::~QWaylandSurfaceView()
@@ -68,7 +66,9 @@ QWaylandSurfaceView::~QWaylandSurfaceView()
d->surface->destroy();
d->surface->d_func()->views.removeOne(this);
+ d->surface->deref();
}
+
delete d;
}
@@ -77,6 +77,20 @@ QWaylandSurface *QWaylandSurfaceView::surface() const
return d->surface;
}
+void QWaylandSurfaceView::setSurface(QWaylandSurface *newSurface)
+{
+ QWaylandSurface *oldSurface = d->surface;
+ d->surface = newSurface;
+
+ if (oldSurface)
+ QWaylandSurfacePrivate::get(oldSurface)->derefView(this);
+
+ if (newSurface)
+ QWaylandSurfacePrivate::get(newSurface)->refView(this);
+
+ waylandSurfaceChanged(newSurface, oldSurface);
+}
+
QWaylandCompositor *QWaylandSurfaceView::compositor() const
{
return d->surface ? d->surface->compositor() : 0;
@@ -97,4 +111,10 @@ QPointF QWaylandSurfaceView::pos() const
return d->requestedPos;
}
+void QWaylandSurfaceView::waylandSurfaceChanged(QWaylandSurface *newSurface, QWaylandSurface *oldSurface)
+{
+ Q_UNUSED(newSurface);
+ Q_UNUSED(oldSurface);
+}
+
QT_END_NAMESPACE
diff --git a/src/compositor/compositor_api/qwaylandsurfaceview.h b/src/compositor/compositor_api/qwaylandsurfaceview.h
index 277ecbc84..1685abfbb 100644
--- a/src/compositor/compositor_api/qwaylandsurfaceview.h
+++ b/src/compositor/compositor_api/qwaylandsurfaceview.h
@@ -49,16 +49,21 @@ class QWaylandCompositor;
class Q_COMPOSITOR_EXPORT QWaylandSurfaceView
{
public:
- QWaylandSurfaceView(QWaylandSurface *surface);
+ QWaylandSurfaceView();
virtual ~QWaylandSurfaceView();
QWaylandCompositor *compositor() const;
+
QWaylandSurface *surface() const;
+ void setSurface(QWaylandSurface *surface);
virtual void setRequestedPosition(const QPointF &pos);
virtual QPointF requestedPosition() const;
virtual QPointF pos() const;
+protected:
+ virtual void waylandSurfaceChanged(QWaylandSurface *newSurface, QWaylandSurface *oldSurface);
+
private:
class QWaylandSurfaceViewPrivate *const d;
friend class QWaylandSurfaceViewPrivate;
diff --git a/src/compositor/wayland_wrapper/qwldatadevice.cpp b/src/compositor/wayland_wrapper/qwldatadevice.cpp
index 2e694ca27..73a93a8c8 100644
--- a/src/compositor/wayland_wrapper/qwldatadevice.cpp
+++ b/src/compositor/wayland_wrapper/qwldatadevice.cpp
@@ -182,7 +182,7 @@ void DataDevice::data_device_start_drag(Resource *resource, struct ::wl_resource
m_dragClient = resource->client();
m_dragDataSource = source != 0 ? DataSource::fromResource(source) : 0;
- m_dragIcon = icon != 0 ? m_compositor->waylandCompositor()->createView(Surface::fromResource(icon)->waylandSurface()) : 0;
+ m_dragIcon = icon != 0 ? m_compositor->waylandCompositor()->createSurfaceView(Surface::fromResource(icon)->waylandSurface()) : 0;
Q_EMIT m_inputDevice->dragHandle()->iconChanged();
m_inputDevice->pointerDevice()->setFocus(0, QPointF());
diff --git a/src/compositor/wayland_wrapper/qwlshellsurface.cpp b/src/compositor/wayland_wrapper/qwlshellsurface.cpp
index efa211013..bc75ab4c3 100644
--- a/src/compositor/wayland_wrapper/qwlshellsurface.cpp
+++ b/src/compositor/wayland_wrapper/qwlshellsurface.cpp
@@ -95,7 +95,7 @@ ShellSurface::ShellSurface(Shell *shell, wl_client *client, uint32_t id, Surface
, m_popupGrabber(0)
, m_popupSerial()
{
- m_view = surface->compositor()->waylandCompositor()->createView(surface->waylandSurface());
+ m_view = surface->compositor()->waylandCompositor()->createSurfaceView(surface->waylandSurface());
connect(surface->waylandSurface(), &QWaylandSurface::configure, this, &ShellSurface::configure);
connect(surface->waylandSurface(), &QWaylandSurface::mapped, this, &ShellSurface::mapped);
connect(surface->waylandSurface(), &QWaylandSurface::offsetForNextFrame, this, &ShellSurface::adjustOffset);
diff --git a/src/compositor/wayland_wrapper/qwlsurface.cpp b/src/compositor/wayland_wrapper/qwlsurface.cpp
index 03edbc1dc..d8f80b0f4 100644
--- a/src/compositor/wayland_wrapper/qwlsurface.cpp
+++ b/src/compositor/wayland_wrapper/qwlsurface.cpp
@@ -453,6 +453,7 @@ Qt::ScreenOrientation Surface::contentOrientation() const
return m_contentOrientation;
}
+
void Surface::surface_destroy_resource(Resource *)
{
if (m_extendedSurface) {
diff --git a/src/compositor/wayland_wrapper/qwlsurface_p.h b/src/compositor/wayland_wrapper/qwlsurface_p.h
index af1770a4e..32c6ecf66 100644
--- a/src/compositor/wayland_wrapper/qwlsurface_p.h
+++ b/src/compositor/wayland_wrapper/qwlsurface_p.h
@@ -234,6 +234,8 @@ protected:
void setBackBuffer(SurfaceBuffer *buffer);
SurfaceBuffer *createSurfaceBuffer(struct ::wl_resource *buffer);
+ QList<QWaylandSurfaceView *> views;
+
friend class QWaylandSurface;
friend class RoleBase;
};
diff --git a/src/imports/compositor/WaylandCursorItem.qml b/src/imports/compositor/WaylandCursorItem.qml
new file mode 100644
index 000000000..4a3a26220
--- /dev/null
+++ b/src/imports/compositor/WaylandCursorItem.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the plugins of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL21$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 or version 3 as published by the Free
+** Software Foundation and appearing in the file LICENSE.LGPLv21 and
+** LICENSE.LGPLv3 included in the packaging of this file. Please review the
+** following information to ensure the GNU Lesser General Public License
+** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+
+Item {
+ id: cursorItem
+ property QtObject compositor
+ property QtObject surface
+ property Item view
+ property int hotspotX: 0
+ property int hotspotY: 0
+
+ visible: surface != null
+
+ Component.onCompleted: {
+ if (!compositor) {
+ console.warn("WaylandCursorItem initiated without compositor. This leads to undefined behavior");
+ return;
+ }
+ compositor.currentCurserSurfaceRequest.connect(setSurface);
+ }
+
+ function setSurface(surface, hotspotX, hotspotY) {
+ cursorItem.surface = surface;
+ cursorItem.hotspotX = hotspotX;
+ cursorItem.hotspotY = hotspotY;
+ }
+ onSurfaceChanged: {
+ if (view)
+ view.destroy();
+ if (surface) {
+ view = Qt.createQmlObject("WaylandSurfaceItem { }", cursorItem);
+ }
+ }
+}
diff --git a/src/imports/compositor/qwaylandquickcompositorplugin.cpp b/src/imports/compositor/qwaylandquickcompositorplugin.cpp
index f32ec413b..1db634f58 100644
--- a/src/imports/compositor/qwaylandquickcompositorplugin.cpp
+++ b/src/imports/compositor/qwaylandquickcompositorplugin.cpp
@@ -128,7 +128,7 @@ public:
static void defineModule(const char *uri)
{
qmlRegisterType<QWaylandQuickCompositorImpl>(uri, 1, 0, "WaylandCompositor");
- qmlRegisterUncreatableType<QWaylandSurfaceItem>(uri, 1, 0, "WaylandSurfaceItem", QObject::tr("Cannot create instance of WaylandSurfaceItem"));
+ qmlRegisterType<QWaylandSurfaceItem>(uri, 1, 0, "WaylandSurfaceView");
qmlRegisterUncreatableType<QWaylandQuickSurface>(uri, 1, 0, "WaylandQuickSurface", QObject::tr("Cannot create instance of WaylandQuickSurface"));
qmlRegisterUncreatableType<QWaylandClient>(uri, 1, 0, "WaylandClient", QObject::tr("Cannot create instance of WaylandClient"));
qmlRegisterUncreatableType<QWaylandOutput>(uri, 1, 0, "WaylandOutput", QObject::tr("Cannot create instance of WaylandOutput"));