From 7dc63af65b8a29978bb84ea25521c96e98705a41 Mon Sep 17 00:00:00 2001 From: Manuel Bachmann Date: Mon, 8 Sep 2014 10:20:40 +0200 Subject: [PATCH 2/2] Implement initial IVI-Shell support IVI-Shell provides a shell interface for Weston, which maps the GENIVI API (http://www.genivi.org) for In-Vehicle Infotainment. This patch enables detecting the IVI-Shell interface at runtime, and creating compatible surfaces if found. Task-number: QTBUG-XXXXX/part/2of2 --- src/client/client.pro | 5 ++ src/client/qwaylanddisplay.cpp | 15 ++++- src/client/qwaylanddisplay_p.h | 5 ++ src/client/qwaylandivishell.cpp | 69 +++++++++++++++++++ src/client/qwaylandivishell_p.h | 70 ++++++++++++++++++++ src/client/qwaylandivisurface.cpp | 131 +++++++++++++++++++++++++++++++++++++ src/client/qwaylandivisurface_p.h | 97 +++++++++++++++++++++++++++ 7 files changed, 391 insertions(+), 1 deletion(-) create mode 100644 src/client/qwaylandivishell.cpp create mode 100644 src/client/qwaylandivishell_p.h create mode 100644 src/client/qwaylandivisurface.cpp create mode 100644 src/client/qwaylandivisurface_p.h diff --git a/src/client/client.pro b/src/client/client.pro index 6aaa254..bd15b39 100644 --- a/src/client/client.pro +++ b/src/client/client.pro @@ -44,6 +44,7 @@ WAYLANDCLIENTSOURCES += \ ../extensions/windowmanager.xml \ ../3rdparty/protocol/text.xml \ ../3rdparty/protocol/xdg-shell.xml \ + ../3rdparty/protocol/ivi-application.xml \ SOURCES += qwaylandintegration.cpp \ qwaylandnativeinterface.cpp \ @@ -63,6 +64,8 @@ SOURCES += qwaylandintegration.cpp \ qwaylandwlshellsurface.cpp \ qwaylandxdgshell.cpp \ qwaylandxdgsurface.cpp \ + qwaylandivishell.cpp \ + qwaylandivisurface.cpp \ qwaylandextendedoutput.cpp \ qwaylandextendedsurface.cpp \ qwaylandsubsurface.cpp \ @@ -94,6 +97,8 @@ HEADERS += qwaylandintegration_p.h \ qwaylandwlshellsurface_p.h \ qwaylandxdgshell_p.h \ qwaylandxdgsurface_p.h \ + qwaylandivishell_p.h \ + qwaylandivisurface_p.h \ qwaylandextendedoutput_p.h \ qwaylandextendedsurface_p.h \ qwaylandsubsurface_p.h \ diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp index 595d2ce..f05a361 100644 --- a/src/client/qwaylanddisplay.cpp +++ b/src/client/qwaylanddisplay.cpp @@ -50,9 +50,12 @@ #include "qwaylandclipboard_p.h" #include "qwaylanddatadevicemanager_p.h" #include "qwaylandhardwareintegration_p.h" +#include "qwaylandivishell_p.h" +#include "qwaylandivisurface_p.h" #include "qwaylandxdgshell_p.h" #include "qwaylandxdgsurface_p.h" #include "qwaylandwlshellsurface_p.h" +#define IVI_SURFACE_ID 8000 #include "qwaylandwindowmanagerintegration_p.h" #include "qwaylandshellintegration_p.h" @@ -65,6 +68,7 @@ #include #include +#include #include #include @@ -87,7 +91,9 @@ QWaylandShellSurface *QWaylandDisplay::createShellSurface(QWaylandWindow *window if (mWaylandIntegration->shellIntegration()) return mWaylandIntegration->shellIntegration()->createShellSurface(window); - if (shellXdg()) { + if (shellIvi()) { + return new QWaylandIviSurface(shellIvi()->surface_create(IVI_SURFACE_ID + getpid(), window->object()), window); + } else if (shellXdg()) { return new QWaylandXdgSurface(shellXdg()->get_xdg_surface(window->object()), window); } else if (shell()) { return new QWaylandWlShellSurface(shell()->get_shell_surface(window->object()), window); @@ -222,6 +228,8 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin mCompositor.init(registry, id, 3); } else if (interface == QStringLiteral("wl_shm")) { mShm = static_cast(wl_registry_bind(registry, id, &wl_shm_interface,1)); + } else if (interface == QStringLiteral("ivi_application")) { + mShellIvi.reset(new QWaylandIviShell(registry,id)); } else if (interface == QStringLiteral("xdg_shell") && qEnvironmentVariableIsSet("QT_WAYLAND_USE_XDG_SHELL")) { mShellXdg.reset(new QWaylandXdgShell(registry,id)); @@ -323,4 +331,9 @@ QtWayland::xdg_shell *QWaylandDisplay::shellXdg() return mShellXdg.data(); } +QtWayland::ivi_application *QWaylandDisplay::shellIvi() +{ + return mShellIvi.data(); +} + QT_END_NAMESPACE diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h index 6ed30d1..d5c1cc5 100644 --- a/src/client/qwaylanddisplay_p.h +++ b/src/client/qwaylanddisplay_p.h @@ -52,6 +52,7 @@ #include #include #include +#include struct wl_cursor_image; @@ -72,6 +73,7 @@ class QWaylandWindow; class QWaylandEventThread; class QWaylandIntegration; class QWaylandHardwareIntegration; +class QWaylandIviShell; class QWaylandXdgShell; class QWaylandShellSurface; @@ -82,6 +84,7 @@ namespace QtWayland { class qt_surface_extension; class wl_text_input_manager; class xdg_shell; + class ivi_application; } typedef void (*RegistryListener)(void *data, @@ -119,6 +122,7 @@ public: QtWayland::wl_shell *shell() { return mShell.data(); } QtWayland::xdg_shell *shellXdg(); + QtWayland::ivi_application *shellIvi(); QList inputDevices() const { return mInputDevices; } QWaylandInputDevice *defaultInputDevice() const; @@ -176,6 +180,7 @@ private: QWaylandEventThread *mEventThreadObject; QScopedPointer mShell; QScopedPointer mShellXdg; + QScopedPointer mShellIvi; QList mScreens; QList mInputDevices; QList mRegistryListeners; diff --git a/src/client/qwaylandivishell.cpp b/src/client/qwaylandivishell.cpp new file mode 100644 index 0000000..8540489 --- /dev/null +++ b/src/client/qwaylandivishell.cpp @@ -0,0 +1,69 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Eurogiciel, author: +** Contact: http://www.qt-project.org/legal +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandivishell_p.h" + +#include "qwaylanddisplay_p.h" +#include "qwaylandwindow_p.h" +#include "qwaylandinputdevice_p.h" +#include "qwaylanddecoration_p.h" +#include "qwaylandscreen_p.h" + +#include + +QT_BEGIN_NAMESPACE + +QWaylandIviShell::QWaylandIviShell(struct ::ivi_application *shell) + : QtWayland::ivi_application(shell) +{ +} + +QWaylandIviShell::QWaylandIviShell(struct ::wl_registry *registry, uint32_t id) + : QtWayland::ivi_application(registry, id, 1) +{ +} + +QWaylandIviShell::~QWaylandIviShell() +{ + ivi_application_destroy(object()); +} + +QT_END_NAMESPACE diff --git a/src/client/qwaylandivishell_p.h b/src/client/qwaylandivishell_p.h new file mode 100644 index 0000000..f9f6983 --- /dev/null +++ b/src/client/qwaylandivishell_p.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2014 Eurogiciel, author: +** Contact: http://www.qt-project.org/legal +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDIVISHELL_H +#define QWAYLANDIVISHELL_H + +#include + +#include + +#include +#include +#include "qwaylandshellsurface_p.h" + +QT_BEGIN_NAMESPACE + +class QWaylandWindow; +class QWaylandInputDevice; +class QWindow; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandIviShell : public QtWayland::ivi_application +{ +public: + QWaylandIviShell(struct ::ivi_application *shell); + QWaylandIviShell(struct ::wl_registry *registry, uint32_t id); + + virtual ~QWaylandIviShell(); +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDIVISHELL_H diff --git a/src/client/qwaylandivisurface.cpp b/src/client/qwaylandivisurface.cpp new file mode 100644 index 0000000..d3ea5f0 --- /dev/null +++ b/src/client/qwaylandivisurface.cpp @@ -0,0 +1,131 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandivisurface_p.h" + +#include "qwaylanddisplay_p.h" +#include "qwaylandwindow_p.h" +#include "qwaylandinputdevice_p.h" +#include "qwaylanddecoration_p.h" +#include "qwaylandscreen_p.h" +#include "qwaylandextendedsurface_p.h" + +#include + +QT_BEGIN_NAMESPACE + +QWaylandIviSurface::QWaylandIviSurface(struct ::ivi_surface *ivi_surface, QWaylandWindow *window) + : QtWayland::ivi_surface(ivi_surface) + , QWaylandShellSurface(window) + , m_window(window) + , m_extendedWindow(Q_NULLPTR) +{ + if (window->display()->windowExtension()) + m_extendedWindow = new QWaylandExtendedSurface(window); +} + +QWaylandIviSurface::~QWaylandIviSurface() +{ + ivi_surface_destroy(object()); + delete m_extendedWindow; +} + +void QWaylandIviSurface::resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) +{ +} + +void QWaylandIviSurface::move(QWaylandInputDevice *inputDevice) +{ +} + +void QWaylandIviSurface::setMaximized() +{ +} + +void QWaylandIviSurface::setFullscreen() +{ +} + +void QWaylandIviSurface::setNormal() +{ +} + +void QWaylandIviSurface::setMinimized() +{ +} + +void QWaylandIviSurface::setTopLevel() +{ +} + +void QWaylandIviSurface::updateTransientParent(QWindow *parent) +{ +} + +void QWaylandIviSurface::setTitle(const QString & title) +{ +} + +void QWaylandIviSurface::setAppId(const QString & appId) +{ +} + +void QWaylandIviSurface::raise() +{ +} + +void QWaylandIviSurface::lower() +{ +} + +void QWaylandIviSurface::setContentOrientationMask(Qt::ScreenOrientations orientation) +{ +} + +void QWaylandIviSurface::setWindowFlags(Qt::WindowFlags flags) +{ +} + +void QWaylandIviSurface::sendProperty(const QString &name, const QVariant &value) +{ +} + +QT_END_NAMESPACE diff --git a/src/client/qwaylandivisurface_p.h b/src/client/qwaylandivisurface_p.h new file mode 100644 index 0000000..5663160 --- /dev/null +++ b/src/client/qwaylandivisurface_p.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 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 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDIVISURFACE_H +#define QWAYLANDIVISURFACE_H + +#include + +#include + +#include +#include +#include "qwaylandshellsurface_p.h" + +QT_BEGIN_NAMESPACE + +class QWaylandWindow; +class QWaylandInputDevice; +class QWindow; +class QWaylandExtendedSurface; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandIviSurface : public QtWayland::ivi_surface + , public QWaylandShellSurface +{ +public: + QWaylandIviSurface(struct ::ivi_surface *shell_surface, QWaylandWindow *window); + virtual ~QWaylandIviSurface(); + + void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) Q_DECL_OVERRIDE; + void move(QWaylandInputDevice *inputDevice) Q_DECL_OVERRIDE; + + void setTitle(const QString &title) Q_DECL_OVERRIDE; + void setAppId(const QString &appId) Q_DECL_OVERRIDE; + + void raise() Q_DECL_OVERRIDE; + void lower() Q_DECL_OVERRIDE; + void setContentOrientationMask(Qt::ScreenOrientations orientation) Q_DECL_OVERRIDE; + void setWindowFlags(Qt::WindowFlags flags) Q_DECL_OVERRIDE; + void sendProperty(const QString &name, const QVariant &value) Q_DECL_OVERRIDE; + +private: + void setMaximized() Q_DECL_OVERRIDE; + void setFullscreen() Q_DECL_OVERRIDE; + void setNormal() Q_DECL_OVERRIDE; + void setMinimized() Q_DECL_OVERRIDE; + + void setTopLevel() Q_DECL_OVERRIDE; + void updateTransientParent(QWindow *parent) Q_DECL_OVERRIDE; + +private: + QWaylandWindow *m_window; + QWaylandExtendedSurface *m_extendedWindow; + + friend class QWaylandWindow; +}; + +QT_END_NAMESPACE + +#endif // QWAYLANDIVISURFACE_H -- 1.7.10.4