diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2016-04-20 10:41:20 +0200 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2016-09-30 13:55:30 +0000 |
commit | f7896fdc6505d8c6f3b3a239884dadab034e1fb5 (patch) | |
tree | 11f73dd52db4ecf33d5289b234f72500bd3c8a91 /src/compositor | |
parent | 863bf669ed0b8fce782c177dfcfa1702fc28196a (diff) |
C++ API and tests for the ivi-application extension
Note, this is only an implementation of the ivi-application extension,
not ivi-controller which contains layer management interfaces.
Task-number: QTBUG-53149
Change-Id: Ic5a31156de1768f846b714a9aee9bbf8a945cbbe
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Diffstat (limited to 'src/compositor')
-rw-r--r-- | src/compositor/extensions/extensions.pri | 7 | ||||
-rw-r--r-- | src/compositor/extensions/qwaylandiviapplication.cpp | 150 | ||||
-rw-r--r-- | src/compositor/extensions/qwaylandiviapplication.h | 71 | ||||
-rw-r--r-- | src/compositor/extensions/qwaylandiviapplication_p.h | 79 | ||||
-rw-r--r-- | src/compositor/extensions/qwaylandivisurface.cpp | 191 | ||||
-rw-r--r-- | src/compositor/extensions/qwaylandivisurface.h | 89 | ||||
-rw-r--r-- | src/compositor/extensions/qwaylandivisurface_p.h | 84 |
7 files changed, 671 insertions, 0 deletions
diff --git a/src/compositor/extensions/extensions.pri b/src/compositor/extensions/extensions.pri index e139d9e8c..eda13476b 100644 --- a/src/compositor/extensions/extensions.pri +++ b/src/compositor/extensions/extensions.pri @@ -8,6 +8,7 @@ WAYLANDSERVERSOURCES += \ ../extensions/qt-windowmanager.xml \ ../3rdparty/protocol/text-input-unstable-v2.xml \ ../3rdparty/protocol/xdg-shell.xml \ + ../3rdparty/protocol/ivi-application.xml \ HEADERS += \ extensions/qwlextendedsurface_p.h \ @@ -26,6 +27,10 @@ HEADERS += \ extensions/qwaylandxdgshellv5.h \ extensions/qwaylandxdgshellv5_p.h \ extensions/qwaylandshellsurface.h \ + extensions/qwaylandiviapplication.h \ + extensions/qwaylandiviapplication_p.h \ + extensions/qwaylandivisurface.h \ + extensions/qwaylandivisurface_p.h \ SOURCES += \ extensions/qwlextendedsurface.cpp \ @@ -37,6 +42,8 @@ SOURCES += \ extensions/qwaylandtextinputmanager.cpp \ extensions/qwaylandqtwindowmanager.cpp \ extensions/qwaylandxdgshellv5.cpp \ + extensions/qwaylandiviapplication.cpp \ + extensions/qwaylandivisurface.cpp \ qtHaveModule(quick):contains(QT_CONFIG, opengl) { HEADERS += \ diff --git a/src/compositor/extensions/qwaylandiviapplication.cpp b/src/compositor/extensions/qwaylandiviapplication.cpp new file mode 100644 index 000000000..c3eea08d7 --- /dev/null +++ b/src/compositor/extensions/qwaylandiviapplication.cpp @@ -0,0 +1,150 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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 "qwaylandiviapplication.h" +#include "qwaylandiviapplication_p.h" + +#include <QtWaylandCompositor/QWaylandCompositor> +#include <QtWaylandCompositor/QWaylandSurface> +#include <QtWaylandCompositor/QWaylandIviSurface> +#include <QtWaylandCompositor/QWaylandResource> + +QT_BEGIN_NAMESPACE + +/*! + * Constructs a QWaylandIviApplication object. + */ +QWaylandIviApplication::QWaylandIviApplication() + : QWaylandCompositorExtensionTemplate<QWaylandIviApplication>(*new QWaylandIviApplicationPrivate()) +{ +} + +/*! + * Constructs a QWaylandIviApplication object for the provided \a compositor. + */ +QWaylandIviApplication::QWaylandIviApplication(QWaylandCompositor *compositor) + : QWaylandCompositorExtensionTemplate<QWaylandIviApplication>(compositor, *new QWaylandIviApplicationPrivate()) +{ +} + +/*! + * Initializes the shell extension. + */ +void QWaylandIviApplication::initialize() +{ + Q_D(QWaylandIviApplication); + QWaylandCompositorExtensionTemplate::initialize(); + + QWaylandCompositor *compositor = static_cast<QWaylandCompositor *>(extensionContainer()); + if (!compositor) { + qWarning() << "Failed to find QWaylandCompositor when initializing QWaylandIviApplication"; + return; + } + + d->init(compositor->display(), 1); +} + +/*! + * Returns the Wayland interface for the QWaylandIviApplication. + */ +const struct wl_interface *QWaylandIviApplication::interface() +{ + return QWaylandIviApplicationPrivate::interface(); +} + +QByteArray QWaylandIviApplication::interfaceName() +{ + return QWaylandIviApplicationPrivate::interfaceName(); +} + +/*! + * \fn void QWaylandWlShell::iviSurfaceRequested(QWaylandSurface *surface, uint iviId, const QWaylandResource &resource) + * + * This signal is emitted when the client has requested an \c ivi_surface to be associated + * with \a surface, which is identified by \a id. The handler for this signal is + * expected to create the ivi surface and initialize it within the scope of the + * signal emission. If no ivi surface is created, a default one will be created instead. + */ + +/*! + * \fn void QtWaylandCompositor::IviApplication::iviSurfaceCreated(QWaylandIviSurface *iviSurface) + * + * This signal is emitted when an IviSurface has been created. + */ + +QWaylandIviApplicationPrivate::QWaylandIviApplicationPrivate() + : QWaylandCompositorExtensionPrivate() + , ivi_application() +{ +} + +void QWaylandIviApplicationPrivate::unregisterIviSurface(QWaylandIviSurface *iviSurface) +{ + m_iviSurfaces.remove(iviSurface->iviId()); +} + +void QWaylandIviApplicationPrivate::ivi_application_surface_create(QtWaylandServer::ivi_application::Resource *resource, + uint32_t ivi_id, wl_resource *surfaceResource, uint32_t id) +{ + Q_Q(QWaylandIviApplication); + QWaylandSurface *surface = QWaylandSurface::fromResource(surfaceResource); + + if (m_iviSurfaces.contains(ivi_id)) { + wl_resource_post_error(resource->handle, IVI_APPLICATION_ERROR_IVI_ID, + "Given ivi_id, %d, is already assigned to wl_surface@%d", ivi_id, + wl_resource_get_id(m_iviSurfaces[ivi_id]->surface()->resource())); + return; + } + + if (!surface->setRole(QWaylandIviSurface::role(), resource->handle, IVI_APPLICATION_ERROR_ROLE)) + return; + + QWaylandResource iviSurfaceResource(wl_resource_create(resource->client(), &ivi_surface_interface, + wl_resource_get_version(resource->handle), id)); + + emit q->iviSurfaceRequested(surface, ivi_id, iviSurfaceResource); + + QWaylandIviSurface *iviSurface = QWaylandIviSurface::fromResource(iviSurfaceResource.resource()); + + if (!iviSurface) + iviSurface = new QWaylandIviSurface(q, surface, ivi_id, iviSurfaceResource); + + m_iviSurfaces.insert(ivi_id, iviSurface); + + emit q->iviSurfaceCreated(iviSurface); +} + +QT_END_NAMESPACE diff --git a/src/compositor/extensions/qwaylandiviapplication.h b/src/compositor/extensions/qwaylandiviapplication.h new file mode 100644 index 000000000..a3e057a86 --- /dev/null +++ b/src/compositor/extensions/qwaylandiviapplication.h @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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 QWAYLANDIVIAPPLICATION_H +#define QWAYLANDIVIAPPLICATION_H + +#include <QtWaylandCompositor/QWaylandCompositorExtension> +#include <QtCore/QSize> + +class QWaylandIviSurface; +class QWaylandSurface; +class QWaylandResource; +class QWaylandIviApplicationPrivate; + +QT_BEGIN_NAMESPACE + +class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandIviApplication : public QWaylandCompositorExtensionTemplate<QWaylandIviApplication> +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QWaylandIviApplication) + +public: + QWaylandIviApplication(); + QWaylandIviApplication(QWaylandCompositor *compositor); + + void initialize() Q_DECL_OVERRIDE; + + static const struct wl_interface *interface(); + static QByteArray interfaceName(); + +Q_SIGNALS: + void iviSurfaceRequested(QWaylandSurface *surface, uint iviId, const QWaylandResource &resource); + void iviSurfaceCreated(QWaylandIviSurface *iviSurface); +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDIVIAPPLICATION_H diff --git a/src/compositor/extensions/qwaylandiviapplication_p.h b/src/compositor/extensions/qwaylandiviapplication_p.h new file mode 100644 index 000000000..ea211a84a --- /dev/null +++ b/src/compositor/extensions/qwaylandiviapplication_p.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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 QWAYLANDIVIAPPLICATION_P_H +#define QWAYLANDIVIAPPLICATION_P_H + +#include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h> +#include <QtWaylandCompositor/private/qwayland-server-ivi-application.h> + +#include <QtWaylandCompositor/QWaylandIviApplication> + +#include <QHash> + +// +// 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_WAYLAND_COMPOSITOR_EXPORT QWaylandIviApplicationPrivate + : public QWaylandCompositorExtensionPrivate + , public QtWaylandServer::ivi_application +{ + Q_DECLARE_PUBLIC(QWaylandIviApplication) + +public: + QWaylandIviApplicationPrivate(); + static QWaylandIviApplicationPrivate *get(QWaylandIviApplication *iviApplication) { return iviApplication->d_func(); } + void unregisterIviSurface(QWaylandIviSurface *iviSurface); + + QHash<uint, QWaylandIviSurface*> m_iviSurfaces; + +protected: + void ivi_application_surface_create(Resource *resource, uint32_t ivi_id, wl_resource *surface, uint32_t id) Q_DECL_OVERRIDE; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDIVIAPPLICATION_P_H diff --git a/src/compositor/extensions/qwaylandivisurface.cpp b/src/compositor/extensions/qwaylandivisurface.cpp new file mode 100644 index 000000000..2de407e11 --- /dev/null +++ b/src/compositor/extensions/qwaylandivisurface.cpp @@ -0,0 +1,191 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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 "qwaylandivisurface.h" +#include "qwaylandivisurface_p.h" +#include "qwaylandiviapplication_p.h" + +#include <QtWaylandCompositor/QWaylandResource> + +QT_BEGIN_NAMESPACE + +QWaylandSurfaceRole QWaylandIviSurfacePrivate::s_role("ivi_surface"); + +/*! + * \class QWaylandIviSurface + * \inmodule QtWaylandCompositor + * \preliminary + * \brief The QWaylandIviSurface class provides a simple way to identify and resize a surface. + * + * This class is part of the QWaylandIviApplication extension and provides a way to + * extend the functionality of an existing QWaylandSurface with features a way to + * resize and identify it. + * + * It corresponds to the Wayland interface ivi_surface. + */ + +/*! + * Constructs a QWaylandIviSurface for \a surface and initializes it with the + * given \a application, \a surface, \a iviId, and resource \a res. + */ +QWaylandIviSurface::QWaylandIviSurface(QWaylandIviApplication *application, QWaylandSurface *surface, uint iviId, const QWaylandResource &resource) + : QWaylandShellSurfaceTemplate<QWaylandIviSurface>(*new QWaylandIviSurfacePrivate()) +{ + initialize(application, surface, iviId, resource); +} + +/*! + * Initializes the QWaylandIviSurface, associating it with the given \a iviApplication, \a surface, + * \a iviId, and \a resource. + */ +void QWaylandIviSurface::initialize(QWaylandIviApplication *iviApplication, QWaylandSurface *surface, uint iviId, const QWaylandResource &resource) +{ + Q_D(QWaylandIviSurface); + + d->m_iviApplication = iviApplication; + d->m_surface = surface; + d->m_iviId = iviId; + + d->init(resource.resource()); + setExtensionContainer(surface); + + emit surfaceChanged(); + emit iviIdChanged(); + + QWaylandCompositorExtension::initialize(); +} + +/*! + * \property QWaylandIviSurface::surface + * + * This property holds the surface associated with this QWaylandIviSurface. + */ +QWaylandSurface *QWaylandIviSurface::surface() const +{ + Q_D(const QWaylandIviSurface); + return d->m_surface; +} + +/*! + * \property QWaylandClient::iviId + * + * This property holds the ivi id of this QWaylandIviSurface. + */ +uint QWaylandIviSurface::iviId() const +{ + Q_D(const QWaylandIviSurface); + return d->m_iviId; +} + +/*! + * Returns the Wayland interface for the QWaylandIviSurface. + */ +const struct wl_interface *QWaylandIviSurface::interface() +{ + return QWaylandIviSurfacePrivate::interface(); +} + +QByteArray QWaylandIviSurface::interfaceName() +{ + return QWaylandIviSurfacePrivate::interfaceName(); +} + +/*! + * Returns the surface role for the QWaylandIviSurface. + */ +QWaylandSurfaceRole *QWaylandIviSurface::role() +{ + return &QWaylandIviSurfacePrivate::s_role; +} + +/*! + * Returns the QWaylandIviSurface corresponding to the \a resource. + */ +QWaylandIviSurface *QWaylandIviSurface::fromResource(wl_resource *resource) +{ + auto iviSurfaceResource = QWaylandIviSurfacePrivate::Resource::fromResource(resource); + if (!iviSurfaceResource) + return nullptr; + return static_cast<QWaylandIviSurfacePrivate *>(iviSurfaceResource->ivi_surface_object)->q_func(); +} + +/*! + * Sends a configure event to the client, telling it to resize the surface to the given \a size. + */ +void QWaylandIviSurface::sendConfigure(const QSize &size) +{ + Q_D(QWaylandIviSurface); + d->send_configure(size.width(), size.height()); +} + +#ifdef QT_WAYLAND_COMPOSITOR_QUICK +QWaylandQuickShellIntegration *QWaylandIviSurface::createIntegration(QWaylandQuickShellSurfaceItem *item) +{ + return nullptr; // TODO +} +#endif + +/*! + * \internal + */ +void QWaylandIviSurface::initialize() +{ + QWaylandShellSurfaceTemplate::initialize(); +} + +QWaylandIviSurfacePrivate::QWaylandIviSurfacePrivate() + : QWaylandCompositorExtensionPrivate() + , ivi_surface() + , m_iviApplication(nullptr) + , m_surface(nullptr) + , m_iviId(UINT_MAX) +{ +} + +void QWaylandIviSurfacePrivate::ivi_surface_destroy_resource(QtWaylandServer::ivi_surface::Resource *resource) +{ + Q_UNUSED(resource); + Q_Q(QWaylandIviSurface); + QWaylandIviApplicationPrivate::get(m_iviApplication)->unregisterIviSurface(q); + delete q; +} + +void QWaylandIviSurfacePrivate::ivi_surface_destroy(QtWaylandServer::ivi_surface::Resource *resource) +{ + wl_resource_destroy(resource->handle); +} + +QT_END_NAMESPACE diff --git a/src/compositor/extensions/qwaylandivisurface.h b/src/compositor/extensions/qwaylandivisurface.h new file mode 100644 index 000000000..37c37c0f3 --- /dev/null +++ b/src/compositor/extensions/qwaylandivisurface.h @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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 QWAYLANDIVISURFACE_H +#define QWAYLANDIVISURFACE_H + +#include <QtWaylandCompositor/QWaylandShellSurface> + +class QWaylandIviSurfacePrivate; +class QWaylandSurface; +class QWaylandIviApplication; +class QWaylandSurfaceRole; +class QWaylandResource; +class wl_resource; + +QT_BEGIN_NAMESPACE + +class Q_WAYLAND_COMPOSITOR_EXPORT QWaylandIviSurface : public QWaylandShellSurfaceTemplate<QWaylandIviSurface> +{ + Q_OBJECT + Q_DECLARE_PRIVATE(QWaylandIviSurface) + Q_PROPERTY(QWaylandSurface *surface READ surface NOTIFY surfaceChanged) + Q_PROPERTY(uint iviId READ iviId NOTIFY iviIdChanged) + +public: + QWaylandIviSurface(); + QWaylandIviSurface(QWaylandIviApplication *application, QWaylandSurface *surface, uint iviId, const QWaylandResource &resource); + + Q_INVOKABLE void initialize(QWaylandIviApplication *iviApplication, QWaylandSurface *surface, + uint iviId, const QWaylandResource &resource); + + QWaylandSurface *surface() const; + uint iviId() const; + + static const struct wl_interface *interface(); + static QByteArray interfaceName(); + static QWaylandSurfaceRole *role(); + static QWaylandIviSurface *fromResource(::wl_resource *resource); + + Q_INVOKABLE void sendConfigure(const QSize &size); + +#ifdef QT_WAYLAND_COMPOSITOR_QUICK + QWaylandQuickShellIntegration *createIntegration(QWaylandQuickShellSurfaceItem *item) Q_DECL_OVERRIDE; +#endif + +Q_SIGNALS: + void surfaceChanged(); + void iviIdChanged(); + +private: + void initialize(); +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDIVISURFACE_H diff --git a/src/compositor/extensions/qwaylandivisurface_p.h b/src/compositor/extensions/qwaylandivisurface_p.h new file mode 100644 index 000000000..db237721d --- /dev/null +++ b/src/compositor/extensions/qwaylandivisurface_p.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** Copyright (C) 2016 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 QWAYLANDIVISURFACE_P_H +#define QWAYLANDIVISURFACE_P_H + +#include <QtWaylandCompositor/private/qwaylandcompositorextension_p.h> +#include <QtWaylandCompositor/private/qwayland-server-ivi-application.h> + +#include <QtWaylandCompositor/QWaylandIviSurface> + +#include <QtWaylandCompositor/QWaylandSurfaceRole> + +// +// 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_WAYLAND_COMPOSITOR_EXPORT QWaylandIviSurfacePrivate + : public QWaylandCompositorExtensionPrivate + , public QtWaylandServer::ivi_surface +{ + Q_DECLARE_PUBLIC(QWaylandIviSurface) + +public: + QWaylandIviSurfacePrivate(); + static QWaylandIviSurfacePrivate *get(QWaylandIviSurface *iviSurface) { return iviSurface->d_func(); } + +protected: + void ivi_surface_destroy_resource(Resource *resource) Q_DECL_OVERRIDE; + void ivi_surface_destroy(Resource *resource) Q_DECL_OVERRIDE; + +private: + QWaylandIviApplication *m_iviApplication; + QWaylandSurface *m_surface; + uint m_iviId; + + static QWaylandSurfaceRole s_role; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDIVISURFACE_P_H |