From 542c6392ca52f86bd5fffb6141e93ad2a1ab8fcb Mon Sep 17 00:00:00 2001 From: Giulio Camuffo Date: Sat, 2 Jul 2016 10:57:16 +0200 Subject: Add xdg_shell_v6 support for Qt clients Task-number: QTBUG-56174 Change-Id: I6610905d0c9f29be29e812bcac193ea2a7e4f107 Reviewed-by: Paul Olav Tvete Reviewed-by: Johan Helsing --- src/client/client.pro | 5 + src/client/qwaylandinputcontext.cpp | 3 +- src/client/qwaylandintegration.cpp | 5 + src/client/qwaylandshellsurface_p.h | 1 + src/client/qwaylandwindow.cpp | 19 ++- src/client/qwaylandwindow_p.h | 1 + src/client/qwaylandxdgshellv6.cpp | 246 +++++++++++++++++++++++++++ src/client/qwaylandxdgshellv6_p.h | 145 ++++++++++++++++ src/client/qwaylandxdgshellv6integration.cpp | 71 ++++++++ src/client/qwaylandxdgshellv6integration_p.h | 73 ++++++++ 10 files changed, 562 insertions(+), 7 deletions(-) create mode 100644 src/client/qwaylandxdgshellv6.cpp create mode 100644 src/client/qwaylandxdgshellv6_p.h create mode 100644 src/client/qwaylandxdgshellv6integration.cpp create mode 100644 src/client/qwaylandxdgshellv6integration_p.h (limited to 'src/client') diff --git a/src/client/client.pro b/src/client/client.pro index 7482cfd6b..04f055e6a 100644 --- a/src/client/client.pro +++ b/src/client/client.pro @@ -30,6 +30,7 @@ WAYLANDCLIENTSOURCES += \ ../extensions/qt-windowmanager.xml \ ../3rdparty/protocol/text-input-unstable-v2.xml \ ../3rdparty/protocol/xdg-shell.xml \ + ../3rdparty/protocol/xdg-shell-unstable-v6.xml \ SOURCES += qwaylandintegration.cpp \ qwaylandnativeinterface.cpp \ @@ -52,6 +53,7 @@ SOURCES += qwaylandintegration.cpp \ qwaylandxdgsurface.cpp \ qwaylandxdgpopup.cpp \ qwaylandxdgshellintegration.cpp \ + qwaylandxdgshellv6integration.cpp \ qwaylandextendedsurface.cpp \ qwaylandsubsurface.cpp \ qwaylandtouch.cpp \ @@ -67,6 +69,7 @@ SOURCES += qwaylandintegration.cpp \ qwaylanddatadevice.cpp \ qwaylandshm.cpp \ qwaylandbuffer.cpp \ + qwaylandxdgshellv6.cpp \ HEADERS += qwaylandintegration_p.h \ qwaylandnativeinterface_p.h \ @@ -90,6 +93,7 @@ HEADERS += qwaylandintegration_p.h \ qwaylandxdgsurface_p.h \ qwaylandxdgpopup_p.h \ qwaylandxdgshellintegration_p.h \ + qwaylandxdgshellv6integration_p.h \ qwaylandextendedsurface_p.h \ qwaylandsubsurface_p.h \ qwaylandtouch_p.h \ @@ -107,6 +111,7 @@ HEADERS += qwaylandintegration_p.h \ ../shared/qwaylandmimehelper_p.h \ ../shared/qwaylandxkb_p.h \ ../shared/qwaylandsharedmemoryformathelper_p.h + qwaylandxdgshellv6_p.h \ include(hardwareintegration/hardwareintegration.pri) include(shellintegration/shellintegration.pri) diff --git a/src/client/qwaylandinputcontext.cpp b/src/client/qwaylandinputcontext.cpp index 5a58d6d75..dcc4ad5c7 100644 --- a/src/client/qwaylandinputcontext.cpp +++ b/src/client/qwaylandinputcontext.cpp @@ -532,7 +532,8 @@ void QWaylandInputContext::setFocusObject(QObject *) if (mCurrentWindow && mCurrentWindow->handle()) { if (mCurrentWindow.data() != window || !inputMethodAccepted()) { struct ::wl_surface *surface = static_cast(mCurrentWindow->handle())->object(); - textInput()->disable(surface); + if (surface) + textInput()->disable(surface); mCurrentWindow.clear(); } } diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp index 748f4f29c..0dcd6b68f 100644 --- a/src/client/qwaylandintegration.cpp +++ b/src/client/qwaylandintegration.cpp @@ -77,6 +77,7 @@ #include "qwaylandshellintegrationfactory_p.h" #include "qwaylandxdgshellintegration_p.h" #include "qwaylandwlshellintegration_p.h" +#include "qwaylandxdgshellv6integration_p.h" #include "qwaylandinputdeviceintegration_p.h" #include "qwaylandinputdeviceintegrationfactory_p.h" @@ -382,8 +383,10 @@ void QWaylandIntegration::initializeShellIntegration() } } else { QStringList preferredShells; + preferredShells << QLatin1String("zxdg_shell_v6"); if (qEnvironmentVariableIsSet("QT_WAYLAND_USE_XDG_SHELL")) preferredShells << QLatin1String("xdg_shell"); + preferredShells << QLatin1String("wl_shell"); Q_FOREACH (QString preferredShell, preferredShells) { @@ -432,6 +435,8 @@ QWaylandShellIntegration *QWaylandIntegration::createShellIntegration(const QStr return new QWaylandWlShellIntegration(mDisplay.data()); } else if (interfaceName == QLatin1Literal("xdg_shell")) { return new QWaylandXdgShellIntegration(mDisplay.data()); + } else if (interfaceName == QLatin1Literal("zxdg_shell_v6")) { + return new QWaylandXdgShellV6Integration(mDisplay.data()); } else { return Q_NULLPTR; } diff --git a/src/client/qwaylandshellsurface_p.h b/src/client/qwaylandshellsurface_p.h index e700d5a18..06d92ba08 100644 --- a/src/client/qwaylandshellsurface_p.h +++ b/src/client/qwaylandshellsurface_p.h @@ -85,6 +85,7 @@ public: virtual void setWindowFlags(Qt::WindowFlags flags); virtual bool isExposed() const { return true; } + virtual bool handleExpose(const QRegion &) { return false; } virtual void raise() {} virtual void lower() {} diff --git a/src/client/qwaylandwindow.cpp b/src/client/qwaylandwindow.cpp index d16746bac..13a78d25d 100644 --- a/src/client/qwaylandwindow.cpp +++ b/src/client/qwaylandwindow.cpp @@ -304,8 +304,15 @@ void QWaylandWindow::setGeometry(const QRect &rect) mSentInitialResize = true; } + sendExposeEvent(QRect(QPoint(), geometry().size())); +} + - QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); + +void QWaylandWindow::sendExposeEvent(const QRect &rect) +{ + if (mShellSurface && !mShellSurface->handleExpose(rect)) + QWindowSystemInterface::handleExposeEvent(window(), rect); } void QWaylandWindow::setVisible(bool visible) @@ -319,7 +326,7 @@ void QWaylandWindow::setVisible(bool visible) // there was no frame before it will be stuck at the waitForFrameSync() in // QWaylandShmBackingStore::beginPaint(). } else { - QWindowSystemInterface::handleExposeEvent(window(), QRegion()); + sendExposeEvent(QRect()); // when flushing the event queue, it could contain a close event, in which // case 'this' will be deleted. When that happens, we must abort right away. QPointer deleteGuard(this); @@ -414,10 +421,10 @@ void QWaylandWindow::setCanResize(bool canResize) } if (!mConfigure.isEmpty()) { doResize(); - QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); + sendExposeEvent(QRect(QPoint(), geometry().size())); } else if (mResizeDirty) { mResizeDirty = false; - QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); + sendExposeEvent(QRect(QPoint(), geometry().size())); } } } @@ -432,7 +439,7 @@ void QWaylandWindow::requestResize() mRequestResizeSent = false; lock.unlock(); - QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); + sendExposeEvent(QRect(QPoint(), geometry().size())); QWindowSystemInterface::flushWindowSystemEvents(); } @@ -658,7 +665,7 @@ bool QWaylandWindow::createDecoration() QMargins m = frameMargins(); subsurf->set_position(pos.x() + m.left(), pos.y() + m.top()); } - QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(), geometry().size())); + sendExposeEvent(QRect(QPoint(), geometry().size())); } return mWindowDecoration; diff --git a/src/client/qwaylandwindow_p.h b/src/client/qwaylandwindow_p.h index ce295a0de..3ca8f42cc 100644 --- a/src/client/qwaylandwindow_p.h +++ b/src/client/qwaylandwindow_p.h @@ -249,6 +249,7 @@ private: bool shouldCreateShellSurface() const; bool shouldCreateSubSurface() const; void reset(); + void sendExposeEvent(const QRect &rect); void handleMouseEventWithDecoration(QWaylandInputDevice *inputDevice, const QWaylandPointerEvent &e); diff --git a/src/client/qwaylandxdgshellv6.cpp b/src/client/qwaylandxdgshellv6.cpp new file mode 100644 index 000000000..b45498d80 --- /dev/null +++ b/src/client/qwaylandxdgshellv6.cpp @@ -0,0 +1,246 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2014 Eurogiciel, author: +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandxdgshellv6_p.h" + +#include "qwaylanddisplay_p.h" +#include "qwaylandwindow_p.h" +#include "qwaylandinputdevice_p.h" +#include "qwaylandscreen_p.h" +#include "qwaylandabstractdecoration_p.h" + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandXdgSurfaceV6::Toplevel::Toplevel(QWaylandXdgSurfaceV6 *xdgSurface) + : QtWayland::zxdg_toplevel_v6(xdgSurface->get_toplevel()) + , m_xdgSurface(xdgSurface) +{ +} + +QWaylandXdgSurfaceV6::Toplevel::~Toplevel() +{ + if (isInitialized()) + destroy(); +} + +void QWaylandXdgSurfaceV6::Toplevel::applyConfigure() +{ + //TODO: resize, activate etc + m_xdgSurface->m_window->configure(0, m_configureState.width, m_configureState.height); +} + +void QWaylandXdgSurfaceV6::Toplevel::zxdg_toplevel_v6_configure(int32_t width, int32_t height, wl_array *states) +{ + m_configureState.width = width; + m_configureState.height = height; + + uint32_t *state = reinterpret_cast(states->data); + size_t numStates = states->size / sizeof(uint32_t); + m_configureState.states.reserve(numStates); + m_configureState.states.clear(); + + for (size_t i = 0; i < numStates; i++) + m_configureState.states << state[i]; +} + +void QWaylandXdgSurfaceV6::Toplevel::zxdg_toplevel_v6_close() +{ +} + +QWaylandXdgSurfaceV6::Popup::Popup(QWaylandXdgSurfaceV6 *xdgSurface, QWaylandXdgSurfaceV6 *parent, + QtWayland::zxdg_positioner_v6 *positioner) + : zxdg_popup_v6(xdgSurface->get_popup(parent->object(), positioner->object())) + , m_xdgSurface(xdgSurface) +{ +} + +QWaylandXdgSurfaceV6::Popup::~Popup() +{ + if (isInitialized()) + destroy(); +} + +void QWaylandXdgSurfaceV6::Popup::applyConfigure() +{ + +} + +void QWaylandXdgSurfaceV6::Popup::zxdg_popup_v6_popup_done() +{ + m_xdgSurface->m_window->window()->close(); +} + +QWaylandXdgSurfaceV6::QWaylandXdgSurfaceV6(QWaylandXdgShellV6 *shell, ::zxdg_surface_v6 *surface, QWaylandWindow *window) + : QWaylandShellSurface(window) + , zxdg_surface_v6(surface) + , m_shell(shell) + , m_window(window) + , m_toplevel(nullptr) + , m_popup(nullptr) + , m_configured(false) +{ +} + +QWaylandXdgSurfaceV6::~QWaylandXdgSurfaceV6() +{ + if (m_popup) + zxdg_popup_v6_destroy(m_popup->object()); + destroy(); +} + +void QWaylandXdgSurfaceV6::resize(QWaylandInputDevice *inputDevice, zxdg_toplevel_v6_resize_edge edges) +{ + Q_ASSERT(m_toplevel && m_toplevel->isInitialized()); + m_toplevel->resize(inputDevice->wl_seat(), inputDevice->serial(), edges); +} + +void QWaylandXdgSurfaceV6::resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) +{ + auto xdgEdges = reinterpret_cast(&edges); + resize(inputDevice, *xdgEdges); +} + + +void QWaylandXdgSurfaceV6::move(QWaylandInputDevice *inputDevice) +{ + Q_ASSERT(m_toplevel && m_toplevel->isInitialized()); + m_toplevel->move(inputDevice->wl_seat(), inputDevice->serial()); +} + +void QWaylandXdgSurfaceV6::setTitle(const QString &title) +{ + if (m_toplevel) + m_toplevel->set_title(title); +} + +void QWaylandXdgSurfaceV6::setAppId(const QString &appId) +{ + if (m_toplevel) + m_toplevel->set_app_id(appId); +} + +void QWaylandXdgSurfaceV6::setType(Qt::WindowType type, QWaylandWindow *transientParent) +{ + if (type == Qt::Popup && transientParent) { + setPopup(transientParent, m_window->display()->lastInputDevice(), m_window->display()->lastInputSerial()); + } else { + setToplevel(); + if (transientParent) { + auto parentXdgSurface = static_cast(transientParent->shellSurface()); + m_toplevel->set_parent(parentXdgSurface->m_toplevel->object()); + } + } +} + +bool QWaylandXdgSurfaceV6::handleExpose(const QRegion ®ion) +{ + if (!m_configured && !region.isEmpty()) { + m_exposeRegion = region; + return true; + } + return false; +} + +void QWaylandXdgSurfaceV6::setToplevel() +{ + Q_ASSERT(!m_toplevel && !m_popup); + m_toplevel = new Toplevel(this); +} + +void QWaylandXdgSurfaceV6::setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial) +{ + Q_ASSERT(!m_toplevel && !m_popup); + + auto parentXdgSurface = static_cast(parent->shellSurface()); + auto positioner = new QtWayland::zxdg_positioner_v6(m_shell->create_positioner()); + // set_popup expects a position relative to the parent + QPoint transientPos = m_window->geometry().topLeft(); // this is absolute + transientPos -= parent->geometry().topLeft(); + if (parent->decoration()) { + transientPos.setX(transientPos.x() + parent->decoration()->margins().left()); + transientPos.setY(transientPos.y() + parent->decoration()->margins().top()); + } + positioner->set_anchor_rect(transientPos.x(), transientPos.y(), 1, 1); + positioner->set_anchor(QtWayland::zxdg_positioner_v6::anchor_top | QtWayland::zxdg_positioner_v6::anchor_left); + positioner->set_gravity(QtWayland::zxdg_positioner_v6::gravity_bottom | QtWayland::zxdg_positioner_v6::gravity_right); + m_popup = new Popup(this, parentXdgSurface, positioner); + positioner->destroy(); + delete positioner; + m_popup->grab(device->wl_seat(), serial); +} + +void QWaylandXdgSurfaceV6::zxdg_surface_v6_configure(uint32_t serial) +{ + m_configured = true; + if (m_toplevel) + m_toplevel->applyConfigure(); + else if (m_popup) + m_popup->applyConfigure(); + + if (!m_exposeRegion.isEmpty()) { + QWindowSystemInterface::handleExposeEvent(m_window->window(), m_exposeRegion); + m_exposeRegion = QRegion(); + } + ack_configure(serial); +} + + + +QWaylandXdgShellV6::QWaylandXdgShellV6(struct ::wl_registry *registry, uint32_t id, uint32_t availableVersion) + : QtWayland::zxdg_shell_v6(registry, id, qMin(availableVersion, 1u)) +{ +} + +QWaylandXdgShellV6::~QWaylandXdgShellV6() +{ + destroy(); +} + +QWaylandXdgSurfaceV6 *QWaylandXdgShellV6::getXdgSurface(QWaylandWindow *window) +{ + return new QWaylandXdgSurfaceV6(this, get_xdg_surface(window->object()), window); +} + +void QWaylandXdgShellV6::zxdg_shell_v6_ping(uint32_t serial) +{ + pong(serial); +} + +} + +QT_END_NAMESPACE diff --git a/src/client/qwaylandxdgshellv6_p.h b/src/client/qwaylandxdgshellv6_p.h new file mode 100644 index 000000000..81be89de2 --- /dev/null +++ b/src/client/qwaylandxdgshellv6_p.h @@ -0,0 +1,145 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2014 Eurogiciel, author: +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDXDGSHELLV6_H +#define QWAYLANDXDGSHELLV6_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 +#include + +#include + +#include +#include +#include "qwaylandshellsurface_p.h" + +QT_BEGIN_NAMESPACE + +class QWindow; + +namespace QtWaylandClient { + +class QWaylandWindow; +class QWaylandInputDevice; +class QWaylandXdgShellV6; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurfaceV6 : public QWaylandShellSurface, public QtWayland::zxdg_surface_v6 +{ +public: + QWaylandXdgSurfaceV6(QWaylandXdgShellV6 *shell, ::zxdg_surface_v6 *surface, QWaylandWindow *window); + ~QWaylandXdgSurfaceV6(); + + void resize(QWaylandInputDevice *inputDevice, enum zxdg_toplevel_v6_resize_edge edges); + void resize(QWaylandInputDevice *inputDevice, enum wl_shell_surface_resize edges) override; + void move(QWaylandInputDevice *inputDevice) override; + void setTitle(const QString &title) override; + void setAppId(const QString &appId) override; + + void setType(Qt::WindowType type, QWaylandWindow *transientParent) override; + bool handleExpose(const QRegion &) override; + +protected: + void zxdg_surface_v6_configure(uint32_t serial) override; + +private: + class Toplevel: public QtWayland::zxdg_toplevel_v6 + { + public: + Toplevel(QWaylandXdgSurfaceV6 *xdgSurface); + ~Toplevel(); + + void applyConfigure(); + + void zxdg_toplevel_v6_configure(int32_t width, int32_t height, wl_array *states) override; + void zxdg_toplevel_v6_close() override; + + struct { + int32_t width, height; + QVarLengthArray states; + } m_configureState; + + QWaylandXdgSurfaceV6 *m_xdgSurface; + }; + + class Popup : public QtWayland::zxdg_popup_v6 { + public: + Popup(QWaylandXdgSurfaceV6 *xdgSurface, QWaylandXdgSurfaceV6 *parent, QtWayland::zxdg_positioner_v6 *positioner); + ~Popup(); + + void applyConfigure(); + void zxdg_popup_v6_popup_done() override; + + QWaylandXdgSurfaceV6 *m_xdgSurface; + }; + + void setToplevel(); + void setPopup(QWaylandWindow *parent, QWaylandInputDevice *device, int serial); + + QWaylandXdgShellV6 *m_shell; + QWaylandWindow *m_window; + Toplevel *m_toplevel; + Popup *m_popup; + bool m_configured; + QRegion m_exposeRegion; +}; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellV6 : public QtWayland::zxdg_shell_v6 +{ +public: + QWaylandXdgShellV6(struct ::wl_registry *registry, uint32_t id, uint32_t availableVersion); + + QWaylandXdgSurfaceV6 *getXdgSurface(QWaylandWindow *window); + + virtual ~QWaylandXdgShellV6(); + +private: + void zxdg_shell_v6_ping(uint32_t serial) override; +}; + +QT_END_NAMESPACE + +} + +#endif // QWAYLANDXDGSHELLV6_H diff --git a/src/client/qwaylandxdgshellv6integration.cpp b/src/client/qwaylandxdgshellv6integration.cpp new file mode 100644 index 000000000..93f319875 --- /dev/null +++ b/src/client/qwaylandxdgshellv6integration.cpp @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandxdgshellv6integration_p.h" + +#include +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +QWaylandXdgShellV6Integration::QWaylandXdgShellV6Integration(QWaylandDisplay *display) + : m_xdgShell(nullptr) +{ + for (QWaylandDisplay::RegistryGlobal global : display->globals()) { + if (global.interface == QLatin1String("zxdg_shell_v6")) { + m_xdgShell = new QWaylandXdgShellV6(display->wl_registry(), global.id, global.version); + break; + } + } +} + +bool QWaylandXdgShellV6Integration::initialize(QWaylandDisplay *display) +{ + QWaylandShellIntegration::initialize(display); + return m_xdgShell != nullptr; +} + +QWaylandShellSurface *QWaylandXdgShellV6Integration::createShellSurface(QWaylandWindow *window) +{ + return m_xdgShell->getXdgSurface(window); +} + +} + +QT_END_NAMESPACE diff --git a/src/client/qwaylandxdgshellv6integration_p.h b/src/client/qwaylandxdgshellv6integration_p.h new file mode 100644 index 000000000..2e9cdac4f --- /dev/null +++ b/src/client/qwaylandxdgshellv6integration_p.h @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2016 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL21$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and 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 2.1 or version 3 as published by the Free +** Software Foundation and appearing in the file LICENSE.LGPLv21 and +** LICENSE.LGPLv3 included in the packaging of this file. Please review the +** following information to ensure the GNU Lesser General Public License +** requirements will be met: https://www.gnu.org/licenses/lgpl.html and +** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** As a special exception, The Qt Company gives you certain additional +** rights. These rights are described in The Qt Company LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDXDGSHELLV6INTEGRATION_P_H +#define QWAYLANDXDGSHELLV6INTEGRATION_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 + +#include + +QT_BEGIN_NAMESPACE + +namespace QtWaylandClient { + +class QWaylandXdgShellV6; + +class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellV6Integration : public QWaylandShellIntegration +{ +public: + QWaylandXdgShellV6Integration(QWaylandDisplay *display); + bool initialize(QWaylandDisplay *display) override; + QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override; + +private: + QWaylandXdgShellV6 *m_xdgShell; +}; + +} + +QT_END_NAMESPACE + +#endif // QWAYLANDXDGSHELLV6INTEGRATION_P_H -- cgit v1.2.3