summaryrefslogtreecommitdiffstats
path: root/src/client
diff options
context:
space:
mode:
authorJohan Klokkhammer Helsing <johan.helsing@qt.io>2016-08-05 10:10:58 +0200
committerJohan Helsing <johan.helsing@qt.io>2016-08-09 10:58:10 +0000
commitb3b4778c237c43cfde02c4750017c37112c315c4 (patch)
tree9e9d8e01aa485386d2dd5b8a652ec0b17ca5d3ec /src/client
parent1db3dee9432f28f35ec9c971444b8a889bbdd6e2 (diff)
Make wl_shell and xdg_shell use the QWaylandShellIntegration interface
This simplifies the code in QWaylandDisplay and hopefully makes it easier to implement a prioritized shell selection mechanism later. Change-Id: I2bb3a13f8acedb60a6606cb3a8b5b228095eadf9 Reviewed-by: Giulio Camuffo <giulio.camuffo@kdab.com>
Diffstat (limited to 'src/client')
-rw-r--r--src/client/client.pro4
-rw-r--r--src/client/qwaylanddisplay.cpp31
-rw-r--r--src/client/qwaylanddisplay_p.h6
-rw-r--r--src/client/qwaylandintegration.cpp43
-rw-r--r--src/client/qwaylandintegration_p.h1
-rw-r--r--src/client/qwaylandwlshellintegration.cpp62
-rw-r--r--src/client/qwaylandwlshellintegration_p.h72
-rw-r--r--src/client/qwaylandxdgshell.cpp5
-rw-r--r--src/client/qwaylandxdgshell_p.h4
-rw-r--r--src/client/qwaylandxdgshellintegration.cpp63
-rw-r--r--src/client/qwaylandxdgshellintegration_p.h73
-rw-r--r--src/client/qwaylandxdgsurface.cpp9
-rw-r--r--src/client/qwaylandxdgsurface_p.h4
13 files changed, 337 insertions, 40 deletions
diff --git a/src/client/client.pro b/src/client/client.pro
index 59234b14e..d2d12d9fd 100644
--- a/src/client/client.pro
+++ b/src/client/client.pro
@@ -59,8 +59,10 @@ SOURCES += qwaylandintegration.cpp \
qwaylanddatasource.cpp \
qwaylandshellsurface.cpp \
qwaylandwlshellsurface.cpp \
+ qwaylandwlshellintegration.cpp \
qwaylandxdgshell.cpp \
qwaylandxdgsurface.cpp \
+ qwaylandxdgshellintegration.cpp \
qwaylandextendedsurface.cpp \
qwaylandsubsurface.cpp \
qwaylandtouch.cpp \
@@ -92,8 +94,10 @@ HEADERS += qwaylandintegration_p.h \
qwaylanddatasource_p.h \
qwaylandshellsurface_p.h \
qwaylandwlshellsurface_p.h \
+ qwaylandwlshellintegration_p.h \
qwaylandxdgshell_p.h \
qwaylandxdgsurface_p.h \
+ qwaylandxdgshellintegration_p.h \
qwaylandextendedsurface_p.h \
qwaylandsubsurface_p.h \
qwaylandtouch_p.h \
diff --git a/src/client/qwaylanddisplay.cpp b/src/client/qwaylanddisplay.cpp
index 682172bf8..7225d24af 100644
--- a/src/client/qwaylanddisplay.cpp
+++ b/src/client/qwaylanddisplay.cpp
@@ -77,16 +77,8 @@ struct wl_surface *QWaylandDisplay::createSurface(void *handle)
QWaylandShellSurface *QWaylandDisplay::createShellSurface(QWaylandWindow *window)
{
- if (mWaylandIntegration->shellIntegration())
- return mWaylandIntegration->shellIntegration()->createShellSurface(window);
-
- 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);
- }
-
- return Q_NULLPTR;
+ Q_ASSERT(mWaylandIntegration->shellIntegration());
+ return mWaylandIntegration->shellIntegration()->createShellSurface(window);
}
struct ::wl_region *QWaylandDisplay::createRegion(const QRegion &qregion)
@@ -248,11 +240,6 @@ void QWaylandDisplay::registry_global(uint32_t id, const QString &interface, uin
mCompositor.init(registry, id, mCompositorVersion);
} else if (interface == QStringLiteral("wl_shm")) {
mShm = static_cast<struct wl_shm *>(wl_registry_bind(registry, id, &wl_shm_interface,1));
- } else if (interface == QStringLiteral("xdg_shell")
- && qEnvironmentVariableIsSet("QT_WAYLAND_USE_XDG_SHELL")) {
- mShellXdg.reset(new QWaylandXdgShell(registry,id));
- } else if (interface == QStringLiteral("wl_shell")){
- mShell.reset(new QtWayland::wl_shell(registry, id, 1));
} else if (interface == QStringLiteral("wl_seat")) {
QWaylandInputDevice *inputDevice = mWaylandIntegration->createInputDevice(this, version, id);
mInputDevices.append(inputDevice);
@@ -301,6 +288,15 @@ void QWaylandDisplay::registry_global_remove(uint32_t id)
}
}
+bool QWaylandDisplay::hasRegistryGlobal(const QString &interfaceName)
+{
+ Q_FOREACH (const RegistryGlobal &global, mGlobals)
+ if (global.interface == interfaceName)
+ return true;
+
+ return false;
+}
+
void QWaylandDisplay::addRegistryListener(RegistryListener listener, void *data)
{
Listener l = { listener, data };
@@ -356,11 +352,6 @@ void QWaylandDisplay::forceRoundTrip()
wl_callback_destroy(callback);
}
-QtWayland::xdg_shell *QWaylandDisplay::shellXdg()
-{
- return mShellXdg.data();
-}
-
bool QWaylandDisplay::supportsWindowDecoration() const
{
static bool disabled = qgetenv("QT_WAYLAND_DISABLE_WINDOWDECORATION").toInt();
diff --git a/src/client/qwaylanddisplay_p.h b/src/client/qwaylanddisplay_p.h
index 3f5538ec2..ea127d2f4 100644
--- a/src/client/qwaylanddisplay_p.h
+++ b/src/client/qwaylanddisplay_p.h
@@ -128,9 +128,6 @@ public:
QtWayland::wl_compositor *compositor() { return &mCompositor; }
int compositorVersion() const { return mCompositorVersion; }
- QtWayland::wl_shell *shell() { return mShell.data(); }
- QtWayland::xdg_shell *shellXdg();
-
QList<QWaylandInputDevice *> inputDevices() const { return mInputDevices; }
QWaylandInputDevice *defaultInputDevice() const;
QWaylandInputDevice *currentInputDevice() const { return defaultInputDevice(); }
@@ -151,6 +148,7 @@ public:
: id(id_), interface(interface_), version(version_), registry(registry_) { }
};
QList<RegistryGlobal> globals() const { return mGlobals; }
+ bool hasRegistryGlobal(const QString &interfaceName);
/* wl_registry_add_listener does not add but rather sets a listener, so this function is used
* to enable many listeners at once. */
@@ -193,8 +191,6 @@ private:
struct wl_display *mDisplay;
QtWayland::wl_compositor mCompositor;
struct wl_shm *mShm;
- QScopedPointer<QtWayland::wl_shell> mShell;
- QScopedPointer<QWaylandXdgShell> mShellXdg;
QList<QWaylandScreen *> mScreens;
QList<QWaylandInputDevice *> mInputDevices;
QList<Listener> mRegistryListeners;
diff --git a/src/client/qwaylandintegration.cpp b/src/client/qwaylandintegration.cpp
index 39fff533d..e62ef87f1 100644
--- a/src/client/qwaylandintegration.cpp
+++ b/src/client/qwaylandintegration.cpp
@@ -69,6 +69,8 @@
#include "qwaylandshellintegration_p.h"
#include "qwaylandshellintegrationfactory_p.h"
+#include "qwaylandxdgshellintegration_p.h"
+#include "qwaylandwlshellintegration_p.h"
#include "qwaylandinputdeviceintegration_p.h"
#include "qwaylandinputdeviceintegrationfactory_p.h"
@@ -360,17 +362,29 @@ void QWaylandIntegration::initializeShellIntegration()
QByteArray integrationName = qgetenv("QT_WAYLAND_SHELL_INTEGRATION");
QString targetKey = QString::fromLocal8Bit(integrationName);
- if (targetKey.isEmpty()) {
- return;
+ if (!targetKey.isEmpty()) {
+ QStringList keys = QWaylandShellIntegrationFactory::keys();
+ if (keys.contains(targetKey)) {
+ qDebug("Using the '%s' shell integration", qPrintable(targetKey));
+ mShellIntegration = QWaylandShellIntegrationFactory::create(targetKey, QStringList());
+ }
+ } else {
+ QStringList preferredShells;
+ if (qEnvironmentVariableIsSet("QT_WAYLAND_USE_XDG_SHELL"))
+ preferredShells << QLatin1String("xdg_shell");
+ preferredShells << QLatin1String("wl_shell");
+
+ Q_FOREACH (QString preferredShell, preferredShells) {
+ if (mDisplay->hasRegistryGlobal(preferredShell)) {
+ mShellIntegration = createShellIntegration(preferredShell);
+ break;
+ }
+ }
}
- QStringList keys = QWaylandShellIntegrationFactory::keys();
- if (keys.contains(targetKey)) {
- mShellIntegration = QWaylandShellIntegrationFactory::create(targetKey, QStringList());
- }
- if (mShellIntegration && mShellIntegration->initialize(mDisplay)) {
- qDebug("Using the '%s' shell integration", qPrintable(targetKey));
- } else {
+ Q_ASSERT(mShellIntegration);
+
+ if (!mShellIntegration->initialize(mDisplay)) {
delete mShellIntegration;
mShellIntegration = Q_NULLPTR;
qWarning("Failed to load shell integration %s", qPrintable(targetKey));
@@ -403,6 +417,17 @@ void QWaylandIntegration::initializeInputDeviceIntegration()
}
}
+QWaylandShellIntegration *QWaylandIntegration::createShellIntegration(const QString &interfaceName)
+{
+ if (interfaceName == QLatin1Literal("wl_shell")) {
+ return new QWaylandWlShellIntegration(mDisplay);
+ } else if (interfaceName == QLatin1Literal("xdg_shell")) {
+ return new QWaylandXdgShellIntegration(mDisplay);
+ } else {
+ return Q_NULLPTR;
+ }
+}
+
}
QT_END_NAMESPACE
diff --git a/src/client/qwaylandintegration_p.h b/src/client/qwaylandintegration_p.h
index 987d80599..671f7de28 100644
--- a/src/client/qwaylandintegration_p.h
+++ b/src/client/qwaylandintegration_p.h
@@ -115,6 +115,7 @@ private:
void initializeServerBufferIntegration();
void initializeShellIntegration();
void initializeInputDeviceIntegration();
+ QWaylandShellIntegration *createShellIntegration(const QString& interfaceName);
QPlatformFontDatabase *mFontDb;
QPlatformClipboard *mClipboard;
diff --git a/src/client/qwaylandwlshellintegration.cpp b/src/client/qwaylandwlshellintegration.cpp
new file mode 100644
index 000000000..6a9220d26
--- /dev/null
+++ b/src/client/qwaylandwlshellintegration.cpp
@@ -0,0 +1,62 @@
+/****************************************************************************
+**
+** 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 "qwaylandwlshellintegration_p.h"
+
+#include <QtWaylandClient/private/qwaylandwindow_p.h>
+#include <QtWaylandClient/private/qwaylanddisplay_p.h>
+#include <QtWaylandClient/private/qwaylandwlshellsurface_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+QWaylandWlShellIntegration::QWaylandWlShellIntegration(QWaylandDisplay *display)
+ : m_wlShell(Q_NULLPTR)
+{
+ Q_FOREACH (QWaylandDisplay::RegistryGlobal global, display->globals()) {
+ if (global.interface == QLatin1String("wl_shell")) {
+ m_wlShell = new QtWayland::wl_shell(display->wl_registry(), global.id, 1);
+ break;
+ }
+ }
+}
+
+QWaylandShellSurface *QWaylandWlShellIntegration::createShellSurface(QWaylandWindow *window)
+{
+ return new QWaylandWlShellSurface(m_wlShell->get_shell_surface(window->object()), window);
+}
+
+}
+
+QT_END_NAMESPACE
diff --git a/src/client/qwaylandwlshellintegration_p.h b/src/client/qwaylandwlshellintegration_p.h
new file mode 100644
index 000000000..8531eb3aa
--- /dev/null
+++ b/src/client/qwaylandwlshellintegration_p.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** 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 QWAYLANDWLSHELLINTEGRATION_P_H
+#define QWAYLANDWLSHELLINTEGRATION_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 <wayland-client.h>
+#include <private/qwayland-wayland.h>
+
+#include <QtWaylandClient/private/qwaylandshellintegration_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellIntegration : public QWaylandShellIntegration
+{
+public:
+ QWaylandWlShellIntegration(QWaylandDisplay* display);
+ bool initialize(QWaylandDisplay *) Q_DECL_OVERRIDE { return m_wlShell != Q_NULLPTR; }
+ QWaylandShellSurface *createShellSurface(QWaylandWindow *window) Q_DECL_OVERRIDE;
+
+private:
+ QtWayland::wl_shell *m_wlShell;
+};
+
+}
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDWLSHELLINTEGRATION_P_H
diff --git a/src/client/qwaylandxdgshell.cpp b/src/client/qwaylandxdgshell.cpp
index 65fafcead..9b351da6a 100644
--- a/src/client/qwaylandxdgshell.cpp
+++ b/src/client/qwaylandxdgshell.cpp
@@ -37,6 +37,7 @@
#include "qwaylandwindow_p.h"
#include "qwaylandinputdevice_p.h"
#include "qwaylandscreen_p.h"
+#include "qwaylandxdgsurface_p.h"
#include <QtCore/QDebug>
@@ -60,6 +61,10 @@ QWaylandXdgShell::~QWaylandXdgShell()
xdg_shell_destroy(object());
}
+QWaylandXdgSurface *QWaylandXdgShell::createXdgSurface(QWaylandWindow *window)
+{
+ return new QWaylandXdgSurface(this, window);
+}
void QWaylandXdgShell::xdg_shell_ping(uint32_t serial)
{
diff --git a/src/client/qwaylandxdgshell_p.h b/src/client/qwaylandxdgshell_p.h
index 3fd248fc4..cd1656415 100644
--- a/src/client/qwaylandxdgshell_p.h
+++ b/src/client/qwaylandxdgshell_p.h
@@ -61,15 +61,17 @@ namespace QtWaylandClient {
class QWaylandWindow;
class QWaylandInputDevice;
+class QWaylandXdgSurface;
class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShell : public QtWayland::xdg_shell
{
public:
QWaylandXdgShell(struct ::xdg_shell *shell);
QWaylandXdgShell(struct ::wl_registry *registry, uint32_t id);
-
virtual ~QWaylandXdgShell();
+ QWaylandXdgSurface *createXdgSurface(QWaylandWindow *window);
+
private:
void xdg_shell_ping(uint32_t serial) Q_DECL_OVERRIDE;
};
diff --git a/src/client/qwaylandxdgshellintegration.cpp b/src/client/qwaylandxdgshellintegration.cpp
new file mode 100644
index 000000000..5a569129f
--- /dev/null
+++ b/src/client/qwaylandxdgshellintegration.cpp
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** 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 "qwaylandxdgshellintegration_p.h"
+
+#include <QtWaylandClient/private/qwaylandwindow_p.h>
+#include <QtWaylandClient/private/qwaylanddisplay_p.h>
+#include <QtWaylandClient/private/qwaylandxdgsurface_p.h>
+#include <QtWaylandClient/private/qwaylandxdgshell_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+QWaylandXdgShellIntegration::QWaylandXdgShellIntegration(QWaylandDisplay *display)
+ : m_xdgShell(Q_NULLPTR)
+{
+ Q_FOREACH (QWaylandDisplay::RegistryGlobal global, display->globals()) {
+ if (global.interface == QLatin1String("xdg_shell")) {
+ m_xdgShell = new QWaylandXdgShell(display->wl_registry(), global.id);
+ break;
+ }
+ }
+}
+
+QWaylandShellSurface *QWaylandXdgShellIntegration::createShellSurface(QWaylandWindow *window)
+{
+ return m_xdgShell->createXdgSurface(window);
+}
+
+}
+
+QT_END_NAMESPACE
diff --git a/src/client/qwaylandxdgshellintegration_p.h b/src/client/qwaylandxdgshellintegration_p.h
new file mode 100644
index 000000000..29374ff1d
--- /dev/null
+++ b/src/client/qwaylandxdgshellintegration_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 QWAYLANDXDGSHELLINTEGRATION_P_H
+#define QWAYLANDXDGSHELLINTEGRATION_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 <wayland-client.h>
+
+#include <QtWaylandClient/private/qwaylandshellintegration_p.h>
+
+QT_BEGIN_NAMESPACE
+
+namespace QtWaylandClient {
+
+class QWaylandXdgShell;
+
+class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellIntegration : public QWaylandShellIntegration
+{
+public:
+ QWaylandXdgShellIntegration(QWaylandDisplay *display);
+ bool initialize(QWaylandDisplay *) Q_DECL_OVERRIDE { return m_xdgShell != Q_NULLPTR; }
+ QWaylandShellSurface *createShellSurface(QWaylandWindow *window) Q_DECL_OVERRIDE;
+
+private:
+ QWaylandXdgShell *m_xdgShell;
+};
+
+}
+
+QT_END_NAMESPACE
+
+#endif // QWAYLANDXDGSHELLINTEGRATION_P_H
diff --git a/src/client/qwaylandxdgsurface.cpp b/src/client/qwaylandxdgsurface.cpp
index bbda03dc3..f44e2d9fe 100644
--- a/src/client/qwaylandxdgsurface.cpp
+++ b/src/client/qwaylandxdgsurface.cpp
@@ -39,16 +39,18 @@
#include "qwaylandabstractdecoration_p.h"
#include "qwaylandscreen_p.h"
#include "qwaylandextendedsurface_p.h"
+#include "qwaylandxdgshell_p.h"
QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
-QWaylandXdgSurface::QWaylandXdgSurface(struct ::xdg_surface *xdg_surface, QWaylandWindow *window)
+QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *shell, QWaylandWindow *window)
: QWaylandShellSurface(window)
- , QtWayland::xdg_surface(xdg_surface)
+ , QtWayland::xdg_surface(shell->get_xdg_surface(window->object()))
, m_window(window)
+ , m_shell(shell)
, m_maximized(false)
, m_minimized(false)
, m_fullscreen(false)
@@ -130,8 +132,7 @@ void QWaylandXdgSurface::updateTransientParent(QWindow *parent)
QWaylandWindow *parent_wayland_window = static_cast<QWaylandWindow *>(parent->handle());
if (!parent_wayland_window)
return;
- QtWayland::xdg_shell *shell = parent_wayland_window->display()->shellXdg();
- set_parent(shell->get_xdg_surface(parent_wayland_window->object()));
+ set_parent(m_shell->get_xdg_surface(parent_wayland_window->object()));
}
void QWaylandXdgSurface::setTitle(const QString & title)
diff --git a/src/client/qwaylandxdgsurface_p.h b/src/client/qwaylandxdgsurface_p.h
index bc72820a1..51c658ea4 100644
--- a/src/client/qwaylandxdgsurface_p.h
+++ b/src/client/qwaylandxdgsurface_p.h
@@ -63,13 +63,14 @@ namespace QtWaylandClient {
class QWaylandWindow;
class QWaylandInputDevice;
class QWaylandExtendedSurface;
+class QWaylandXdgShell;
class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurface : public QWaylandShellSurface
, public QtWayland::xdg_surface
{
Q_OBJECT
public:
- QWaylandXdgSurface(struct ::xdg_surface *shell_surface, QWaylandWindow *window);
+ QWaylandXdgSurface(QWaylandXdgShell *shell, QWaylandWindow *window);
virtual ~QWaylandXdgSurface();
using QtWayland::xdg_surface::resize;
@@ -105,6 +106,7 @@ private:
private:
QWaylandWindow *m_window;
+ QWaylandXdgShell* m_shell;
bool m_maximized;
bool m_minimized;
bool m_fullscreen;