summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJørgen Lind <jorgen.lind@theqtcompany.com>2015-09-15 13:05:30 +0200
committerPaul Olav Tvete <paul.tvete@theqtcompany.com>2015-09-16 10:01:13 +0000
commit47ad4c12221b8e876e683648a8ce3cc95dfb66ae (patch)
tree66ed91bc36aa7185a01775bf44dbcd74a890bee7
parent06230b2fa2ccaa39559d382c8ef71a93176f31a1 (diff)
Make QWaylandQuickItem use pimpl
Change-Id: Ic2c0707d8576f72e1c6ae6e8c2e026882a5733b6 Reviewed-by: Paul Olav Tvete <paul.tvete@theqtcompany.com>
-rw-r--r--src/compositor/compositor_api/compositor_api.pri5
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.cpp235
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem.h32
-rw-r--r--src/compositor/compositor_api/qwaylandquickitem_p.h114
4 files changed, 250 insertions, 136 deletions
diff --git a/src/compositor/compositor_api/compositor_api.pri b/src/compositor/compositor_api/compositor_api.pri
index 281976710..13a40ba98 100644
--- a/src/compositor/compositor_api/compositor_api.pri
+++ b/src/compositor/compositor_api/compositor_api.pri
@@ -54,7 +54,8 @@ qtHaveModule(quick) {
compositor_api/qwaylandquickcompositor.h \
compositor_api/qwaylandquicksurface.h \
compositor_api/qwaylandquickoutput.h \
- compositor_api/qwaylandquickitem.h
+ compositor_api/qwaylandquickitem.h \
+ compositor_api/qwaylandquickitem_p.h
- QT += qml quick
+ QT += qml qml-private quick quick-private
}
diff --git a/src/compositor/compositor_api/qwaylandquickitem.cpp b/src/compositor/compositor_api/qwaylandquickitem.cpp
index 21d17e77b..b339e91e6 100644
--- a/src/compositor/compositor_api/qwaylandquickitem.cpp
+++ b/src/compositor/compositor_api/qwaylandquickitem.cpp
@@ -35,6 +35,7 @@
****************************************************************************/
#include "qwaylandquickitem.h"
+#include "qwaylandquickitem_p.h"
#include "qwaylandquicksurface.h"
#include <QtWaylandCompositor/qwaylandcompositor.h>
#include <QtWaylandCompositor/qwaylandinput.h>
@@ -55,7 +56,7 @@
#include <QThread>
QT_BEGIN_NAMESPACE
-QMutex *QWaylandQuickItem::mutex = 0;
+QMutex *QWaylandQuickItemPrivate::mutex = 0;
class QWaylandSurfaceTextureProvider : public QSGTextureProvider
{
@@ -120,83 +121,67 @@ private:
};
QWaylandQuickItem::QWaylandQuickItem(QQuickItem *parent)
- : QQuickItem(parent)
- , m_view(new QWaylandView(this, this))
- , m_oldSurface(Q_NULLPTR)
- , m_provider(Q_NULLPTR)
- , m_paintEnabled(true)
- , m_touchEventsEnabled(false)
- , m_resizeSurfaceToItem(false)
- , m_inputEventsEnabled(true)
- , m_newTexture(false)
- , m_focusOnClick(true)
- , m_connectedWindow(Q_NULLPTR)
- , m_origin(QWaylandSurface::OriginTopLeft)
-{
- if (!mutex)
- mutex = new QMutex;
-
- setFlag(ItemHasContents);
-
- update();
-
- setSmooth(true);
-
- setAcceptedMouseButtons(Qt::LeftButton | Qt::MiddleButton | Qt::RightButton |
- Qt::ExtraButton1 | Qt::ExtraButton2 | Qt::ExtraButton3 | Qt::ExtraButton4 |
- Qt::ExtraButton5 | Qt::ExtraButton6 | Qt::ExtraButton7 | Qt::ExtraButton8 |
- Qt::ExtraButton9 | Qt::ExtraButton10 | Qt::ExtraButton11 |
- Qt::ExtraButton12 | Qt::ExtraButton13);
- setAcceptHoverEvents(true);
+ : QQuickItem(*new QWaylandQuickItemPrivate(), parent)
+{
+ d_func()->init();
+}
- connect(this, &QQuickItem::windowChanged, this, &QWaylandQuickItem::updateWindow);
- connect(m_view.data(), &QWaylandView::surfaceChanged, this, &QWaylandQuickItem::surfaceChanged);
- connect(m_view.data(), &QWaylandView::surfaceChanged, this, &QWaylandQuickItem::handleSurfaceChanged);
+QWaylandQuickItem::QWaylandQuickItem(QWaylandQuickItemPrivate &dd, QQuickItem *parent)
+ : QQuickItem(dd, parent)
+{
+ d_func()->init();
}
QWaylandQuickItem::~QWaylandQuickItem()
{
+ Q_D(QWaylandQuickItem);
disconnect(this, &QQuickItem::windowChanged, this, &QWaylandQuickItem::updateWindow);
- QMutexLocker locker(mutex);
- if (m_provider)
- m_provider->deleteLater();
+ QMutexLocker locker(d->mutex);
+ if (d->provider)
+ d->provider->deleteLater();
}
QWaylandCompositor *QWaylandQuickItem::compositor() const
{
- return m_view->surface() ? m_view->surface()->compositor() : Q_NULLPTR;
+ Q_D(const QWaylandQuickItem);
+ return d->view->surface() ? d->view->surface()->compositor() : Q_NULLPTR;
}
QWaylandView *QWaylandQuickItem::view() const
{
- return m_view.data();
+ Q_D(const QWaylandQuickItem);
+ return d->view.data();
}
QWaylandSurface *QWaylandQuickItem::surface() const
{
- return m_view->surface();
+ Q_D(const QWaylandQuickItem);
+ return d->view->surface();
}
void QWaylandQuickItem::setSurface(QWaylandSurface *surface)
{
- m_view->setSurface(surface);
+ Q_D(QWaylandQuickItem);
+ d->view->setSurface(surface);
}
QWaylandSurface::Origin QWaylandQuickItem::origin() const
{
- return m_origin;
+ Q_D(const QWaylandQuickItem);
+ return d->origin;
}
QSGTextureProvider *QWaylandQuickItem::textureProvider() const
{
- return m_provider;
+ Q_D(const QWaylandQuickItem);
+ return d->provider;
}
void QWaylandQuickItem::mousePressEvent(QMouseEvent *event)
{
+ Q_D(QWaylandQuickItem);
m_mousePressPosition = event->windowPos();
-
- if (!shouldSendInputEvents()) {
+ if (!d->shouldSendInputEvents()) {
event->ignore();
return;
}
@@ -208,7 +193,7 @@ void QWaylandQuickItem::mousePressEvent(QMouseEvent *event)
QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event);
- if (m_focusOnClick)
+ if (d->focusOnClick)
takeFocus(inputDevice);
inputDevice->sendMousePressEvent(event->button());
@@ -216,9 +201,10 @@ void QWaylandQuickItem::mousePressEvent(QMouseEvent *event)
void QWaylandQuickItem::mouseMoveEvent(QMouseEvent *event)
{
- if (shouldSendInputEvents()) {
+ Q_D(QWaylandQuickItem);
+ if (d->shouldSendInputEvents()) {
QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event);
- inputDevice->sendMouseMoveEvent(m_view.data(), event->localPos(), event->windowPos());
+ inputDevice->sendMouseMoveEvent(d->view.data(), event->localPos(), event->windowPos());
} else {
emit mouseMove(event->windowPos());
event->ignore();
@@ -227,8 +213,9 @@ void QWaylandQuickItem::mouseMoveEvent(QMouseEvent *event)
void QWaylandQuickItem::mouseReleaseEvent(QMouseEvent *event)
{
+ Q_D(QWaylandQuickItem);
m_mousePressPosition = QPointF();
- if (shouldSendInputEvents()) {
+ if (d->shouldSendInputEvents()) {
QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event);
inputDevice->sendMouseReleaseEvent(event->button());
} else {
@@ -239,15 +226,16 @@ void QWaylandQuickItem::mouseReleaseEvent(QMouseEvent *event)
void QWaylandQuickItem::hoverEnterEvent(QHoverEvent *event)
{
+ Q_D(QWaylandQuickItem);
if (surface()) {
if (!surface()->inputRegionContains(event->pos())) {
event->ignore();
return;
}
}
- if (shouldSendInputEvents()) {
+ if (d->shouldSendInputEvents()) {
QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event);
- inputDevice->sendMouseMoveEvent(m_view.data(), event->pos(), mapToScene(event->pos()));
+ inputDevice->sendMouseMoveEvent(d->view.data(), event->pos(), mapToScene(event->pos()));
} else {
event->ignore();
}
@@ -255,15 +243,16 @@ void QWaylandQuickItem::hoverEnterEvent(QHoverEvent *event)
void QWaylandQuickItem::hoverMoveEvent(QHoverEvent *event)
{
+ Q_D(QWaylandQuickItem);
if (surface()) {
if (!surface()->inputRegionContains(event->pos())) {
event->ignore();
return;
}
}
- if (shouldSendInputEvents()) {
+ if (d->shouldSendInputEvents()) {
QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event);
- inputDevice->sendMouseMoveEvent(m_view.data(), event->pos(), mapToScene(event->pos()));
+ inputDevice->sendMouseMoveEvent(d->view.data(), event->pos(), mapToScene(event->pos()));
} else {
event->ignore();
}
@@ -271,7 +260,8 @@ void QWaylandQuickItem::hoverMoveEvent(QHoverEvent *event)
void QWaylandQuickItem::hoverLeaveEvent(QHoverEvent *event)
{
- if (shouldSendInputEvents()) {
+ Q_D(QWaylandQuickItem);
+ if (d->shouldSendInputEvents()) {
QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event);
inputDevice->setMouseFocus(Q_NULLPTR);
} else {
@@ -281,7 +271,8 @@ void QWaylandQuickItem::hoverLeaveEvent(QHoverEvent *event)
void QWaylandQuickItem::wheelEvent(QWheelEvent *event)
{
- if (shouldSendInputEvents()) {
+ Q_D(QWaylandQuickItem);
+ if (d->shouldSendInputEvents()) {
if (!surface()->inputRegionContains(event->pos())) {
event->ignore();
return;
@@ -296,7 +287,8 @@ void QWaylandQuickItem::wheelEvent(QWheelEvent *event)
void QWaylandQuickItem::keyPressEvent(QKeyEvent *event)
{
- if (shouldSendInputEvents()) {
+ Q_D(QWaylandQuickItem);
+ if (d->shouldSendInputEvents()) {
QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event);
inputDevice->sendFullKeyEvent(event);
} else {
@@ -306,7 +298,8 @@ void QWaylandQuickItem::keyPressEvent(QKeyEvent *event)
void QWaylandQuickItem::keyReleaseEvent(QKeyEvent *event)
{
- if (shouldSendInputEvents() && hasFocus()) {
+ Q_D(QWaylandQuickItem);
+ if (d->shouldSendInputEvents() && hasFocus()) {
QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event);
inputDevice->sendFullKeyEvent(event);
} else {
@@ -316,7 +309,8 @@ void QWaylandQuickItem::keyReleaseEvent(QKeyEvent *event)
void QWaylandQuickItem::touchEvent(QTouchEvent *event)
{
- if (shouldSendInputEvents() && m_touchEventsEnabled) {
+ Q_D(QWaylandQuickItem);
+ if (d->shouldSendInputEvents() && d->touchEventsEnabled) {
QWaylandInputDevice *inputDevice = compositor()->inputDeviceFor(event);
if (event->type() == QEvent::TouchBegin) {
@@ -336,8 +330,8 @@ void QWaylandQuickItem::touchEvent(QTouchEvent *event)
}
event->accept();
- if (inputDevice->mouseFocus() != m_view.data()) {
- inputDevice->sendMouseMoveEvent(m_view.data(), pointPos, mapToScene(pointPos));
+ if (inputDevice->mouseFocus() != d->view.data()) {
+ inputDevice->sendMouseMoveEvent(d->view.data(), pointPos, mapToScene(pointPos));
}
inputDevice->sendFullTouchEvent(event);
} else {
@@ -355,14 +349,15 @@ void QWaylandQuickItem::mouseUngrabEvent()
void QWaylandQuickItem::handleSurfaceChanged()
{
- if (m_oldSurface) {
- disconnect(m_oldSurface, &QWaylandSurface::mappedChanged, this, &QWaylandQuickItem::surfaceMappedChanged);
- disconnect(m_oldSurface, &QWaylandSurface::parentChanged, this, &QWaylandQuickItem::parentChanged);
- disconnect(m_oldSurface, &QWaylandSurface::sizeChanged, this, &QWaylandQuickItem::updateSize);
- disconnect(m_oldSurface, &QWaylandSurface::configure, this, &QWaylandQuickItem::updateBuffer);
- disconnect(m_oldSurface, &QWaylandSurface::redraw, this, &QQuickItem::update);
+ Q_D(QWaylandQuickItem);
+ if (d->oldSurface) {
+ disconnect(d->oldSurface, &QWaylandSurface::mappedChanged, this, &QWaylandQuickItem::surfaceMappedChanged);
+ disconnect(d->oldSurface, &QWaylandSurface::parentChanged, this, &QWaylandQuickItem::parentChanged);
+ disconnect(d->oldSurface, &QWaylandSurface::sizeChanged, this, &QWaylandQuickItem::updateSize);
+ disconnect(d->oldSurface, &QWaylandSurface::configure, this, &QWaylandQuickItem::updateBuffer);
+ disconnect(d->oldSurface, &QWaylandSurface::redraw, this, &QQuickItem::update);
}
- if (QWaylandSurface *newSurface = m_view->surface()) {
+ if (QWaylandSurface *newSurface = d->view->surface()) {
connect(newSurface, &QWaylandSurface::mappedChanged, this, &QWaylandQuickItem::surfaceMappedChanged);
connect(newSurface, &QWaylandSurface::parentChanged, this, &QWaylandQuickItem::parentChanged);
connect(newSurface, &QWaylandSurface::sizeChanged, this, &QWaylandQuickItem::updateSize);
@@ -370,16 +365,16 @@ void QWaylandQuickItem::handleSurfaceChanged()
connect(newSurface, &QWaylandSurface::redraw, this, &QQuickItem::update);
setWidth(newSurface->size().width());
setHeight(newSurface->size().height());
- if (newSurface->origin() != m_origin) {
- m_origin = newSurface->origin();
+ if (newSurface->origin() != d->origin) {
+ d->origin = newSurface->origin();
emit originChanged();
}
if (window()) {
QWaylandOutput *output = newSurface->compositor()->output(window());
- m_view->setOutput(output);
+ d->view->setOutput(output);
}
}
- m_oldSurface = m_view->surface();
+ d->oldSurface = d->view->surface();
}
void QWaylandQuickItem::takeFocus(QWaylandInputDevice *device)
@@ -420,22 +415,19 @@ void QWaylandQuickItem::updateSize()
}
}
-void QWaylandQuickItem::syncGraphicsState()
-{
-
-}
-
bool QWaylandQuickItem::focusOnClick() const
{
- return m_focusOnClick;
+ Q_D(const QWaylandQuickItem);
+ return d->focusOnClick;
}
void QWaylandQuickItem::setFocusOnClick(bool focus)
{
- if (m_focusOnClick == focus)
+ Q_D(QWaylandQuickItem);
+ if (d->focusOnClick == focus)
return;
- m_focusOnClick = focus;
+ d->focusOnClick = focus;
emit focusOnClickChanged();
}
@@ -454,57 +446,75 @@ QPointF QWaylandQuickItem::mousePressPosition() const
*/
bool QWaylandQuickItem::paintEnabled() const
{
- return m_paintEnabled;
+ Q_D(const QWaylandQuickItem);
+ return d->paintEnabled;
}
void QWaylandQuickItem::setPaintEnabled(bool enabled)
{
- m_paintEnabled = enabled;
+ Q_D(QWaylandQuickItem);
+ d->paintEnabled = enabled;
update();
}
+bool QWaylandQuickItem::touchEventsEnabled() const
+{
+ Q_D(const QWaylandQuickItem);
+ return d->touchEventsEnabled;
+}
+
+bool QWaylandQuickItem::resizeSurfaceToItem() const
+{
+ Q_D(const QWaylandQuickItem);
+ return d->resizeSurfaceToItem;
+}
+
void QWaylandQuickItem::updateBuffer(bool hasBuffer)
{
+ Q_D(QWaylandQuickItem);
Q_UNUSED(hasBuffer);
- if (m_origin != surface()->origin()) {
- m_origin = surface()->origin();
+ if (d->origin != surface()->origin()) {
+ d->origin = surface()->origin();
emit originChanged();
}
}
void QWaylandQuickItem::updateWindow()
{
- if (m_connectedWindow) {
- disconnect(m_connectedWindow, &QQuickWindow::beforeSynchronizing, this, &QWaylandQuickItem::beforeSync);
+ Q_D(QWaylandQuickItem);
+ if (d->connectedWindow) {
+ disconnect(d->connectedWindow, &QQuickWindow::beforeSynchronizing, this, &QWaylandQuickItem::beforeSync);
}
- m_connectedWindow = window();
+ d->connectedWindow = window();
- if (m_connectedWindow) {
- connect(m_connectedWindow, &QQuickWindow::beforeSynchronizing, this, &QWaylandQuickItem::beforeSync, Qt::DirectConnection);
+ if (d->connectedWindow) {
+ connect(d->connectedWindow, &QQuickWindow::beforeSynchronizing, this, &QWaylandQuickItem::beforeSync, Qt::DirectConnection);
}
- if (compositor() && m_connectedWindow) {
- QWaylandOutput *output = compositor()->output(m_connectedWindow);
+ if (compositor() && d->connectedWindow) {
+ QWaylandOutput *output = compositor()->output(d->connectedWindow);
Q_ASSERT(output);
- m_view->setOutput(output);
+ d->view->setOutput(output);
}
}
void QWaylandQuickItem::beforeSync()
{
- if (m_view->advance()) {
- m_newTexture = true;
+ Q_D(QWaylandQuickItem);
+ if (d->view->advance()) {
+ d->newTexture = true;
update();
}
}
QSGNode *QWaylandQuickItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *)
{
- bool mapped = (surface() && surface()->isMapped() && m_view->currentBuffer().hasBuffer())
- || (m_view->isBufferLocked() && m_provider);
+ Q_D(QWaylandQuickItem);
+ bool mapped = (surface() && surface()->isMapped() && d->view->currentBuffer().hasBuffer())
+ || (d->view->isBufferLocked() && d->provider);
- if (!mapped || !m_paintEnabled) {
+ if (!mapped || !d->paintEnabled) {
delete oldNode;
return 0;
}
@@ -514,18 +524,18 @@ QSGNode *QWaylandQuickItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat
if (!node)
node = new QSGSimpleTextureNode();
- if (!m_provider)
- m_provider = new QWaylandSurfaceTextureProvider();
+ if (!d->provider)
+ d->provider = new QWaylandSurfaceTextureProvider();
- if (m_newTexture) {
- m_newTexture = false;
- m_provider->setBufferRef(this, m_view->currentBuffer());
- node->setTexture(m_provider->texture());
+ if (d->newTexture) {
+ d->newTexture = false;
+ d->provider->setBufferRef(this, d->view->currentBuffer());
+ node->setTexture(d->provider->texture());
}
- m_provider->setSmooth(smooth());
+ d->provider->setSmooth(smooth());
- if (m_provider->invertY()) {
+ if (d->provider->invertY()) {
node->setRect(0, height(), width(), -height());
} else {
node->setRect(0, 0, width(), height());
@@ -536,24 +546,33 @@ QSGNode *QWaylandQuickItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeDat
void QWaylandQuickItem::setTouchEventsEnabled(bool enabled)
{
- if (m_touchEventsEnabled != enabled) {
- m_touchEventsEnabled = enabled;
+ Q_D(QWaylandQuickItem);
+ if (d->touchEventsEnabled != enabled) {
+ d->touchEventsEnabled = enabled;
emit touchEventsEnabledChanged();
}
}
void QWaylandQuickItem::setResizeSurfaceToItem(bool enabled)
{
- if (m_resizeSurfaceToItem != enabled) {
- m_resizeSurfaceToItem = enabled;
+ Q_D(QWaylandQuickItem);
+ if (d->resizeSurfaceToItem != enabled) {
+ d->resizeSurfaceToItem = enabled;
emit resizeSurfaceToItemChanged();
}
}
+bool QWaylandQuickItem::inputEventsEnabled() const
+{
+ Q_D(const QWaylandQuickItem);
+ return d->inputEventsEnabled;
+}
+
void QWaylandQuickItem::setInputEventsEnabled(bool enabled)
{
- if (m_inputEventsEnabled != enabled) {
- m_inputEventsEnabled = enabled;
+ Q_D(QWaylandQuickItem);
+ if (d->inputEventsEnabled != enabled) {
+ d->inputEventsEnabled = enabled;
setAcceptHoverEvents(enabled);
emit inputEventsEnabledChanged();
}
diff --git a/src/compositor/compositor_api/qwaylandquickitem.h b/src/compositor/compositor_api/qwaylandquickitem.h
index 57dd91f0a..7ef626f5f 100644
--- a/src/compositor/compositor_api/qwaylandquickitem.h
+++ b/src/compositor/compositor_api/qwaylandquickitem.h
@@ -51,13 +51,13 @@ Q_DECLARE_METATYPE(QWaylandQuickSurface*)
QT_BEGIN_NAMESPACE
-class QWaylandSurfaceTextureProvider;
-class QMutex;
class QWaylandInputDevice;
+class QWaylandQuickItemPrivate;
class Q_COMPOSITOR_EXPORT QWaylandQuickItem : public QQuickItem
{
Q_OBJECT
+ Q_DECLARE_PRIVATE(QWaylandQuickItem)
Q_PROPERTY(QWaylandView *view READ view CONSTANT)
Q_PROPERTY(QWaylandCompositor *compositor READ compositor)
Q_PROPERTY(QWaylandSurface *surface READ surface WRITE setSurface NOTIFY surfaceChanged)
@@ -85,17 +85,15 @@ public:
QSGTextureProvider *textureProvider() const;
bool paintEnabled() const;
- bool touchEventsEnabled() const { return m_touchEventsEnabled; }
- bool resizeSurfaceToItem() const { return m_resizeSurfaceToItem; }
+ bool touchEventsEnabled() const;
+ bool resizeSurfaceToItem() const;
void setTouchEventsEnabled(bool enabled);
void setResizeSurfaceToItem(bool enabled);
- bool inputEventsEnabled() const { return m_inputEventsEnabled; }
+ bool inputEventsEnabled() const;
void setInputEventsEnabled(bool enabled);
- Q_INVOKABLE void syncGraphicsState();
-
bool focusOnClick() const;
void setFocusOnClick(bool focus);
@@ -143,25 +141,7 @@ Q_SIGNALS:
protected:
QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *);
-private:
- friend class QWaylandSurfaceNode;
- friend class QWaylandQuickSurface;
- 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;
- bool m_resizeSurfaceToItem;
- bool m_inputEventsEnabled;
- bool m_newTexture;
- bool m_focusOnClick;
-
- QQuickWindow *m_connectedWindow;
- QWaylandSurface::Origin m_origin;
+ QWaylandQuickItem(QWaylandQuickItemPrivate &dd, QQuickItem *parent = 0);
QPointF m_mousePressPosition;
};
diff --git a/src/compositor/compositor_api/qwaylandquickitem_p.h b/src/compositor/compositor_api/qwaylandquickitem_p.h
new file mode 100644
index 000000000..a087577e7
--- /dev/null
+++ b/src/compositor/compositor_api/qwaylandquickitem_p.h
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the QtWaylandCompositor module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** 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 The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/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 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QWAYLANDQUICKITEM_P_H
+#define QWAYLANDQUICKITEM_P_H
+
+#include <QtQuick/private/qquickitem_p.h>
+
+#include "qwaylandquickitem.h"
+
+QT_BEGIN_NAMESPACE
+
+class QWaylandSurfaceTextureProvider;
+class QMutex;
+
+class QWaylandQuickItemPrivate : public QQuickItemPrivate
+{
+ Q_DECLARE_PUBLIC(QWaylandQuickItem)
+public:
+ QWaylandQuickItemPrivate()
+ : QQuickItemPrivate()
+ , view(Q_NULLPTR)
+ , oldSurface(Q_NULLPTR)
+ , provider(Q_NULLPTR)
+ , paintEnabled(true)
+ , touchEventsEnabled(false)
+ , resizeSurfaceToItem(false)
+ , inputEventsEnabled(true)
+ , newTexture(false)
+ , focusOnClick(true)
+ , connectedWindow(Q_NULLPTR)
+ , origin(QWaylandSurface::OriginTopLeft)
+ {
+ }
+
+ void init()
+ {
+ Q_Q(QWaylandQuickItem);
+ if (!mutex)
+ mutex = new QMutex;
+
+ view.reset(new QWaylandView(q, q));
+ q->setFlag(QQuickItem::ItemHasContents);
+
+ q->update();
+
+ q->setSmooth(true);
+
+ q->setAcceptedMouseButtons(Qt::LeftButton | Qt::MiddleButton | Qt::RightButton |
+ Qt::ExtraButton1 | Qt::ExtraButton2 | Qt::ExtraButton3 | Qt::ExtraButton4 |
+ Qt::ExtraButton5 | Qt::ExtraButton6 | Qt::ExtraButton7 | Qt::ExtraButton8 |
+ Qt::ExtraButton9 | Qt::ExtraButton10 | Qt::ExtraButton11 |
+ Qt::ExtraButton12 | Qt::ExtraButton13);
+ q->setAcceptHoverEvents(true);
+
+ QObject::connect(q, &QQuickItem::windowChanged, q, &QWaylandQuickItem::updateWindow);
+ QObject::connect(view.data(), &QWaylandView::surfaceChanged, q, &QWaylandQuickItem::surfaceChanged);
+ QObject::connect(view.data(), &QWaylandView::surfaceChanged, q, &QWaylandQuickItem::handleSurfaceChanged);
+ }
+
+ bool shouldSendInputEvents() const { return view->surface() && inputEventsEnabled; }
+
+ static QMutex *mutex;
+
+ QScopedPointer<QWaylandView> view;
+ QWaylandSurface *oldSurface;
+ mutable QWaylandSurfaceTextureProvider *provider;
+ bool paintEnabled;
+ bool touchEventsEnabled;
+ bool resizeSurfaceToItem;
+ bool inputEventsEnabled;
+ bool newTexture;
+ bool focusOnClick;
+
+ QQuickWindow *connectedWindow;
+ QWaylandSurface::Origin origin;
+};
+
+QT_END_NAMESPACE
+
+#endif /*QWAYLANDQUICKITEM_P_H*/