summaryrefslogtreecommitdiffstats
path: root/src/compositor/extensions
diff options
context:
space:
mode:
Diffstat (limited to 'src/compositor/extensions')
-rw-r--r--src/compositor/extensions/extensions.pri48
-rw-r--r--src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp241
-rw-r--r--src/compositor/extensions/qwaylandquickshellsurfaceitem.h86
-rw-r--r--src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h92
-rw-r--r--src/compositor/extensions/qwaylandshell.cpp552
-rw-r--r--src/compositor/extensions/qwaylandshell.h146
-rw-r--r--src/compositor/extensions/qwaylandshell_p.h150
-rw-r--r--src/compositor/extensions/qwaylandwindowmanagerextension.cpp114
-rw-r--r--src/compositor/extensions/qwaylandwindowmanagerextension.h73
-rw-r--r--src/compositor/extensions/qwaylandwindowmanagerextension_p.h77
-rw-r--r--src/compositor/extensions/qwlextendedsurface.cpp185
-rw-r--r--src/compositor/extensions/qwlextendedsurface_p.h161
-rw-r--r--src/compositor/extensions/qwlinputmethod.cpp152
-rw-r--r--src/compositor/extensions/qwlinputmethod_p.h105
-rw-r--r--src/compositor/extensions/qwlinputmethodcontext.cpp135
-rw-r--r--src/compositor/extensions/qwlinputmethodcontext_p.h90
-rw-r--r--src/compositor/extensions/qwlinputpanel.cpp130
-rw-r--r--src/compositor/extensions/qwlinputpanel_p.h99
-rw-r--r--src/compositor/extensions/qwlinputpanelsurface.cpp86
-rw-r--r--src/compositor/extensions/qwlinputpanelsurface_p.h95
-rw-r--r--src/compositor/extensions/qwlqtkey.cpp78
-rw-r--r--src/compositor/extensions/qwlqtkey_p.h80
-rw-r--r--src/compositor/extensions/qwlqttouch.cpp164
-rw-r--r--src/compositor/extensions/qwlqttouch_p.h104
-rw-r--r--src/compositor/extensions/qwltextinput.cpp212
-rw-r--r--src/compositor/extensions/qwltextinput_p.h106
-rw-r--r--src/compositor/extensions/qwltextinputmanager.cpp64
-rw-r--r--src/compositor/extensions/qwltextinputmanager_p.h78
28 files changed, 3703 insertions, 0 deletions
diff --git a/src/compositor/extensions/extensions.pri b/src/compositor/extensions/extensions.pri
new file mode 100644
index 000000000..bede92580
--- /dev/null
+++ b/src/compositor/extensions/extensions.pri
@@ -0,0 +1,48 @@
+CONFIG += wayland-scanner
+WAYLANDSERVERSOURCES += \
+ ../extensions/surface-extension.xml \
+ ../extensions/touch-extension.xml \
+ ../extensions/qtkey-extension.xml \
+ ../extensions/windowmanager.xml \
+ ../3rdparty/protocol/input-method.xml \
+ ../3rdparty/protocol/text.xml \
+
+HEADERS += \
+ extensions/qwlextendedsurface_p.h \
+ extensions/qwlqttouch_p.h \
+ extensions/qwlqtkey_p.h \
+ extensions/qwaylandshell.h \
+ extensions/qwaylandshell_p.h \
+ extensions/qwaylandwindowmanagerextension.h \
+ extensions/qwaylandwindowmanagerextension_p.h \
+ extensions/qwltextinput_p.h \
+ extensions/qwltextinputmanager_p.h \
+ extensions/qwlinputpanel_p.h \
+ extensions/qwlinputpanelsurface_p.h \
+ extensions/qwlinputmethod_p.h \
+ extensions/qwlinputmethodcontext_p.h \
+
+SOURCES += \
+ extensions/qwlextendedsurface.cpp \
+ extensions/qwlqttouch.cpp \
+ extensions/qwlqtkey.cpp \
+ extensions/qwaylandshell.cpp \
+ extensions/qwaylandwindowmanagerextension.cpp \
+ extensions/qwltextinput.cpp \
+ extensions/qwltextinputmanager.cpp \
+ extensions/qwlinputpanel.cpp \
+ extensions/qwlinputpanelsurface.cpp \
+ extensions/qwlinputmethod.cpp \
+ extensions/qwlinputmethodcontext.cpp \
+
+qtHaveModule(quick) {
+ HEADERS += \
+ extensions/qwaylandquickshellsurfaceitem.h \
+ extensions/qwaylandquickshellsurfaceitem_p.h \
+
+ SOURCES += \
+ extensions/qwaylandquickshellsurfaceitem.cpp \
+
+}
+
+INCLUDEPATH += extensions
diff --git a/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp b/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp
new file mode 100644
index 000000000..5eb34b849
--- /dev/null
+++ b/src/compositor/extensions/qwaylandquickshellsurfaceitem.cpp
@@ -0,0 +1,241 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#include "qwaylandquickshellsurfaceitem.h"
+#include "qwaylandquickshellsurfaceitem_p.h"
+
+#include <QtWaylandCompositor/QWaylandCompositor>
+#include <QtWaylandCompositor/QWaylandInputDevice>
+
+QT_BEGIN_NAMESPACE
+
+/*!
+ * \qmltype ShellSurfaceItem
+ * \inqmlmodule QtWayland.Compositor
+ * \brief An item representing a ShellSurface.
+ *
+ * This type can be used to render shell surfaces as part of a Qt Quick scene.
+ * It handles moving and resizing triggered by clicking on the window decorations.
+ */
+
+/*!
+ * \class QWaylandQuickShellSurfaceItem
+ * \inmodule QtWaylandCompositor
+ * \brief A Qt Quick item for QWaylandShellSurface.
+ *
+ * This class can be used to create Qt Quick items representing shell surfaces.
+ * It handles moving and resizing triggered by clicking on the window decorations.
+ *
+ * \sa QWaylandQuickItem
+ */
+
+/*!
+ * Constructs a QWaylandQuickShellSurfaceItem with the given \a parent.
+ */
+QWaylandQuickShellSurfaceItem::QWaylandQuickShellSurfaceItem(QQuickItem *parent)
+ : QWaylandQuickItem(*new QWaylandQuickShellSurfaceItemPrivate(), parent)
+{
+}
+
+/*!
+ * \internal
+ */
+QWaylandQuickShellSurfaceItem::QWaylandQuickShellSurfaceItem(QWaylandQuickShellSurfaceItemPrivate &dd, QQuickItem *parent)
+ : QWaylandQuickItem(dd, parent)
+{
+}
+
+/*!
+ * \qmlproperty object QtWaylandCompositor::ShellSurfaceItem::shellSurface
+ *
+ * This property holds the shell surface rendered by this ShellSurfaceItem.
+ */
+
+/*!
+ * \property QWaylandQuickShellSurfaceItem::shellSurface
+ *
+ * This property holds the shell surface rendered by this QWaylandQuickShellSurfaceItem.
+ */
+QWaylandShellSurface *QWaylandQuickShellSurfaceItem::shellSurface() const
+{
+ Q_D(const QWaylandQuickShellSurfaceItem);
+ return d->shellSurface;
+}
+
+void QWaylandQuickShellSurfaceItem::setShellSurface(QWaylandShellSurface *shellSurface)
+{
+ Q_D(QWaylandQuickShellSurfaceItem);
+ if (shellSurface == d->shellSurface)
+ return;
+
+ if (d->shellSurface) {
+ disconnect(d->shellSurface, &QWaylandShellSurface::startMove, this, &QWaylandQuickShellSurfaceItem::handleStartMove);
+ disconnect(d->shellSurface, &QWaylandShellSurface::startResize, this, &QWaylandQuickShellSurfaceItem::handleStartResize);
+ }
+ d->shellSurface = shellSurface;
+ if (d->shellSurface) {
+ connect(d->shellSurface, &QWaylandShellSurface::startMove, this, &QWaylandQuickShellSurfaceItem::handleStartMove);
+ connect(d->shellSurface, &QWaylandShellSurface::startResize, this, &QWaylandQuickShellSurfaceItem::handleStartResize);
+ }
+ emit shellSurfaceChanged();
+}
+
+/*!
+ * \internal
+ * \property QWaylandQuickShellSurfaceItem::moveItem
+ *
+ * This property holds the move item for this QWaylandQuickShellSurfaceItem.
+ */
+QQuickItem *QWaylandQuickShellSurfaceItem::moveItem() const
+{
+ Q_D(const QWaylandQuickShellSurfaceItem);
+ return d->moveItem;
+}
+
+void QWaylandQuickShellSurfaceItem::setMoveItem(QQuickItem *moveItem)
+{
+ Q_D(QWaylandQuickShellSurfaceItem);
+ if (d->moveItem == moveItem)
+ return;
+ d->moveItem = moveItem;
+ moveItemChanged();
+}
+
+/*!
+ * \internal
+ */
+void QWaylandQuickShellSurfaceItem::handleStartMove(QWaylandInputDevice *inputDevice)
+{
+ Q_D(QWaylandQuickShellSurfaceItem);
+ d->grabberState = QWaylandQuickShellSurfaceItemPrivate::MoveState;
+ d->moveState.inputDevice = inputDevice;
+ d->moveState.initialized = false;
+}
+
+/*!
+ * \internal
+ */
+void QWaylandQuickShellSurfaceItem::handleStartResize(QWaylandInputDevice *inputDevice, QWaylandShellSurface::ResizeEdge edges)
+{
+ Q_D(QWaylandQuickShellSurfaceItem);
+ d->grabberState = QWaylandQuickShellSurfaceItemPrivate::ResizeState;
+ d->resizeState.inputDevice = inputDevice;
+ d->resizeState.resizeEdges = edges;
+ d->resizeState.initialSize = surface()->size();
+ d->resizeState.initialized = false;
+}
+
+/*!
+ * \internal
+ */
+void QWaylandQuickShellSurfaceItem::adjustOffsetForNextFrame(const QPointF &offset)
+{
+ Q_D(QWaylandQuickShellSurfaceItem);
+ QQuickItem *moveItem = d->moveItem ? d->moveItem : this;
+ moveItem->setPosition(moveItem->position() + offset);
+}
+
+/*!
+ * \internal
+ */
+void QWaylandQuickShellSurfaceItem::mouseMoveEvent(QMouseEvent *event)
+{
+ Q_D(QWaylandQuickShellSurfaceItem);
+ if (d->grabberState == QWaylandQuickShellSurfaceItemPrivate::ResizeState) {
+ Q_ASSERT(d->resizeState.inputDevice == compositor()->inputDeviceFor(event));
+ if (!d->resizeState.initialized) {
+ d->resizeState.initialMousePos = event->windowPos();
+ d->resizeState.initialized = true;
+ return;
+ }
+ QPointF delta = event->windowPos() - d->resizeState.initialMousePos;
+ QSize newSize = shellSurface()->sizeForResize(d->resizeState.initialSize, delta, d->resizeState.resizeEdges);
+ shellSurface()->sendConfigure(newSize, d->resizeState.resizeEdges);
+ } else if (d->grabberState == QWaylandQuickShellSurfaceItemPrivate::MoveState) {
+ Q_ASSERT(d->moveState.inputDevice == compositor()->inputDeviceFor(event));
+ QQuickItem *moveItem = d->moveItem ? d->moveItem : this;
+ if (!d->moveState.initialized) {
+ d->moveState.initialOffset = moveItem->mapFromItem(Q_NULLPTR, event->windowPos());
+ d->moveState.initialized = true;
+ return;
+ }
+ if (!moveItem->parentItem())
+ return;
+ QPointF parentPos = moveItem->parentItem()->mapFromItem(Q_NULLPTR, event->windowPos());
+ moveItem->setPosition(parentPos - d->moveState.initialOffset);
+ } else {
+ QWaylandQuickItem::mouseMoveEvent(event);
+ }
+}
+
+/*!
+ * \internal
+ */
+void QWaylandQuickShellSurfaceItem::mouseReleaseEvent(QMouseEvent *event)
+{
+ Q_D(QWaylandQuickShellSurfaceItem);
+ if (d->grabberState != QWaylandQuickShellSurfaceItemPrivate::DefaultState) {
+ d->grabberState = QWaylandQuickShellSurfaceItemPrivate::DefaultState;
+ return;
+ }
+ QWaylandQuickItem::mouseReleaseEvent(event);
+}
+
+/*!
+ * \internal
+ */
+void QWaylandQuickShellSurfaceItem::surfaceChangedEvent(QWaylandSurface *newSurface, QWaylandSurface *oldSurface)
+{
+ if (oldSurface)
+ disconnect(oldSurface, &QWaylandSurface::offsetForNextFrame, this, &QWaylandQuickShellSurfaceItem::adjustOffsetForNextFrame);
+
+ if (newSurface)
+ connect(newSurface, &QWaylandSurface::offsetForNextFrame, this, &QWaylandQuickShellSurfaceItem::adjustOffsetForNextFrame);
+}
+
+/*!
+ * \internal
+ */
+void QWaylandQuickShellSurfaceItem::componentComplete()
+{
+ Q_D(QWaylandQuickShellSurfaceItem);
+ if (!d->shellSurface)
+ setShellSurface(new QWaylandShellSurface());
+
+ QWaylandQuickItem::componentComplete();
+}
+
+QT_END_NAMESPACE
diff --git a/src/compositor/extensions/qwaylandquickshellsurfaceitem.h b/src/compositor/extensions/qwaylandquickshellsurfaceitem.h
new file mode 100644
index 000000000..a6f773bd4
--- /dev/null
+++ b/src/compositor/extensions/qwaylandquickshellsurfaceitem.h
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** 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 QWAYLANDQUICKSHELLSURFACEITEM_H
+#define QWAYLANDQUICKSHELLSURFACEITEM_H
+
+#include <QtWaylandCompositor/QWaylandExtension>
+#include <QtWaylandCompositor/QWaylandQuickItem>
+#include <QtWaylandCompositor/QWaylandShellSurface>
+
+QT_BEGIN_NAMESPACE
+
+class QWaylandQuickShellSurfaceItemPrivate;
+
+class Q_COMPOSITOR_EXPORT QWaylandQuickShellSurfaceItem : public QWaylandQuickItem
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QWaylandQuickShellSurfaceItem)
+ Q_PROPERTY(QWaylandShellSurface *shellSurface READ shellSurface WRITE setShellSurface NOTIFY shellSurfaceChanged)
+ Q_PROPERTY(QQuickItem *moveItem READ moveItem WRITE setMoveItem NOTIFY moveItemChanged)
+
+public:
+ QWaylandQuickShellSurfaceItem(QQuickItem *parent = 0);
+
+ static QWaylandQuickShellSurfaceItemPrivate *get(QWaylandQuickShellSurfaceItem *item) { return item->d_func(); }
+
+ QWaylandShellSurface *shellSurface() const;
+ void setShellSurface(QWaylandShellSurface *shellSurface);
+
+ QQuickItem *moveItem() const;
+ void setMoveItem(QQuickItem *moveItem);
+Q_SIGNALS:
+ void shellSurfaceChanged();
+ void moveItemChanged();
+
+private Q_SLOTS:
+ void handleStartMove(QWaylandInputDevice *inputDevice);
+ void handleStartResize(QWaylandInputDevice *inputDevice, QWaylandShellSurface::ResizeEdge edges);
+ void adjustOffsetForNextFrame(const QPointF &offset);
+protected:
+ QWaylandQuickShellSurfaceItem(QWaylandQuickShellSurfaceItemPrivate &dd, QQuickItem *parent);
+
+ void mouseMoveEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+ void mouseReleaseEvent(QMouseEvent *event) Q_DECL_OVERRIDE;
+
+ void surfaceChangedEvent(QWaylandSurface *newSurface, QWaylandSurface *oldSurface) Q_DECL_OVERRIDE;
+
+ void componentComplete() Q_DECL_OVERRIDE;
+};
+
+QT_END_NAMESPACE
+
+#endif /*QWAYLANDQUICKSHELLSURFACEITEM_H*/
diff --git a/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h b/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h
new file mode 100644
index 000000000..510ff2c7c
--- /dev/null
+++ b/src/compositor/extensions/qwaylandquickshellsurfaceitem_p.h
@@ -0,0 +1,92 @@
+/****************************************************************************
+**
+** 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 QWAYLANDQUICKSHELLSURFACEITEM_P_H
+#define QWAYLANDQUICKSHELLSURFACEITEM_P_H
+
+#include <QtWaylandCompositor/private/qwaylandquickitem_p.h>
+
+QT_BEGIN_NAMESPACE
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+class Q_COMPOSITOR_EXPORT QWaylandQuickShellSurfaceItemPrivate : public QWaylandQuickItemPrivate
+{
+public:
+ enum GrabberState {
+ DefaultState,
+ ResizeState,
+ MoveState
+ };
+
+ QWaylandQuickShellSurfaceItemPrivate()
+ : QWaylandQuickItemPrivate()
+ , shellSurface(Q_NULLPTR)
+ , moveItem(Q_NULLPTR)
+ , grabberState(DefaultState)
+ {}
+
+ QWaylandShellSurface *shellSurface;
+ QQuickItem *moveItem;
+
+ GrabberState grabberState;
+ struct {
+ QWaylandInputDevice *inputDevice;
+ QPointF initialOffset;
+ bool initialized;
+ } moveState;
+
+ struct {
+ QWaylandInputDevice *inputDevice;
+ QWaylandShellSurface::ResizeEdge resizeEdges;
+ QSizeF initialSize;
+ QPointF initialMousePos;
+ bool initialized;
+ } resizeState;
+};
+
+QT_END_NAMESPACE
+
+#endif /*QWAYLANDQUICKSHELLSURFACEITEM_P_H*/
diff --git a/src/compositor/extensions/qwaylandshell.cpp b/src/compositor/extensions/qwaylandshell.cpp
new file mode 100644
index 000000000..e06dc9264
--- /dev/null
+++ b/src/compositor/extensions/qwaylandshell.cpp
@@ -0,0 +1,552 @@
+/****************************************************************************
+**
+** Copyright (C) 2015 The Qt Company Ltd.
+** Copyright (C) 2014 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+** 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$
+**
+****************************************************************************/
+
+#include "qwaylandshell.h"
+#include "qwaylandshell_p.h"
+
+#include <QtWaylandCompositor/QWaylandCompositor>
+#include <QtWaylandCompositor/QWaylandView>
+#include <QtWaylandCompositor/QWaylandOutput>
+#include <QtWaylandCompositor/QWaylandClient>
+
+#include <QtCore/QObject>
+#include <QtCore/QDebug>
+
+QT_BEGIN_NAMESPACE
+
+QWaylandShellPrivate::QWaylandShellPrivate()
+ : QWaylandExtensionTemplatePrivate()
+ , wl_shell()
+{
+}
+
+void QWaylandShellPrivate::shell_get_shell_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface_res)
+{
+ Q_Q(QWaylandShell);
+ QWaylandSurface *surface = QWaylandSurface::fromResource(surface_res);
+ QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(q->extensionContainer());
+ emit q_func()->createShellSurface(surface, QWaylandClient::fromWlClient(compositor, resource->client()), id);
+}
+
+QWaylandShellSurfacePrivate::QWaylandShellSurfacePrivate()
+ : QWaylandExtensionTemplatePrivate()
+ , wl_shell_surface()
+ , m_shell(Q_NULLPTR)
+ , m_surface(Q_NULLPTR)
+ , m_focusPolicy(QWaylandShellSurface::DefaultFocus)
+{
+}
+
+QWaylandShellSurfacePrivate::~QWaylandShellSurfacePrivate()
+{
+}
+
+void QWaylandShellSurfacePrivate::ping()
+{
+ uint32_t serial = m_surface->compositor()->nextSerial();
+ ping(serial);
+}
+
+void QWaylandShellSurfacePrivate::ping(uint32_t serial)
+{
+ m_pings.insert(serial);
+ send_ping(serial);
+}
+
+void QWaylandShellSurfacePrivate::shell_surface_destroy_resource(Resource *)
+{
+ Q_Q(QWaylandShellSurface);
+
+ delete q;
+}
+
+void QWaylandShellSurfacePrivate::shell_surface_move(Resource *resource,
+ struct wl_resource *input_device_super,
+ uint32_t serial)
+{
+ Q_UNUSED(resource);
+ Q_UNUSED(serial);
+
+ Q_Q(QWaylandShellSurface);
+ QWaylandInputDevice *input_device = QWaylandInputDevice::fromSeatResource(input_device_super);
+ emit q->startMove(input_device);
+}
+
+void QWaylandShellSurfacePrivate::shell_surface_resize(Resource *resource,
+ struct wl_resource *input_device_super,
+ uint32_t serial,
+ uint32_t edges)
+{
+ Q_UNUSED(resource);
+ Q_UNUSED(serial);
+ Q_Q(QWaylandShellSurface);
+
+ QWaylandInputDevice *input_device = QWaylandInputDevice::fromSeatResource(input_device_super);
+ emit q->startResize(input_device, QWaylandShellSurface::ResizeEdge(edges));
+}
+
+void QWaylandShellSurfacePrivate::shell_surface_set_toplevel(Resource *resource)
+{
+ Q_UNUSED(resource);
+ Q_Q(QWaylandShellSurface);
+ setFocusPolicy(QWaylandShellSurface::DefaultFocus);
+ emit q->setDefaultToplevel();
+}
+
+void QWaylandShellSurfacePrivate::shell_surface_set_transient(Resource *resource,
+ struct wl_resource *parent_surface_resource,
+ int x,
+ int y,
+ uint32_t flags)
+{
+
+ Q_UNUSED(resource);
+ Q_Q(QWaylandShellSurface);
+ QWaylandSurface *parent_surface = QWaylandSurface::fromResource(parent_surface_resource);
+ QWaylandShellSurface::FocusPolicy focusPolicy =
+ flags & WL_SHELL_SURFACE_TRANSIENT_INACTIVE ? QWaylandShellSurface::NoKeyboardFocus
+ : QWaylandShellSurface::DefaultFocus;
+ setFocusPolicy(focusPolicy);
+ emit q->setTransient(parent_surface, QPoint(x,y), focusPolicy);
+}
+
+void QWaylandShellSurfacePrivate::shell_surface_set_fullscreen(Resource *resource,
+ uint32_t method,
+ uint32_t framerate,
+ struct wl_resource *output_resource)
+{
+ Q_UNUSED(resource);
+ Q_UNUSED(method);
+ Q_UNUSED(framerate);
+ Q_Q(QWaylandShellSurface);
+ setFocusPolicy(QWaylandShellSurface::DefaultFocus);
+ QWaylandOutput *output = output_resource
+ ? QWaylandOutput::fromResource(output_resource)
+ : Q_NULLPTR;
+ emit q->setFullScreen(QWaylandShellSurface::FullScreenMethod(method), framerate, output);
+}
+
+void QWaylandShellSurfacePrivate::shell_surface_set_popup(Resource *resource, wl_resource *input_device, uint32_t serial, wl_resource *parent, int32_t x, int32_t y, uint32_t flags)
+{
+ Q_UNUSED(resource);
+ Q_UNUSED(serial);
+ Q_UNUSED(flags);
+ Q_Q(QWaylandShellSurface);
+ setFocusPolicy(QWaylandShellSurface::DefaultFocus);
+ QWaylandInputDevice *input = QWaylandInputDevice::fromSeatResource(input_device);
+ QWaylandSurface *parentSurface = QWaylandSurface::fromResource(parent);
+ emit q->setPopup(input, parentSurface, QPoint(x,y));
+
+}
+
+void QWaylandShellSurfacePrivate::shell_surface_set_maximized(Resource *resource,
+ struct wl_resource *output_resource)
+{
+ Q_UNUSED(resource);
+ Q_Q(QWaylandShellSurface);
+ setFocusPolicy(QWaylandShellSurface::DefaultFocus);
+ QWaylandOutput *output = output_resource
+ ? QWaylandOutput::fromResource(output_resource)
+ : Q_NULLPTR;
+ emit q->setMaximized(output);
+}
+
+void QWaylandShellSurfacePrivate::shell_surface_pong(Resource *resource,
+ uint32_t serial)
+{
+ Q_UNUSED(resource);
+ Q_Q(QWaylandShellSurface);
+ if (m_pings.remove(serial))
+ emit q->pong();
+ else
+ qWarning("Received an unexpected pong!");
+}
+
+void QWaylandShellSurfacePrivate::shell_surface_set_title(Resource *resource,
+ const QString &title)
+{
+ Q_UNUSED(resource);
+ if (title == m_title)
+ return;
+ Q_Q(QWaylandShellSurface);
+ m_title = title;
+ emit q->titleChanged();
+}
+
+void QWaylandShellSurfacePrivate::shell_surface_set_class(Resource *resource,
+ const QString &className)
+{
+ Q_UNUSED(resource);
+ if (className == m_className)
+ return;
+ Q_Q(QWaylandShellSurface);
+ m_className = className;
+ emit q->classNameChanged();
+}
+
+/*!
+ * \qmltype Shell
+ * \inqmlmodule QtWayland.Compositor
+ * \brief Extension for desktop-style user interfaces.
+ *
+ * The Shell extension provides a way to assiociate a \l{ShellSurface}
+ * with a regular Wayland surface. Using the shell surface interface, the client
+ * can request that the surface is resized, moved, and so on.
+ *
+ * Shell corresponds to the Wayland interface wl_shell.
+ *
+ * To provide the functionality of the shell extension in a compositor, create
+ * an instance of the Shell component and add it to the list of extensions
+ * supported by the compositor:
+ * \code
+ * import QtWayland.Compositor 1.0
+ *
+ * WaylandCompositor {
+ * extensions: Shell {
+ * // ...
+ * }
+ * }
+ * \endcode
+ */
+
+/*!
+ * \class QWaylandShell
+ * \inmodule QtWaylandCompositor
+ * \brief Extension for desktop-style user interfaces.
+ *
+ * The QWaylandShell extension provides a way to assiociate a QWaylandShellSurface with
+ * a regular Wayland surface. Using the shell surface interface, the client
+ * can request that the surface is resized, moved, and so on.
+ *
+ * Shell corresponds to the Wayland interface wl_shell.
+ */
+
+/*!
+ * Constructs a QWaylandShell object.
+ */
+QWaylandShell::QWaylandShell()
+ : QWaylandExtensionTemplate<QWaylandShell>(*new QWaylandShellPrivate())
+{ }
+
+/*!
+ * Constructs a QWaylandShell object for the provided \a compositor.
+ */
+QWaylandShell::QWaylandShell(QWaylandCompositor *compositor)
+ : QWaylandExtensionTemplate<QWaylandShell>(compositor, *new QWaylandShellPrivate())
+{ }
+
+
+/*!
+ * Initializes the shell extension.
+ */
+void QWaylandShell::initialize()
+{
+ Q_D(QWaylandShell);
+ QWaylandExtensionTemplate::initialize();
+ QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(extensionContainer());
+ if (!compositor) {
+ qWarning() << "Failed to find QWaylandCompositor when initializing QWaylandShell";
+ return;
+ }
+ d->init(compositor->display(), 1);
+}
+
+/*!
+ * Returns the Wayland interface for the QWaylandShell.
+ */
+const struct wl_interface *QWaylandShell::interface()
+{
+ return QWaylandShellPrivate::interface();
+}
+
+/*!
+ * \qmlsignal void QtWaylandCompositor::Shell::createShellSurface(object surface, object client, int id)
+ *
+ * This signal is emitted when the \a client has requested a shell surface to be associated
+ * with \a surface and be assigned the given \a id. The handler for this signal is
+ * expected to create the shell surface and initialize it within the scope of the
+ * signal emission.
+ */
+
+/*!
+ * \fn void QWaylandShell::createShellSurface(QWaylandSurface *surface, QWaylandClient *client, uint id)
+ *
+ * This signal is emitted when the \a client has requested a shell surface to be associated
+ * with \a surface and be assigned the given \a id. The handler for this signal is
+ * expected to create the shell surface and initialize it within the scope of the
+ * signal emission.
+ */
+
+/*!
+ * \internal
+ */
+QByteArray QWaylandShell::interfaceName()
+{
+ return QWaylandShellPrivate::interfaceName();
+}
+
+/*!
+ * \qmltype ShellSurface
+ * \inqmlmodule QtWayland.Compositor
+ * \brief A shell surface providing desktop-style compositor-specific features to a surface.
+ *
+ * This type is part of the \l{Shell} extension and provides a way to extend
+ * the functionality of an existing WaylandSurface with features specific to desktop-style
+ * compositors, such as resizing and moving the surface.
+ *
+ * It corresponds to the Wayland interface wl_shell_surface.
+ */
+
+/*!
+ * \class QWaylandShellSurface
+ * \inmodule QtWaylandCompositor
+ * \brief A shell surface providing desktop-style compositor-specific features to a surface.
+ *
+ * This class is part of the QWaylandShell extension and provides a way to extend
+ * the functionality of an existing QWaylandSurface with features specific to desktop-style
+ * compositors, such as resizing and moving the surface.
+ *
+ * It corresponds to the Wayland interface wl_shell_surface.
+ */
+
+/*!
+ * Constructs a QWaylandShellSurface.
+ */
+QWaylandShellSurface::QWaylandShellSurface()
+ : QWaylandExtensionTemplate<QWaylandShellSurface>(*new QWaylandShellSurfacePrivate)
+{
+}
+
+/*!
+ * Constructs a QWaylandShellSurface for \a surface and initializes it with the given \a shell, \a client,
+ * and \a id.
+ */
+QWaylandShellSurface::QWaylandShellSurface(QWaylandShell *shell, QWaylandSurface *surface, QWaylandClient *client, uint id)
+ : QWaylandExtensionTemplate<QWaylandShellSurface>(*new QWaylandShellSurfacePrivate)
+{
+ initialize(shell, surface, client, id);
+}
+
+/*!
+ * \qmlmethod void QtWaylandCompositor::ShellSurface::initialize(object shell, object surface, object client, int id)
+ *
+ * Initializes the ShellSurface, associating it with the given \a shell, \a surface, \a client, and \a id.
+ */
+
+/*!
+ * Initializes the QWaylandShellSurface, associating it with the given \a shell, \a surface, \a client, and \a id.
+ */
+void QWaylandShellSurface::initialize(QWaylandShell *shell, QWaylandSurface *surface, QWaylandClient *client, uint id)
+{
+ Q_D(QWaylandShellSurface);
+ d->m_shell = shell;
+ d->m_surface = surface;
+ d->init(client->client(), id, 1);
+ setExtensionContainer(surface);
+ emit surfaceChanged();
+ QWaylandExtension::initialize();
+}
+
+/*!
+ * \internal
+ */
+void QWaylandShellSurface::initialize()
+{
+ QWaylandExtensionTemplate::initialize();
+}
+
+const struct wl_interface *QWaylandShellSurface::interface()
+{
+ return QWaylandShellSurfacePrivate::interface();
+}
+
+/*!
+ * \internal
+ */
+QByteArray QWaylandShellSurface::interfaceName()
+{
+ return QWaylandShellSurfacePrivate::interfaceName();
+}
+
+QSize QWaylandShellSurface::sizeForResize(const QSizeF &size, const QPointF &delta, QWaylandShellSurface::ResizeEdge edge)
+{
+ qreal width = size.width();
+ qreal height = size.height();
+ if (edge & LeftEdge)
+ width -= delta.x();
+ else if (edge & RightEdge)
+ width += delta.x();
+
+ if (edge & TopEdge)
+ height -= delta.y();
+ else if (edge & BottomEdge)
+ height += delta.y();
+
+ return QSizeF(width, height).toSize();
+}
+
+/*!
+ * \enum QWaylandShellSurface::ResizeEdge
+ *
+ * This enum type provides a way to specify a specific edge or corner of
+ * the surface.
+ *
+ * \value DefaultEdge The default edge.
+ * \value TopEdge The top edge.
+ * \value BottomEdge The bottom edge.
+ * \value LeftEdge The left edge.
+ * \value TopLeftEdge The top left corner.
+ * \value BottomLeftEdge The bottom left corner.
+ * \value RightEdge The right edge.
+ * \value TopRightEdge The top right corner.
+ * \value BottomRightEdge The bottom right corner.
+ */
+
+/*!
+ * \qmlmethod void QtWaylandCompositor::ShellSurface::sendConfigure(size size, enum edges)
+ *
+ * Sends a configure event to the client, suggesting that it resize its surface to
+ * the provided \a size. The \a edges provide a hint about how the surface
+ * was resized.
+ */
+
+/*!
+ * Sends a configure event to the client, suggesting that it resize its surface to
+ * the provided \a size. The \a edges provide a hint about how the surface
+ * was resized.
+ */
+void QWaylandShellSurface::sendConfigure(const QSize &size, ResizeEdge edges)
+{
+ Q_D(QWaylandShellSurface);
+ d->send_configure(edges, size.width(), size.height());
+}
+
+/*!
+ * \qmlmethod void QtWaylandCompositor::ShellSurface::sendPopupDone()
+ *
+ * Sends a popup_done event to the client to indicate that the user has clicked
+ * somewhere outside the client's surfaces.
+ */
+
+/*!
+ * Sends a popup_done event to the client to indicate that the user has clicked
+ * somewhere outside the client's surfaces.
+ */
+void QWaylandShellSurface::sendPopupDone()
+{
+ Q_D(QWaylandShellSurface);
+ d->send_popup_done();
+}
+
+/*!
+ * \qmlproperty object QtWaylandCompositor::ShellSurface::surface
+ *
+ * This property holds the surface associated with this ShellSurface.
+ */
+
+/*!
+ * \property QWaylandShellSurface::surface
+ *
+ * This property holds the surface associated with this QWaylandShellSurface.
+ */
+QWaylandSurface *QWaylandShellSurface::surface() const
+{
+ Q_D(const QWaylandShellSurface);
+ return d->m_surface;
+}
+
+/*!
+ * \enum QWaylandShellSurface::FocusPolicy
+ *
+ * This enum type is used to specify the focus policy of a shell surface.
+ *
+ * \value DefaultFocus The default focus policy should be used.
+ * \value NoKeyboardFocus The shell surface should not get keyboard focus.
+ */
+
+/*!
+ * \qmlproperty enum QtWaylandCompositor::ShellSurface::focusPolicy
+ *
+ * This property holds the focus policy of the ShellSurface.
+ */
+
+/*!
+ * \property QWaylandShellSurface::focusPolicy
+ *
+ * This property holds the focus policy of the QWaylandShellSurface.
+ */
+QWaylandShellSurface::FocusPolicy QWaylandShellSurface::focusPolicy() const
+{
+ Q_D(const QWaylandShellSurface);
+ return d->m_focusPolicy;
+}
+
+/*!
+ * \qmlproperty string QtWaylandCompositor::ShellSurface::title
+ *
+ * This property holds the title of the ShellSurface.
+ */
+
+/*!
+ * \property QWaylandShellSurface::title
+ *
+ * This property holds the title of the QWaylandShellSurface.
+ */
+QString QWaylandShellSurface::title() const
+{
+ Q_D(const QWaylandShellSurface);
+ return d->m_title;
+}
+
+/*!
+ * \qmlproperty string QtWaylandCompositor::ShellSurface::className
+ *
+ * This property holds the class name of the ShellSurface.
+ */
+
+/*!
+ * \property QWaylandShellSurface::className
+ *
+ * This property holds the class name of the QWaylandShellSurface.
+ */
+QString QWaylandShellSurface::className() const
+{
+ Q_D(const QWaylandShellSurface);
+ return d->m_className;
+}
+
+QT_END_NAMESPACE
diff --git a/src/compositor/extensions/qwaylandshell.h b/src/compositor/extensions/qwaylandshell.h
new file mode 100644
index 000000000..3794a11da
--- /dev/null
+++ b/src/compositor/extensions/qwaylandshell.h
@@ -0,0 +1,146 @@
+/****************************************************************************
+**
+** 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 QWAYLANDSHELL_H
+#define QWAYLANDSHELL_H
+
+#include <QtWaylandCompositor/QWaylandExtension>
+
+#include <QtCore/QSize>
+
+QT_BEGIN_NAMESPACE
+
+class QWaylandShellPrivate;
+class QWaylandShellSurfacePrivate;
+class QWaylandSurface;
+class QWaylandClient;
+class QWaylandInputDevice;
+class QWaylandOutput;
+
+class Q_COMPOSITOR_EXPORT QWaylandShell : public QWaylandExtensionTemplate<QWaylandShell>
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QWaylandShell)
+public:
+ QWaylandShell();
+ QWaylandShell(QWaylandCompositor *compositor);
+
+ void initialize() Q_DECL_OVERRIDE;
+
+ static const struct wl_interface *interface();
+ static QByteArray interfaceName();
+
+Q_SIGNALS:
+ void createShellSurface(QWaylandSurface *surface, QWaylandClient *client, uint id);
+};
+
+class Q_COMPOSITOR_EXPORT QWaylandShellSurface : public QWaylandExtensionTemplate<QWaylandShellSurface>
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QWaylandShellSurface)
+ Q_PROPERTY(QWaylandSurface *surface READ surface NOTIFY surfaceChanged)
+ Q_PROPERTY(QString title READ title NOTIFY titleChanged)
+ Q_PROPERTY(QString className READ className NOTIFY classNameChanged)
+ Q_PROPERTY(FocusPolicy focusPolicy READ focusPolicy NOTIFY focusPolicyChanged)
+
+public:
+ enum FullScreenMethod {
+ DefaultFullScreen,
+ ScaleFullScreen,
+ DriverFullScreen,
+ FillFullScreen
+ };
+ Q_ENUM(FullScreenMethod);
+
+ enum ResizeEdge {
+ DefaultEdge = 0,
+ TopEdge = 1,
+ BottomEdge = 2,
+ LeftEdge = 4,
+ TopLeftEdge = 5,
+ BottomLeftEdge = 6,
+ RightEdge = 8,
+ TopRightEdge = 9,
+ BottomRightEdge = 10
+ };
+ Q_ENUM(ResizeEdge);
+
+ enum FocusPolicy{
+ DefaultFocus,
+ NoKeyboardFocus
+ };
+ Q_ENUM(FocusPolicy)
+
+ QWaylandShellSurface();
+ QWaylandShellSurface(QWaylandShell *shell, QWaylandSurface *surface, QWaylandClient *client, uint id);
+
+ Q_INVOKABLE void initialize(QWaylandShell *shell, QWaylandSurface *surface, QWaylandClient *client, uint id);
+
+ QString title() const;
+ QString className() const;
+
+ QWaylandSurface *surface() const;
+
+ FocusPolicy focusPolicy() const;
+
+ static const struct wl_interface *interface();
+ static QByteArray interfaceName();
+
+ Q_INVOKABLE QSize sizeForResize(const QSizeF &size, const QPointF &delta, ResizeEdge edges);
+ Q_INVOKABLE void sendConfigure(const QSize &size, ResizeEdge edges);
+ Q_INVOKABLE void sendPopupDone();
+Q_SIGNALS:
+ void surfaceChanged();
+ void titleChanged();
+ void classNameChanged();
+ void focusPolicyChanged();
+ void pong();
+ void startMove(QWaylandInputDevice *inputDevice);
+ void startResize(QWaylandInputDevice *inputDevice, ResizeEdge edges);
+
+ void setDefaultToplevel();
+ void setTransient(QWaylandSurface *parentSurface, const QPoint &relativeToParent, FocusPolicy focusPolicy);
+ void setFullScreen(FullScreenMethod method, uint framerate, QWaylandOutput *output);
+ void setPopup(QWaylandInputDevice *inputDevice, QWaylandSurface *parentSurface, const QPoint &relativeToParent);
+ void setMaximized(QWaylandOutput *output);
+
+private:
+ void initialize();
+};
+
+QT_END_NAMESPACE
+
+#endif /*QWAYLANDSHELL_H*/
diff --git a/src/compositor/extensions/qwaylandshell_p.h b/src/compositor/extensions/qwaylandshell_p.h
new file mode 100644
index 000000000..27dbb335a
--- /dev/null
+++ b/src/compositor/extensions/qwaylandshell_p.h
@@ -0,0 +1,150 @@
+/****************************************************************************
+**
+** 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 QWAYLANDSHELL_P_H
+#define QWAYLANDSHELL_P_H
+
+#include <QtWaylandCompositor/qwaylandexport.h>
+#include <QtWaylandCompositor/qwaylandsurface.h>
+#include <QtWaylandCompositor/private/qwaylandextension_p.h>
+#include <QtWaylandCompositor/QWaylandShellSurface>
+#include <QtWaylandCompositor/QWaylandInputDevice>
+
+#include <wayland-server.h>
+#include <QHash>
+#include <QPoint>
+#include <QSet>
+
+#include <QtWaylandCompositor/private/qwayland-server-wayland.h>
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QT_BEGIN_NAMESPACE
+
+class Q_COMPOSITOR_EXPORT QWaylandShellPrivate
+ : public QWaylandExtensionTemplatePrivate
+ , public QtWaylandServer::wl_shell
+{
+ Q_DECLARE_PUBLIC(QWaylandShell)
+public:
+ QWaylandShellPrivate();
+ static QWaylandShellPrivate *get(QWaylandShell *shell) { return shell->d_func(); }
+
+protected:
+ void shell_get_shell_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface) Q_DECL_OVERRIDE;
+};
+
+class Q_COMPOSITOR_EXPORT QWaylandShellSurfacePrivate
+ : public QWaylandExtensionTemplatePrivate
+ , public QtWaylandServer::wl_shell_surface
+{
+ Q_DECLARE_PUBLIC(QWaylandShellSurface)
+public:
+ QWaylandShellSurfacePrivate();
+ ~QWaylandShellSurfacePrivate();
+
+ static QWaylandShellSurfacePrivate *get(QWaylandShellSurface *surface) { return surface->d_func(); }
+
+ void ping();
+ void ping(uint32_t serial);
+
+ void setFocusPolicy(QWaylandShellSurface::FocusPolicy focusPolicy)
+ {
+ if (focusPolicy == m_focusPolicy)
+ return;
+ Q_Q(QWaylandShellSurface);
+ m_focusPolicy = focusPolicy;
+ emit q->focusPolicyChanged();
+ }
+private:
+ QWaylandShell *m_shell;
+ QWaylandSurface *m_surface;
+
+ QSet<uint32_t> m_pings;
+
+ QString m_title;
+ QString m_className;
+ QWaylandShellSurface::FocusPolicy m_focusPolicy;
+
+ void shell_surface_destroy_resource(Resource *resource) Q_DECL_OVERRIDE;
+
+ void shell_surface_move(Resource *resource,
+ struct wl_resource *input_device_super,
+ uint32_t time) Q_DECL_OVERRIDE;
+ void shell_surface_resize(Resource *resource,
+ struct wl_resource *input_device,
+ uint32_t time,
+ uint32_t edges) Q_DECL_OVERRIDE;
+ void shell_surface_set_toplevel(Resource *resource) Q_DECL_OVERRIDE;
+ void shell_surface_set_transient(Resource *resource,
+ struct wl_resource *parent_surface_resource,
+ int x,
+ int y,
+ uint32_t flags) Q_DECL_OVERRIDE;
+ void shell_surface_set_fullscreen(Resource *resource,
+ uint32_t method,
+ uint32_t framerate,
+ struct wl_resource *output_resource) Q_DECL_OVERRIDE;
+ void shell_surface_set_popup(Resource *resource,
+ struct wl_resource *input_device,
+ uint32_t time,
+ struct wl_resource *parent,
+ int32_t x,
+ int32_t y,
+ uint32_t flags) Q_DECL_OVERRIDE;
+ void shell_surface_set_maximized(Resource *resource,
+ struct wl_resource *output_resource) Q_DECL_OVERRIDE;
+ void shell_surface_pong(Resource *resource,
+ uint32_t serial) Q_DECL_OVERRIDE;
+ void shell_surface_set_title(Resource *resource,
+ const QString &title) Q_DECL_OVERRIDE;
+ void shell_surface_set_class(Resource *resource,
+ const QString &class_) Q_DECL_OVERRIDE;
+
+};
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDSHELL_P_H
diff --git a/src/compositor/extensions/qwaylandwindowmanagerextension.cpp b/src/compositor/extensions/qwaylandwindowmanagerextension.cpp
new file mode 100644
index 000000000..9050610d8
--- /dev/null
+++ b/src/compositor/extensions/qwaylandwindowmanagerextension.cpp
@@ -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$
+**
+****************************************************************************/
+
+#include "qwaylandwindowmanagerextension.h"
+#include "qwaylandwindowmanagerextension_p.h"
+
+#include <QtWaylandCompositor/QWaylandCompositor>
+#include <QtWaylandCompositor/QWaylandClient>
+
+#include <QtCore/QUrl>
+
+QT_BEGIN_NAMESPACE
+
+QWaylandWindowManagerExtension::QWaylandWindowManagerExtension(QWaylandCompositor *compositor)
+ : QWaylandExtensionTemplate(compositor, *new QWaylandWindowManagerExtensionPrivate(compositor))
+{
+}
+
+QWaylandWindowManagerExtensionPrivate::QWaylandWindowManagerExtensionPrivate(QWaylandCompositor *compositor)
+ : QWaylandExtensionTemplatePrivate()
+ , m_showIsFullScreen(false)
+ , m_compositor(compositor)
+{
+ init(compositor->display(), 1);
+}
+
+void QWaylandWindowManagerExtension::setShowIsFullScreen(bool value)
+{
+ Q_D(QWaylandWindowManagerExtension);
+ d->m_showIsFullScreen = value;
+ Q_FOREACH (QWaylandWindowManagerExtensionPrivate::Resource *resource, d->resourceMap().values()) {
+ d->send_hints(resource->handle, static_cast<int32_t>(d->m_showIsFullScreen));
+ }
+}
+
+void QWaylandWindowManagerExtension::sendQuitMessage(wl_client *client)
+{
+ Q_D(QWaylandWindowManagerExtension);
+ QWaylandWindowManagerExtensionPrivate::Resource *resource = d->resourceMap().value(client);
+
+ if (resource)
+ d->send_quit(resource->handle);
+}
+
+void QWaylandWindowManagerExtensionPrivate::windowmanager_bind_resource(Resource *resource)
+{
+ send_hints(resource->handle, static_cast<int32_t>(m_showIsFullScreen));
+}
+
+void QWaylandWindowManagerExtensionPrivate::windowmanager_destroy_resource(Resource *resource)
+{
+ m_urls.remove(resource);
+}
+
+void QWaylandWindowManagerExtensionPrivate::windowmanager_open_url(Resource *resource, uint32_t remaining, const QString &newUrl)
+{
+ Q_Q(QWaylandWindowManagerExtension);
+ QString url = m_urls.value(resource, QString());
+
+ url.append(newUrl);
+
+ if (remaining)
+ m_urls.insert(resource, url);
+ else {
+ m_urls.remove(resource);
+ q->openUrl(QWaylandClient::fromWlClient(m_compositor, resource->client()), QUrl(url));
+ }
+}
+
+const struct wl_interface *QWaylandWindowManagerExtension::interface()
+{
+ return QWaylandWindowManagerExtensionPrivate::interface();
+}
+
+QByteArray QWaylandWindowManagerExtension::interfaceName()
+{
+ return QWaylandWindowManagerExtensionPrivate::interfaceName();
+}
+
+
+QT_END_NAMESPACE
diff --git a/src/compositor/extensions/qwaylandwindowmanagerextension.h b/src/compositor/extensions/qwaylandwindowmanagerextension.h
new file mode 100644
index 000000000..48fcbef3e
--- /dev/null
+++ b/src/compositor/extensions/qwaylandwindowmanagerextension.h
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** 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 WAYLANDWINDOWMANAGERINTEGRATION_H
+#define WAYLANDWINDOWMANAGERINTEGRATION_H
+
+#include <QtWaylandCompositor/qwaylandextension.h>
+#include <QtWaylandCompositor/QWaylandClient>
+
+#include <QtCore/QUrl>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWayland {
+ class Display;
+}
+
+class QWaylandCompositor;
+
+class QWaylandWindowManagerExtensionPrivate;
+
+class Q_COMPOSITOR_EXPORT QWaylandWindowManagerExtension : public QWaylandExtensionTemplate<QWaylandWindowManagerExtension>
+{
+ Q_OBJECT
+ Q_DECLARE_PRIVATE(QWaylandWindowManagerExtension)
+public:
+ explicit QWaylandWindowManagerExtension(QWaylandCompositor *compositor);
+
+ void setShowIsFullScreen(bool value);
+ void sendQuitMessage(wl_client *client);
+
+ static const struct wl_interface *interface();
+ static QByteArray interfaceName();
+Q_SIGNALS:
+ void openUrl(QWaylandClient *client, const QUrl &url);
+};
+
+QT_END_NAMESPACE
+
+#endif // WAYLANDWINDOWMANAGERINTEGRATION_H
diff --git a/src/compositor/extensions/qwaylandwindowmanagerextension_p.h b/src/compositor/extensions/qwaylandwindowmanagerextension_p.h
new file mode 100644
index 000000000..bbce28623
--- /dev/null
+++ b/src/compositor/extensions/qwaylandwindowmanagerextension_p.h
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** 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 QWAYLANDWINDOWMANAGEREXTENSION_P_H
+#define QWAYLANDWINDOWMANAGEREXTENSION_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtWaylandCompositor/private/qwaylandextension_p.h>
+
+#include <QtWaylandCompositor/private/qwayland-server-windowmanager.h>
+
+#include <QMap>
+
+QT_BEGIN_NAMESPACE
+
+class Q_COMPOSITOR_EXPORT QWaylandWindowManagerExtensionPrivate : public QWaylandExtensionTemplatePrivate, public QtWaylandServer::qt_windowmanager
+{
+ Q_DECLARE_PUBLIC(QWaylandWindowManagerExtension)
+public:
+ QWaylandWindowManagerExtensionPrivate(QWaylandCompositor *compositor);
+
+protected:
+ void windowmanager_bind_resource(Resource *resource) Q_DECL_OVERRIDE;
+ void windowmanager_destroy_resource(Resource *resource) Q_DECL_OVERRIDE;
+ void windowmanager_open_url(Resource *resource, uint32_t remaining, const QString &url) Q_DECL_OVERRIDE;
+private:
+ bool m_showIsFullScreen;
+ QWaylandCompositor *m_compositor;
+ QMap<Resource*, QString> m_urls;
+};
+
+QT_END_NAMESPACE
+
+#endif /*QWAYLANDWINDOWMANAGEREXTENSION_P_H*/
diff --git a/src/compositor/extensions/qwlextendedsurface.cpp b/src/compositor/extensions/qwlextendedsurface.cpp
new file mode 100644
index 000000000..f619ec339
--- /dev/null
+++ b/src/compositor/extensions/qwlextendedsurface.cpp
@@ -0,0 +1,185 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#include "qwlextendedsurface_p.h"
+
+#include <QtWaylandCompositor/QWaylandCompositor>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWayland {
+
+SurfaceExtensionGlobal::SurfaceExtensionGlobal(QWaylandCompositor *compositor)
+ : QWaylandExtensionTemplate(compositor)
+ , QtWaylandServer::qt_surface_extension(compositor->display(), 1)
+{
+}
+
+void SurfaceExtensionGlobal::surface_extension_get_extended_surface(Resource *resource,
+ uint32_t id,
+ struct wl_resource *surface_resource)
+{
+ QWaylandSurface *surface = QWaylandSurface::fromResource(surface_resource);
+ ExtendedSurface *extSurface = new ExtendedSurface(resource->client(),id, wl_resource_get_version(resource->handle), surface);
+ emit extendedSurfaceReady(extSurface, surface);
+}
+
+ExtendedSurface::ExtendedSurface(struct wl_client *client, uint32_t id, int version, QWaylandSurface *surface)
+ : QWaylandExtensionTemplate(surface)
+ , QtWaylandServer::qt_extended_surface(client, id, version)
+ , m_surface(surface)
+ , m_windowFlags(0)
+{
+}
+
+ExtendedSurface::~ExtendedSurface()
+{
+}
+
+void ExtendedSurface::sendGenericProperty(const QString &name, const QVariant &variant)
+{
+ QByteArray byteValue;
+ QDataStream ds(&byteValue, QIODevice::WriteOnly);
+ ds << variant;
+ send_set_generic_property(name, byteValue);
+
+}
+
+void ExtendedSurface::sendOnScreenVisibilityChange(bool onScreen)
+{
+ setVisibility(onScreen ? QWindow::AutomaticVisibility : QWindow::Hidden);
+}
+
+void ExtendedSurface::setVisibility(QWindow::Visibility visibility)
+{
+ send_onscreen_visibility(visibility);
+}
+
+void ExtendedSurface::setParentSurface(QWaylandSurface *surface)
+{
+ m_surface = surface;
+}
+
+void ExtendedSurface::extended_surface_update_generic_property(Resource *resource,
+ const QString &name,
+ struct wl_array *value)
+{
+ Q_UNUSED(resource);
+ QVariant variantValue;
+ QByteArray byteValue((const char*)value->data, value->size);
+ QDataStream ds(&byteValue, QIODevice::ReadOnly);
+ ds >> variantValue;
+ setWindowPropertyImpl(name,variantValue);
+}
+
+Qt::ScreenOrientations ExtendedSurface::contentOrientationMask() const
+{
+ return m_contentOrientationMask;
+}
+
+void ExtendedSurface::extended_surface_set_content_orientation_mask(Resource *resource, int32_t orientation)
+{
+ Q_UNUSED(resource);
+ Qt::ScreenOrientations mask = 0;
+ if (orientation & QT_EXTENDED_SURFACE_ORIENTATION_PORTRAITORIENTATION)
+ mask |= Qt::PortraitOrientation;
+ if (orientation & QT_EXTENDED_SURFACE_ORIENTATION_LANDSCAPEORIENTATION)
+ mask |= Qt::LandscapeOrientation;
+ if (orientation & QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDPORTRAITORIENTATION)
+ mask |= Qt::InvertedPortraitOrientation;
+ if (orientation & QT_EXTENDED_SURFACE_ORIENTATION_INVERTEDLANDSCAPEORIENTATION)
+ mask |= Qt::InvertedLandscapeOrientation;
+ if (orientation & QT_EXTENDED_SURFACE_ORIENTATION_PRIMARYORIENTATION)
+ mask |= Qt::PrimaryOrientation;
+
+ Qt::ScreenOrientations oldMask = m_contentOrientationMask;
+ m_contentOrientationMask = mask;
+
+ if (mask != oldMask)
+ emit contentOrientationMaskChanged();
+}
+
+QVariantMap ExtendedSurface::windowProperties() const
+{
+ return m_windowProperties;
+}
+
+QVariant ExtendedSurface::windowProperty(const QString &propertyName) const
+{
+ QVariantMap props = m_windowProperties;
+ return props.value(propertyName);
+}
+
+void ExtendedSurface::setWindowProperty(const QString &name, const QVariant &value)
+{
+ setWindowPropertyImpl(name,value);
+ sendGenericProperty(name, value);
+}
+
+void ExtendedSurface::setWindowPropertyImpl(const QString &name, const QVariant &value)
+{
+ m_windowProperties.insert(name, value);
+ emit windowPropertyChanged(name,value);
+}
+
+void ExtendedSurface::extended_surface_set_window_flags(Resource *resource, int32_t flags)
+{
+ Q_UNUSED(resource);
+ WindowFlags windowFlags(flags);
+ if (windowFlags == m_windowFlags)
+ return;
+ m_windowFlags = windowFlags;
+ emit windowFlagsChanged();
+}
+
+void ExtendedSurface::extended_surface_destroy_resource(Resource *)
+{
+ delete this;
+}
+
+void ExtendedSurface::extended_surface_raise(Resource *)
+{
+ emit raiseRequested();
+}
+
+void ExtendedSurface::extended_surface_lower(Resource *)
+{
+ emit lowerRequested();
+}
+
+}
+
+QT_END_NAMESPACE
diff --git a/src/compositor/extensions/qwlextendedsurface_p.h b/src/compositor/extensions/qwlextendedsurface_p.h
new file mode 100644
index 000000000..03b3b43b1
--- /dev/null
+++ b/src/compositor/extensions/qwlextendedsurface_p.h
@@ -0,0 +1,161 @@
+/****************************************************************************
+**
+** 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 WLEXTENDEDSURFACE_H
+#define WLEXTENDEDSURFACE_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <wayland-server.h>
+
+#include <QtWaylandCompositor/private/qwayland-server-surface-extension.h>
+#include <QtWaylandCompositor/qwaylandsurface.h>
+#include <QtWaylandCompositor/qwaylandextension.h>
+
+#include <QtCore/QVariant>
+#include <QtCore/QLinkedList>
+#include <QtGui/QWindow>
+
+QT_BEGIN_NAMESPACE
+
+class QWaylandCompositor;
+class QWaylandSurface;
+
+namespace QtWayland {
+
+class ExtendedSurface;
+
+class Q_COMPOSITOR_EXPORT SurfaceExtensionGlobal : public QWaylandExtensionTemplate<SurfaceExtensionGlobal>, public QtWaylandServer::qt_surface_extension
+{
+ Q_OBJECT
+public:
+ SurfaceExtensionGlobal(QWaylandCompositor *compositor);
+
+Q_SIGNALS:
+ void extendedSurfaceReady(ExtendedSurface *extSurface, QWaylandSurface *surface);
+
+private:
+ void surface_extension_get_extended_surface(Resource *resource,
+ uint32_t id,
+ struct wl_resource *surface);
+
+};
+
+class Q_COMPOSITOR_EXPORT ExtendedSurface : public QWaylandExtensionTemplate<ExtendedSurface>, public QtWaylandServer::qt_extended_surface
+{
+ Q_OBJECT
+ Q_PROPERTY(Qt::ScreenOrientations contentOrientationMask READ contentOrientationMask NOTIFY contentOrientationMaskChanged)
+ Q_PROPERTY(WindowFlags windowFlags READ windowFlags NOTIFY windowFlagsChanged)
+ Q_FLAGS(WindowFlag WindowFlags)
+public:
+ enum WindowFlag {
+ OverridesSystemGestures = 0x0001,
+ StaysOnTop = 0x0002,
+ BypassWindowManager = 0x0004
+ };
+ Q_DECLARE_FLAGS(WindowFlags, WindowFlag)
+
+ ExtendedSurface(struct wl_client *client, uint32_t id, int version, QWaylandSurface *surface);
+ ~ExtendedSurface();
+
+ void sendGenericProperty(const QString &name, const QVariant &variant);
+
+ void sendOnScreenVisibilityChange(bool onScreen);
+ void setVisibility(QWindow::Visibility visibility);
+
+ void setSubSurface(ExtendedSurface *subSurface,int x, int y);
+ void removeSubSurface(ExtendedSurface *subSurfaces);
+ ExtendedSurface *parent() const;
+ void setParent(ExtendedSurface *parent);
+ QLinkedList<QWaylandSurface *> subSurfaces() const;
+ void setParentSurface(QWaylandSurface *s);
+
+ Qt::ScreenOrientations contentOrientationMask() const;
+
+ WindowFlags windowFlags() const { return m_windowFlags; }
+
+ QVariantMap windowProperties() const;
+ QVariant windowProperty(const QString &propertyName) const;
+ void setWindowProperty(const QString &name, const QVariant &value);
+
+Q_SIGNALS:
+ void contentOrientationMaskChanged();
+ void windowFlagsChanged();
+ void windowPropertyChanged(const QString &name, const QVariant &value);
+ void raiseRequested();
+ void lowerRequested();
+
+private:
+ void setWindowPropertyImpl(const QString &name, const QVariant &value);
+
+ QWaylandSurface *m_surface;
+
+ Qt::ScreenOrientations m_contentOrientationMask;
+
+ WindowFlags m_windowFlags;
+
+ QByteArray m_authenticationToken;
+ QVariantMap m_windowProperties;
+
+ void extended_surface_update_generic_property(Resource *resource,
+ const QString &name,
+ struct wl_array *value) Q_DECL_OVERRIDE;
+
+ void extended_surface_set_content_orientation_mask(Resource *resource,
+ int32_t orientation) Q_DECL_OVERRIDE;
+
+ void extended_surface_set_window_flags(Resource *resource,
+ int32_t flags) Q_DECL_OVERRIDE;
+
+ void extended_surface_destroy_resource(Resource *) Q_DECL_OVERRIDE;
+ void extended_surface_raise(Resource *) Q_DECL_OVERRIDE;
+ void extended_surface_lower(Resource *) Q_DECL_OVERRIDE;
+};
+
+}
+
+QT_END_NAMESPACE
+
+#endif // WLEXTENDEDSURFACE_H
diff --git a/src/compositor/extensions/qwlinputmethod.cpp b/src/compositor/extensions/qwlinputmethod.cpp
new file mode 100644
index 000000000..6cf23bcb1
--- /dev/null
+++ b/src/compositor/extensions/qwlinputmethod.cpp
@@ -0,0 +1,152 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
+** 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$
+**
+****************************************************************************/
+
+#include "qwlinputmethod_p.h"
+
+#include <QtWaylandCompositor/QWaylandCompositor>
+#include <QtWaylandCompositor/QWaylandKeyboard>
+#include <QtWaylandCompositor/QWaylandInputDevice>
+#include "qwlinputmethodcontext_p.h"
+#include "qwlinputpanel_p.h"
+#include "qwltextinput_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWayland {
+
+InputMethod::InputMethod(QWaylandInputDevice *seat)
+ : QWaylandExtensionTemplate<InputMethod>(seat)
+ , QtWaylandServer::wl_input_method(seat->compositor()->display(), 1)
+ , m_seat(seat)
+ , m_resource(0)
+ , m_textInput()
+ , m_context()
+{
+ connect(seat->keyboard(), &QWaylandKeyboard::focusChanged, this, &InputMethod::focusChanged);
+}
+
+InputMethod::~InputMethod()
+{
+}
+
+void InputMethod::activate(TextInput *textInput)
+{
+ if (!m_resource) {
+ qDebug("Cannot activate (no input method running).");
+ return;
+ }
+
+ if (m_textInput) {
+ Q_ASSERT(m_textInput != textInput);
+ m_textInput->deactivate(this);
+ }
+ m_textInput = textInput;
+ m_context = new InputMethodContext(m_resource->client(), textInput);
+
+ send_activate(m_resource->handle, m_context->resource()->handle);
+
+ QWaylandInputPanelPrivate *panel = QWaylandInputPanelPrivate::findIn(compositor());
+ if (panel) {
+ panel->setFocus(textInput->focus());
+ panel->setCursorRectangle(textInput->cursorRectangle());
+ panel->setInputPanelVisible(textInput->inputPanelVisible());
+ }
+}
+
+void InputMethod::deactivate()
+{
+ if (!m_resource) {
+ qDebug("Cannot deactivate (no input method running).");
+ return;
+ }
+
+ send_deactivate(m_resource->handle, m_context->resource()->handle);
+ m_textInput = 0;
+ m_context = 0;
+
+ QWaylandInputPanelPrivate *panel = QWaylandInputPanelPrivate::findIn(compositor());
+ if (panel) {
+ panel->setFocus(0);
+ panel->setCursorRectangle(QRect());
+ panel->setInputPanelVisible(false);
+ }
+}
+
+void InputMethod::focusChanged(QWaylandSurface *surface)
+{
+ if (!m_textInput)
+ return;
+
+ if (!surface || m_textInput->focus() != surface) {
+ m_textInput->deactivate(this);
+ }
+}
+
+bool InputMethod::isBound() const
+{
+ return m_resource != 0;
+}
+
+InputMethodContext *InputMethod::context() const
+{
+ return m_context;
+}
+
+TextInput *InputMethod::textInput() const
+{
+ return m_textInput;
+}
+
+void InputMethod::input_method_bind_resource(Resource *resource)
+{
+ if (m_resource) {
+ wl_resource_post_error(resource->handle, WL_DISPLAY_ERROR_INVALID_OBJECT, "interface object already bound");
+ wl_resource_destroy(resource->handle);
+ return;
+ }
+
+ m_resource = resource;
+}
+
+void InputMethod::input_method_destroy_resource(Resource *resource)
+{
+ Q_ASSERT(resource == m_resource);
+ m_resource = 0;
+}
+
+} // namespace QtWayland
+
+QT_END_NAMESPACE
diff --git a/src/compositor/extensions/qwlinputmethod_p.h b/src/compositor/extensions/qwlinputmethod_p.h
new file mode 100644
index 000000000..69348df6c
--- /dev/null
+++ b/src/compositor/extensions/qwlinputmethod_p.h
@@ -0,0 +1,105 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
+** 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 QTWAYLAND_QWLINPUTMETHOD_H
+#define QTWAYLAND_QWLINPUTMETHOD_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtWaylandCompositor/private/qwayland-server-input-method.h>
+#include <QtWaylandCompositor/QWaylandExtension>
+#include <QtWaylandCompositor/QWaylandInputDevice>
+
+#include <QObject>
+#include <QScopedPointer>
+
+#include <QtWaylandCompositor/QWaylandSurface>
+
+QT_BEGIN_NAMESPACE
+
+class QWaylandInputDevice;
+class QWaylandCompositor;
+
+namespace QtWayland {
+
+class InputMethodContext;
+class TextInput;
+
+class InputMethod : public QWaylandExtensionTemplate<InputMethod> , public QtWaylandServer::wl_input_method
+{
+ Q_OBJECT
+public:
+ explicit InputMethod(QWaylandInputDevice *seat);
+ ~InputMethod();
+
+ QWaylandCompositor *compositor() const { return m_seat->compositor(); }
+
+ void activate(TextInput *textInput);
+ void deactivate();
+
+ bool isBound() const;
+
+ InputMethodContext *context() const;
+ TextInput *textInput() const;
+
+protected:
+ void input_method_bind_resource(Resource *resource);
+ void input_method_destroy_resource(Resource *resource);
+
+private Q_SLOTS:
+ void focusChanged(QWaylandSurface *surface);
+
+private:
+ QWaylandInputDevice *m_seat;
+ Resource *m_resource;
+ TextInput *m_textInput;
+ InputMethodContext *m_context;
+};
+
+} // namespace QtWayland
+
+QT_END_NAMESPACE
+
+#endif // QTWAYLAND_QWLINPUTMETHOD_H
diff --git a/src/compositor/extensions/qwlinputmethodcontext.cpp b/src/compositor/extensions/qwlinputmethodcontext.cpp
new file mode 100644
index 000000000..6421d5e76
--- /dev/null
+++ b/src/compositor/extensions/qwlinputmethodcontext.cpp
@@ -0,0 +1,135 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
+** 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$
+**
+****************************************************************************/
+
+#include "qwlinputmethodcontext_p.h"
+
+#include "qwltextinput_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWayland {
+
+InputMethodContext::InputMethodContext(wl_client *client, TextInput *textInput)
+ : QtWaylandServer::wl_input_method_context(client, 0, 1)
+ , m_textInput(textInput)
+{
+}
+
+InputMethodContext::~InputMethodContext()
+{
+}
+
+void InputMethodContext::input_method_context_destroy_resource(Resource *)
+{
+ delete this;
+}
+
+void InputMethodContext::input_method_context_destroy(Resource *resource)
+{
+ wl_resource_destroy(resource->handle);
+}
+
+void InputMethodContext::input_method_context_commit_string(Resource *, uint32_t serial, const QString &text)
+{
+ m_textInput->send_commit_string(serial, text);
+}
+
+void InputMethodContext::input_method_context_cursor_position(Resource *, int32_t index, int32_t anchor)
+{
+ m_textInput->send_cursor_position(index, anchor);
+}
+
+void InputMethodContext::input_method_context_delete_surrounding_text(Resource *, int32_t index, uint32_t length)
+{
+ m_textInput->send_delete_surrounding_text(index, length);
+}
+
+void InputMethodContext::input_method_context_language(Resource *, uint32_t serial, const QString &language)
+{
+ m_textInput->send_language(serial, language);
+}
+
+void InputMethodContext::input_method_context_keysym(Resource *, uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers)
+{
+ m_textInput->send_keysym(serial, time, sym, state, modifiers);
+}
+
+void InputMethodContext::input_method_context_modifiers_map(Resource *, wl_array *map)
+{
+ QByteArray modifiersArray(static_cast<char *>(map->data), map->size);
+ m_textInput->send_modifiers_map(modifiersArray);
+}
+
+void InputMethodContext::input_method_context_preedit_cursor(Resource *, int32_t index)
+{
+ m_textInput->send_preedit_cursor(index);
+}
+
+void InputMethodContext::input_method_context_preedit_string(Resource *, uint32_t serial, const QString &text, const QString &commit)
+{
+ m_textInput->send_preedit_string(serial, text, commit);
+}
+
+void InputMethodContext::input_method_context_preedit_styling(Resource *, uint32_t index, uint32_t length, uint32_t style)
+{
+ m_textInput->send_preedit_styling(index, length, style);
+}
+
+void InputMethodContext::input_method_context_grab_keyboard(Resource *, uint32_t keyboard)
+{
+ Q_UNUSED(keyboard);
+}
+
+void InputMethodContext::input_method_context_key(Resource *, uint32_t serial, uint32_t time, uint32_t key, uint32_t state)
+{
+ Q_UNUSED(serial);
+ Q_UNUSED(time);
+ Q_UNUSED(key);
+ Q_UNUSED(state);
+}
+
+void InputMethodContext::input_method_context_modifiers(Resource *, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group)
+{
+ Q_UNUSED(serial);
+ Q_UNUSED(mods_depressed);
+ Q_UNUSED(mods_latched);
+ Q_UNUSED(mods_locked);
+ Q_UNUSED(group);
+}
+
+} // namespace QtWayland
+
+QT_END_NAMESPACE
diff --git a/src/compositor/extensions/qwlinputmethodcontext_p.h b/src/compositor/extensions/qwlinputmethodcontext_p.h
new file mode 100644
index 000000000..febadc957
--- /dev/null
+++ b/src/compositor/extensions/qwlinputmethodcontext_p.h
@@ -0,0 +1,90 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
+** 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 QTWAYLAND_QWLINPUTMETHODCONTEXT_P_H
+#define QTWAYLAND_QWLINPUTMETHODCONTEXT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtWaylandCompositor/private/qwayland-server-input-method.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWayland {
+
+class TextInput;
+
+class InputMethodContext : public QtWaylandServer::wl_input_method_context
+{
+public:
+ explicit InputMethodContext(struct ::wl_client *client, TextInput *textInput);
+ ~InputMethodContext();
+
+protected:
+ void input_method_context_destroy_resource(Resource *resource) Q_DECL_OVERRIDE;
+ void input_method_context_destroy(Resource *resource) Q_DECL_OVERRIDE;
+
+ void input_method_context_commit_string(Resource *resource, uint32_t serial, const QString &text) Q_DECL_OVERRIDE;
+ void input_method_context_cursor_position(Resource *resource, int32_t index, int32_t anchor) Q_DECL_OVERRIDE;
+ void input_method_context_delete_surrounding_text(Resource *resource, int32_t index, uint32_t length) Q_DECL_OVERRIDE;
+ void input_method_context_language(Resource *resource, uint32_t serial, const QString &language) Q_DECL_OVERRIDE;
+ void input_method_context_keysym(Resource *resource, uint32_t serial, uint32_t time, uint32_t sym, uint32_t state, uint32_t modifiers) Q_DECL_OVERRIDE;
+ void input_method_context_modifiers_map(Resource *resource, wl_array *map) Q_DECL_OVERRIDE;
+ void input_method_context_preedit_cursor(Resource *resource, int32_t index) Q_DECL_OVERRIDE;
+ void input_method_context_preedit_string(Resource *resource, uint32_t serial, const QString &text, const QString &commit) Q_DECL_OVERRIDE;
+ void input_method_context_preedit_styling(Resource *resource, uint32_t index, uint32_t length, uint32_t style) Q_DECL_OVERRIDE;
+ void input_method_context_grab_keyboard(Resource *resource, uint32_t keyboard) Q_DECL_OVERRIDE;
+ void input_method_context_key(Resource *resource, uint32_t serial, uint32_t time, uint32_t key, uint32_t state) Q_DECL_OVERRIDE;
+ void input_method_context_modifiers(Resource *resource, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group) Q_DECL_OVERRIDE;
+
+private:
+ TextInput *m_textInput;
+};
+
+} // namespace QtWayland
+
+QT_END_NAMESPACE
+
+#endif // QTWAYLAND_QWLINPUTMETHODCONTEXT_P_H
diff --git a/src/compositor/extensions/qwlinputpanel.cpp b/src/compositor/extensions/qwlinputpanel.cpp
new file mode 100644
index 000000000..8f41f0ca3
--- /dev/null
+++ b/src/compositor/extensions/qwlinputpanel.cpp
@@ -0,0 +1,130 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
+** 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$
+**
+****************************************************************************/
+
+#include "qwlinputpanel_p.h"
+
+#include <QtWaylandCompositor/qwaylandinputpanel.h>
+#include <QtWaylandCompositor/QWaylandCompositor>
+
+#include "qwlinputmethod_p.h"
+#include "qwlinputpanelsurface_p.h"
+#include "qwltextinput_p.h"
+
+QT_BEGIN_NAMESPACE
+
+QWaylandInputPanelPrivate::QWaylandInputPanelPrivate(QWaylandCompositor *compositor)
+ : QWaylandExtensionTemplatePrivate()
+ , QtWaylandServer::wl_input_panel()
+ , m_compositor(compositor)
+ , m_focus()
+ , m_inputPanelVisible(false)
+ , m_cursorRectangle()
+{
+ init(compositor->display(), 1);
+}
+
+QWaylandInputPanelPrivate::~QWaylandInputPanelPrivate()
+{
+}
+
+QWaylandInputPanel *QWaylandInputPanelPrivate::waylandInputPanel() const
+{
+ QWaylandInputPanel *panel = const_cast<QWaylandInputPanel *>(q_func());
+ return panel;
+}
+
+QWaylandSurface *QWaylandInputPanelPrivate::focus() const
+{
+ return m_focus;
+}
+
+void QWaylandInputPanelPrivate::setFocus(QWaylandSurface *focus)
+{
+ Q_Q(QWaylandInputPanel);
+ if (m_focus == focus)
+ return;
+
+ m_focus = focus;
+
+ Q_EMIT q->focusChanged();
+}
+
+bool QWaylandInputPanelPrivate::inputPanelVisible() const
+{
+ return m_inputPanelVisible;
+}
+
+void QWaylandInputPanelPrivate::setInputPanelVisible(bool inputPanelVisible)
+{
+ Q_Q(QWaylandInputPanel);
+ if (m_inputPanelVisible == inputPanelVisible)
+ return;
+
+ m_inputPanelVisible = inputPanelVisible;
+
+ q->visibleChanged();
+}
+
+QRect QWaylandInputPanelPrivate::cursorRectangle() const
+{
+ return m_cursorRectangle;
+}
+
+void QWaylandInputPanelPrivate::setCursorRectangle(const QRect &cursorRectangle)
+{
+ Q_Q(QWaylandInputPanel);
+ if (m_cursorRectangle == cursorRectangle)
+ return;
+
+ m_cursorRectangle = cursorRectangle;
+
+ Q_EMIT q->cursorRectangleChanged();
+}
+
+QWaylandInputPanelPrivate *QWaylandInputPanelPrivate::findIn(QWaylandObject *container)
+{
+ QWaylandInputPanel *panel = QWaylandInputPanel::findIn(container);
+ if (!panel)
+ return Q_NULLPTR;
+ return panel->d_func();
+}
+
+void QWaylandInputPanelPrivate::input_panel_get_input_panel_surface(Resource *resource, uint32_t id, wl_resource *surface)
+{
+ new QtWayland::InputPanelSurface(resource->client(), id, QWaylandSurface::fromResource(surface));
+}
+
+QT_END_NAMESPACE
diff --git a/src/compositor/extensions/qwlinputpanel_p.h b/src/compositor/extensions/qwlinputpanel_p.h
new file mode 100644
index 000000000..963593dbc
--- /dev/null
+++ b/src/compositor/extensions/qwlinputpanel_p.h
@@ -0,0 +1,99 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
+** 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 QTWAYLAND_QWLINPUTPANEL_P_H
+#define QTWAYLAND_QWLINPUTPANEL_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtWaylandCompositor/qwaylandexport.h>
+#include <QtWaylandCompositor/qwaylandinputpanel.h>
+
+#include <QtWaylandCompositor/private/qwaylandextension_p.h>
+#include <QtWaylandCompositor/private/qwayland-server-input-method.h>
+
+#include <QRect>
+#include <QScopedPointer>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWayland {
+class TextInput;
+}
+
+
+class Q_COMPOSITOR_EXPORT QWaylandInputPanelPrivate : public QWaylandExtensionTemplatePrivate, public QtWaylandServer::wl_input_panel
+{
+ Q_DECLARE_PUBLIC(QWaylandInputPanel)
+public:
+ QWaylandInputPanelPrivate(QWaylandCompositor *compositor);
+ ~QWaylandInputPanelPrivate();
+
+ QWaylandInputPanel *waylandInputPanel() const;
+
+ QWaylandSurface *focus() const;
+ void setFocus(QWaylandSurface *focus);
+
+ bool inputPanelVisible() const;
+ void setInputPanelVisible(bool inputPanelVisible);
+
+ QRect cursorRectangle() const;
+ void setCursorRectangle(const QRect &cursorRectangle);
+
+ static QWaylandInputPanelPrivate *findIn(QWaylandObject *container);
+protected:
+ void input_panel_get_input_panel_surface(Resource *resource, uint32_t id, struct ::wl_resource *surface) Q_DECL_OVERRIDE;
+
+private:
+ QWaylandCompositor *m_compositor;
+
+ QWaylandSurface *m_focus;
+ bool m_inputPanelVisible;
+ QRect m_cursorRectangle;
+};
+
+QT_END_NAMESPACE
+
+#endif // QTWAYLAND_QWLINPUTPANEL_P_H
diff --git a/src/compositor/extensions/qwlinputpanelsurface.cpp b/src/compositor/extensions/qwlinputpanelsurface.cpp
new file mode 100644
index 000000000..c54520aad
--- /dev/null
+++ b/src/compositor/extensions/qwlinputpanelsurface.cpp
@@ -0,0 +1,86 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
+** 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$
+**
+****************************************************************************/
+
+#include "qwlinputpanelsurface_p.h"
+
+#include <QtWaylandCompositor/private/qwaylandsurface_p.h>
+#include <QtWaylandCompositor/QWaylandOutput>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWayland {
+
+InputPanelSurface::InputPanelSurface(wl_client *client, int id, QWaylandSurface *surface)
+ : QtWaylandServer::wl_input_panel_surface(client, id, 1)
+ , m_surface(surface)
+ , m_type(Invalid)
+ , m_output(0)
+ , m_position()
+{
+ QWaylandSurfacePrivate::get(surface)->setInputPanelSurface(this);
+}
+
+InputPanelSurface::Type InputPanelSurface::type() const
+{
+ return m_type;
+}
+
+QWaylandOutput *InputPanelSurface::output() const
+{
+ return m_output;
+}
+
+QtWaylandServer::wl_input_panel_surface::position InputPanelSurface::position() const
+{
+ return m_position;
+}
+
+void InputPanelSurface::input_panel_surface_set_overlay_panel(Resource *)
+{
+ m_type = OverlayPanel;
+}
+
+void InputPanelSurface::input_panel_surface_set_toplevel(Resource *, wl_resource *output_resource, uint32_t position)
+{
+ m_type = Toplevel;
+ m_output = QWaylandOutput::fromResource(output_resource);
+ m_position = static_cast<wl_input_panel_surface::position>(position);
+}
+
+QT_END_NAMESPACE
+
+} // namespace QtWayland
diff --git a/src/compositor/extensions/qwlinputpanelsurface_p.h b/src/compositor/extensions/qwlinputpanelsurface_p.h
new file mode 100644
index 000000000..e11923bd0
--- /dev/null
+++ b/src/compositor/extensions/qwlinputpanelsurface_p.h
@@ -0,0 +1,95 @@
+/****************************************************************************
+**
+** Copyright (C) 2014 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com>
+** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
+** 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 QTWAYLAND_QWLINPUTPANELSURFACE_P_H
+#define QTWAYLAND_QWLINPUTPANELSURFACE_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtWaylandCompositor/private/qwayland-server-input-method.h>
+
+#include <QWaylandSurface>
+
+QT_BEGIN_NAMESPACE
+
+class QWaylandOutput;
+
+namespace QtWayland {
+
+class InputPanelSurface : public QtWaylandServer::wl_input_panel_surface
+{
+public:
+ enum Type {
+ Invalid,
+ Toplevel,
+ OverlayPanel
+ };
+
+ InputPanelSurface(struct ::wl_client *client, int id, QWaylandSurface *surface);
+
+ Type type() const;
+
+ QWaylandOutput *output() const;
+ wl_input_panel_surface::position position() const;
+
+protected:
+ void input_panel_surface_set_overlay_panel(Resource *resource) Q_DECL_OVERRIDE;
+ void input_panel_surface_set_toplevel(Resource *resource, wl_resource *output_resource, uint32_t position) Q_DECL_OVERRIDE;
+
+private:
+ QWaylandSurface *m_surface;
+
+ Type m_type;
+
+ QWaylandOutput *m_output;
+ wl_input_panel_surface::position m_position;
+};
+
+} // namespace QtWayland
+
+QT_END_NAMESPACE
+
+#endif // QTWAYLAND_QWLINPUTPANELSURFACE_P_H
diff --git a/src/compositor/extensions/qwlqtkey.cpp b/src/compositor/extensions/qwlqtkey.cpp
new file mode 100644
index 000000000..52373df08
--- /dev/null
+++ b/src/compositor/extensions/qwlqtkey.cpp
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#include "qwlqtkey_p.h"
+#include <QtWaylandCompositor/QWaylandSurface>
+#include <QKeyEvent>
+#include <QWindow>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWayland {
+
+QtKeyExtensionGlobal::QtKeyExtensionGlobal(QWaylandCompositor *compositor)
+ : QWaylandExtensionTemplate(compositor)
+ , QtWaylandServer::qt_key_extension(compositor->display(), 2)
+ , m_compositor(compositor)
+{
+}
+
+bool QtKeyExtensionGlobal::postQtKeyEvent(QKeyEvent *event, QWaylandSurface *surface)
+{
+ uint32_t time = m_compositor->currentTimeMsecs();
+
+ Resource *target = surface ? resourceMap().value(surface->waylandClient()) : 0;
+
+ if (target) {
+ send_qtkey(target->handle,
+ surface ? surface->resource() : 0,
+ time, event->type(), event->key(), event->modifiers(),
+ event->nativeScanCode(),
+ event->nativeVirtualKey(),
+ event->nativeModifiers(),
+ event->text(),
+ event->isAutoRepeat(),
+ event->count());
+
+ return true;
+ }
+
+ return false;
+}
+
+}
+
+QT_END_NAMESPACE
diff --git a/src/compositor/extensions/qwlqtkey_p.h b/src/compositor/extensions/qwlqtkey_p.h
new file mode 100644
index 000000000..aebfab6e3
--- /dev/null
+++ b/src/compositor/extensions/qwlqtkey_p.h
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** 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 WLQTKEY_H
+#define WLQTKEY_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include "wayland-util.h"
+
+#include <QtWaylandCompositor/QWaylandExtensionTemplate>
+#include <QtWaylandCompositor/QWaylandCompositor>
+#include <QtWaylandCompositor/private/qwayland-server-qtkey-extension.h>
+
+QT_BEGIN_NAMESPACE
+
+class QWaylandSurface;
+class QKeyEvent;
+
+namespace QtWayland {
+
+class QtKeyExtensionGlobal : public QWaylandExtensionTemplate<QtKeyExtensionGlobal>, public QtWaylandServer::qt_key_extension
+{
+ Q_OBJECT
+public:
+ QtKeyExtensionGlobal(QWaylandCompositor *compositor);
+
+ bool postQtKeyEvent(QKeyEvent *event, QWaylandSurface *surface);
+
+private:
+ QWaylandCompositor *m_compositor;
+};
+
+}
+
+QT_END_NAMESPACE
+
+#endif // WLQTKEY_H
diff --git a/src/compositor/extensions/qwlqttouch.cpp b/src/compositor/extensions/qwlqttouch.cpp
new file mode 100644
index 000000000..70738ce20
--- /dev/null
+++ b/src/compositor/extensions/qwlqttouch.cpp
@@ -0,0 +1,164 @@
+/****************************************************************************
+**
+** 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$
+**
+****************************************************************************/
+
+#include "qwlqttouch_p.h"
+#include "qwaylandview.h"
+#include <QTouchEvent>
+#include <QWindow>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWayland {
+
+static const int maxRawPos = 24;
+
+TouchExtensionGlobal::TouchExtensionGlobal(QWaylandCompositor *compositor)
+ : QWaylandExtensionTemplate(compositor)
+ , QtWaylandServer::qt_touch_extension(compositor->display(), 1)
+ , m_compositor(compositor)
+ , m_flags(0)
+ , m_resources()
+ , m_posData(maxRawPos * 2)
+{
+}
+
+TouchExtensionGlobal::~TouchExtensionGlobal()
+{
+}
+
+static inline int toFixed(qreal f)
+{
+ return int(f * 10000);
+}
+
+bool TouchExtensionGlobal::postTouchEvent(QTouchEvent *event, QWaylandView *view)
+{
+ const QList<QTouchEvent::TouchPoint> points = event->touchPoints();
+ const int pointCount = points.count();
+ if (!pointCount)
+ return false;
+
+ wl_client *surfaceClient = view->surface()->client()->client();
+ uint32_t time = m_compositor->currentTimeMsecs();
+ const int rescount = m_resources.count();
+
+ for (int res = 0; res < rescount; ++res) {
+ Resource *target = m_resources.at(res);
+ if (target->client() != surfaceClient)
+ continue;
+
+ // We will use no touch_frame type of event, to reduce the number of
+ // events flowing through the wire. Instead, the number of points sent is
+ // included in the touch point events.
+ int sentPointCount = 0;
+ for (int i = 0; i < pointCount; ++i) {
+ if (points.at(i).state() != Qt::TouchPointStationary)
+ ++sentPointCount;
+ }
+
+ for (int i = 0; i < pointCount; ++i) {
+ const QTouchEvent::TouchPoint &tp(points.at(i));
+ // Stationary points are never sent. They are cached on client side.
+ if (tp.state() == Qt::TouchPointStationary)
+ continue;
+
+ uint32_t id = tp.id();
+ uint32_t state = (tp.state() & 0xFFFF) | (sentPointCount << 16);
+ uint32_t flags = (tp.flags() & 0xFFFF) | (int(event->device()->capabilities()) << 16);
+
+ int x = toFixed(tp.pos().x());
+ int y = toFixed(tp.pos().y());
+ int nx = toFixed(tp.normalizedPos().x());
+ int ny = toFixed(tp.normalizedPos().y());
+ int w = toFixed(tp.rect().width());
+ int h = toFixed(tp.rect().height());
+ int vx = toFixed(tp.velocity().x());
+ int vy = toFixed(tp.velocity().y());
+ uint32_t pressure = uint32_t(tp.pressure() * 255);
+
+ QByteArray rawData;
+ QVector<QPointF> rawPosList = tp.rawScreenPositions();
+ int rawPosCount = rawPosList.count();
+ if (rawPosCount) {
+ rawPosCount = qMin(maxRawPos, rawPosCount);
+ QVector<float>::iterator iter = m_posData.begin();
+ for (int rpi = 0; rpi < rawPosCount; ++rpi) {
+ const QPointF &rawPos(rawPosList.at(rpi));
+ // This will stay in screen coordinates for performance
+ // reasons, clients using this data will presumably know
+ // what they are doing.
+ *iter++ = static_cast<float>(rawPos.x());
+ *iter++ = static_cast<float>(rawPos.y());
+ }
+ rawData = QByteArray::fromRawData(reinterpret_cast<const char*>(m_posData.constData()), sizeof(float) * rawPosCount * 2);
+ }
+
+ send_touch(target->handle,
+ time, id, state,
+ x, y, nx, ny, w, h,
+ pressure, vx, vy,
+ flags, rawData);
+ }
+
+ return true;
+ }
+
+ return false;
+}
+
+void TouchExtensionGlobal::setBehviorFlags(BehaviorFlags flags)
+{
+ if (m_flags == flags)
+ return;
+
+ m_flags = flags;
+ behaviorFlagsChanged();
+}
+
+void TouchExtensionGlobal::touch_extension_bind_resource(Resource *resource)
+{
+ m_resources.append(resource);
+ send_configure(resource->handle, m_flags);
+}
+
+void TouchExtensionGlobal::touch_extension_destroy_resource(Resource *resource)
+{
+ m_resources.removeOne(resource);
+}
+
+}
+
+QT_END_NAMESPACE
diff --git a/src/compositor/extensions/qwlqttouch_p.h b/src/compositor/extensions/qwlqttouch_p.h
new file mode 100644
index 000000000..e2daad63c
--- /dev/null
+++ b/src/compositor/extensions/qwlqttouch_p.h
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** 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 WLTOUCH_H
+#define WLTOUCH_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtWaylandCompositor/private/qwayland-server-touch-extension.h>
+#include <QtWaylandCompositor/QWaylandCompositor>
+#include <QtWaylandCompositor/QWaylandExtensionTemplate>
+#include "wayland-util.h"
+
+QT_BEGIN_NAMESPACE
+
+class Surface;
+class QTouchEvent;
+class QWaylandView;
+
+namespace QtWayland {
+
+class TouchExtensionGlobal : public QWaylandExtensionTemplate<TouchExtensionGlobal>, public QtWaylandServer::qt_touch_extension
+{
+ Q_OBJECT
+ Q_PROPERTY(BehaviorFlags behaviorFlags READ behaviorFlags WRITE setBehviorFlags NOTIFY behaviorFlagsChanged)
+public:
+
+ enum BehaviorFlag{
+ None = 0x00,
+ MouseFromTouch = 0x01
+ };
+ Q_DECLARE_FLAGS(BehaviorFlags, BehaviorFlag)
+
+ TouchExtensionGlobal(QWaylandCompositor *compositor);
+ ~TouchExtensionGlobal();
+
+ bool postTouchEvent(QTouchEvent *event, QWaylandView *view);
+
+ void setBehviorFlags(BehaviorFlags flags);
+ BehaviorFlags behaviorFlags() const { return m_flags; }
+
+Q_SIGNALS:
+ void behaviorFlagsChanged();
+
+protected:
+ void touch_extension_bind_resource(Resource *resource) Q_DECL_OVERRIDE;
+ void touch_extension_destroy_resource(Resource *resource) Q_DECL_OVERRIDE;
+
+private:
+ QWaylandCompositor *m_compositor;
+ BehaviorFlags m_flags;
+ QList<Resource *> m_resources;
+ QVector<float> m_posData;
+};
+
+Q_DECLARE_OPERATORS_FOR_FLAGS(TouchExtensionGlobal::BehaviorFlags)
+
+}
+
+QT_END_NAMESPACE
+
+#endif // WLTOUCH_H
diff --git a/src/compositor/extensions/qwltextinput.cpp b/src/compositor/extensions/qwltextinput.cpp
new file mode 100644
index 000000000..7546ab6a0
--- /dev/null
+++ b/src/compositor/extensions/qwltextinput.cpp
@@ -0,0 +1,212 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
+** 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$
+**
+****************************************************************************/
+
+#include "qwltextinput_p.h"
+
+#include "qwlinputmethod_p.h"
+#include "qwlinputmethodcontext_p.h"
+#include "qwlinputpanel_p.h"
+#include <QtWaylandCompositor/QWaylandInputPanel>
+#include <QtWaylandCompositor/QWaylandCompositor>
+#include <QtWaylandCompositor/private/qwaylandinput_p.h>
+
+#include <algorithm>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWayland {
+
+TextInput::TextInput(QWaylandObject *container, QWaylandCompositor *compositor, struct ::wl_client *client, int id)
+ : QWaylandExtensionTemplate(container)
+ , wl_text_input(client, id, 1)
+ , m_compositor(compositor)
+ , m_focus()
+ , m_inputPanelVisible()
+ , m_cursorRectangle()
+{
+}
+
+QWaylandSurface *TextInput::focus() const
+{
+ return m_focus;
+}
+
+bool TextInput::inputPanelVisible() const
+{
+ return m_inputPanelVisible;
+}
+
+QRect TextInput::cursorRectangle() const
+{
+ return m_cursorRectangle;
+}
+
+void TextInput::deactivate(InputMethod *inputMethod)
+{
+ if (m_activeInputMethods.removeOne(inputMethod))
+ inputMethod->deactivate();
+
+ if (m_activeInputMethods.isEmpty())
+ send_leave();
+}
+
+void TextInput::text_input_destroy_resource(Resource *)
+{
+ Q_FOREACH (InputMethod *inputMethod, m_activeInputMethods) {
+ deactivate(inputMethod);
+ }
+
+ delete this;
+}
+
+void TextInput::text_input_activate(Resource *, wl_resource *seat, wl_resource *surface)
+{
+ QWaylandSurface *oldSurface = m_focus;
+ m_focus = QWaylandSurface::fromResource(surface);
+
+ if (oldSurface != m_focus)
+ send_leave();
+
+ bool wasEmpty = m_activeInputMethods.isEmpty();
+
+ InputMethod *inputMethod = InputMethod::findIn(QWaylandInputDevice::fromSeatResource(seat));
+
+ if (inputMethod && !m_activeInputMethods.contains(inputMethod)) {
+ m_activeInputMethods.append(inputMethod);
+ inputMethod->activate(this);
+ }
+
+ if (wasEmpty || oldSurface != m_focus)
+ send_enter(surface);
+}
+
+void TextInput::text_input_deactivate(Resource *, wl_resource *seat)
+{
+ InputMethod *inputMethod = InputMethod::findIn(QWaylandInputDevice::fromSeatResource(seat));
+
+ if (inputMethod)
+ deactivate(inputMethod);
+}
+
+static bool isInputMethodBound(InputMethod *inputMethod)
+{
+ return inputMethod->isBound();
+}
+
+void TextInput::text_input_show_input_panel(Resource *)
+{
+ m_inputPanelVisible = true;
+
+ if (std::find_if(m_activeInputMethods.cbegin(), m_activeInputMethods.cend(), isInputMethodBound) != m_activeInputMethods.cend()){
+ QWaylandInputPanelPrivate *panel = QWaylandInputPanelPrivate::findIn(m_compositor);
+ if (panel)
+ panel->setInputPanelVisible(true);
+ }
+}
+
+void TextInput::text_input_hide_input_panel(Resource *)
+{
+ m_inputPanelVisible = false;
+
+ if (std::find_if(m_activeInputMethods.cbegin(), m_activeInputMethods.cend(), isInputMethodBound) != m_activeInputMethods.cend()) {
+ QWaylandInputPanelPrivate *panel = QWaylandInputPanelPrivate::findIn(m_compositor);
+ if (panel)
+ panel->setInputPanelVisible(false);
+ }
+}
+
+void TextInput::text_input_set_cursor_rectangle(Resource *, int32_t x, int32_t y, int32_t width, int32_t height)
+{
+ m_cursorRectangle = QRect(x, y, width, height);
+
+ if (!m_activeInputMethods.isEmpty()) {
+ QWaylandInputPanelPrivate *panel = QWaylandInputPanelPrivate::findIn(m_compositor);
+ if (panel)
+ panel->setCursorRectangle(m_cursorRectangle);
+ }
+}
+
+void TextInput::text_input_reset(Resource *)
+{
+ Q_FOREACH (InputMethod *inputMethod, m_activeInputMethods) {
+ if (inputMethod->context())
+ inputMethod->context()->send_reset();
+ }
+}
+
+void TextInput::text_input_commit_state(Resource *, uint32_t serial)
+{
+ Q_FOREACH (InputMethod *inputMethod, m_activeInputMethods) {
+ if (inputMethod->context())
+ inputMethod->context()->send_commit_state(serial);
+ }
+}
+
+void TextInput::text_input_set_content_type(Resource *, uint32_t hint, uint32_t purpose)
+{
+ Q_FOREACH (InputMethod *inputMethod, m_activeInputMethods) {
+ if (inputMethod->context())
+ inputMethod->context()->send_content_type(hint, purpose);
+ }
+}
+
+void TextInput::text_input_set_preferred_language(Resource *, const QString &language)
+{
+ Q_FOREACH (InputMethod *inputMethod, m_activeInputMethods) {
+ if (inputMethod->context())
+ inputMethod->context()->send_preferred_language(language);
+ }
+}
+
+void TextInput::text_input_set_surrounding_text(Resource *, const QString &text, uint32_t cursor, uint32_t anchor)
+{
+ Q_FOREACH (InputMethod *inputMethod, m_activeInputMethods) {
+ if (inputMethod->context())
+ inputMethod->context()->send_surrounding_text(text, cursor, anchor);
+ }
+}
+
+void TextInput::text_input_invoke_action(Resource *, uint32_t button, uint32_t index)
+{
+ Q_FOREACH (InputMethod *inputMethod, m_activeInputMethods) {
+ if (inputMethod->context())
+ inputMethod->context()->send_invoke_action(button, index);
+ }
+}
+
+} // namespace QtWayland
+
+QT_END_NAMESPACE
diff --git a/src/compositor/extensions/qwltextinput_p.h b/src/compositor/extensions/qwltextinput_p.h
new file mode 100644
index 000000000..02adc5cae
--- /dev/null
+++ b/src/compositor/extensions/qwltextinput_p.h
@@ -0,0 +1,106 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
+** 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 QTWAYLAND_QWLTEXTINPUT_P_H
+#define QTWAYLAND_QWLTEXTINPUT_P_H
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+#include <QtWaylandCompositor/QWaylandExtension>
+#include <QtWaylandCompositor/private/qwayland-server-text.h>
+
+#include <QRect>
+
+QT_BEGIN_NAMESPACE
+
+class QWaylandSurface;
+class QWaylandCompositor;
+
+namespace QtWayland {
+
+class InputMethod;
+
+class TextInput : public QWaylandExtensionTemplate<TextInput>, public QtWaylandServer::wl_text_input
+{
+public:
+ explicit TextInput(QWaylandObject *container, QWaylandCompositor *compositor, struct ::wl_client *client, int id);
+
+ QWaylandSurface *focus() const;
+
+ bool inputPanelVisible() const;
+ QRect cursorRectangle() const;
+
+ void deactivate(InputMethod *inputMethod);
+
+protected:
+ void text_input_destroy_resource(Resource *resource) Q_DECL_OVERRIDE;
+
+ void text_input_activate(Resource *resource, wl_resource *seat, wl_resource *surface) Q_DECL_OVERRIDE;
+ void text_input_deactivate(Resource *resource, wl_resource *seat) Q_DECL_OVERRIDE;
+ void text_input_show_input_panel(Resource *resource) Q_DECL_OVERRIDE;
+ void text_input_hide_input_panel(Resource *resource) Q_DECL_OVERRIDE;
+ void text_input_reset(Resource *resource) Q_DECL_OVERRIDE;
+ void text_input_commit_state(Resource *resource, uint32_t serial) Q_DECL_OVERRIDE;
+ void text_input_set_content_type(Resource *resource, uint32_t hint, uint32_t purpose) Q_DECL_OVERRIDE;
+ void text_input_set_cursor_rectangle(Resource *resource, int32_t x, int32_t y, int32_t width, int32_t height) Q_DECL_OVERRIDE;
+ void text_input_set_preferred_language(Resource *resource, const QString &language) Q_DECL_OVERRIDE;
+ void text_input_set_surrounding_text(Resource *resource, const QString &text, uint32_t cursor, uint32_t anchor) Q_DECL_OVERRIDE;
+ void text_input_invoke_action(Resource *resource, uint32_t button, uint32_t index) Q_DECL_OVERRIDE;
+
+private:
+ QWaylandCompositor *m_compositor;
+ QList<InputMethod*> m_activeInputMethods;
+ QWaylandSurface *m_focus;
+
+ bool m_inputPanelVisible;
+ QRect m_cursorRectangle;
+
+};
+
+} // namespace QtWayland
+
+QT_END_NAMESPACE
+
+#endif // QTWAYLAND_QWLTEXTINPUT_P_H
diff --git a/src/compositor/extensions/qwltextinputmanager.cpp b/src/compositor/extensions/qwltextinputmanager.cpp
new file mode 100644
index 000000000..9c7dd72f4
--- /dev/null
+++ b/src/compositor/extensions/qwltextinputmanager.cpp
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
+** 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$
+**
+****************************************************************************/
+
+#include "qwltextinputmanager_p.h"
+
+#include <QtWaylandCompositor/QWaylandCompositor>
+#include "qwltextinput_p.h"
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWayland {
+
+TextInputManager::TextInputManager(QWaylandCompositor *compositor)
+ : QWaylandExtensionTemplate(compositor)
+ , QtWaylandServer::wl_text_input_manager(compositor->display(), 1)
+ , m_compositor(compositor)
+{
+}
+
+TextInputManager::~TextInputManager()
+{
+}
+
+void TextInputManager::text_input_manager_create_text_input(Resource *resource, uint32_t id)
+{
+ new TextInput(this, m_compositor, resource->client(), id);
+}
+
+} // namespace QtWayland
+
+QT_END_NAMESPACE
diff --git a/src/compositor/extensions/qwltextinputmanager_p.h b/src/compositor/extensions/qwltextinputmanager_p.h
new file mode 100644
index 000000000..0125bdcae
--- /dev/null
+++ b/src/compositor/extensions/qwltextinputmanager_p.h
@@ -0,0 +1,78 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Klarälvdalens Datakonsult AB (KDAB).
+** 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 QTWAYLAND_QWLTEXTINPUTMANAGER_P_H
+#define QTWAYLAND_QWLTEXTINPUTMANAGER_P_H
+
+#include <QtWaylandCompositor/QWaylandExtension>
+#include <QtWaylandCompositor/private/qwayland-server-text.h>
+
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
+QT_BEGIN_NAMESPACE
+
+class QWaylandCompositor;
+
+namespace QtWayland {
+
+class TextInputManager : public QWaylandExtensionTemplate<TextInputManager>, public QtWaylandServer::wl_text_input_manager
+{
+ Q_OBJECT
+public:
+ TextInputManager(QWaylandCompositor *compositor);
+ ~TextInputManager();
+
+protected:
+ void text_input_manager_create_text_input(Resource *resource, uint32_t id) Q_DECL_OVERRIDE;
+
+private:
+ QWaylandCompositor *m_compositor;
+};
+
+} // namespace QtWayland
+
+QT_END_NAMESPACE
+
+#endif // QTWAYLAND_QWLTEXTINPUTMANAGER_P_H