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>
This commit is contained in:
parent
f70756c94d
commit
1514e2dc8a
@ -59,8 +59,10 @@ SOURCES += qwaylandintegration.cpp \
|
|||||||
qwaylanddatasource.cpp \
|
qwaylanddatasource.cpp \
|
||||||
qwaylandshellsurface.cpp \
|
qwaylandshellsurface.cpp \
|
||||||
qwaylandwlshellsurface.cpp \
|
qwaylandwlshellsurface.cpp \
|
||||||
|
qwaylandwlshellintegration.cpp \
|
||||||
qwaylandxdgshell.cpp \
|
qwaylandxdgshell.cpp \
|
||||||
qwaylandxdgsurface.cpp \
|
qwaylandxdgsurface.cpp \
|
||||||
|
qwaylandxdgshellintegration.cpp \
|
||||||
qwaylandextendedsurface.cpp \
|
qwaylandextendedsurface.cpp \
|
||||||
qwaylandsubsurface.cpp \
|
qwaylandsubsurface.cpp \
|
||||||
qwaylandtouch.cpp \
|
qwaylandtouch.cpp \
|
||||||
@ -92,8 +94,10 @@ HEADERS += qwaylandintegration_p.h \
|
|||||||
qwaylanddatasource_p.h \
|
qwaylanddatasource_p.h \
|
||||||
qwaylandshellsurface_p.h \
|
qwaylandshellsurface_p.h \
|
||||||
qwaylandwlshellsurface_p.h \
|
qwaylandwlshellsurface_p.h \
|
||||||
|
qwaylandwlshellintegration_p.h \
|
||||||
qwaylandxdgshell_p.h \
|
qwaylandxdgshell_p.h \
|
||||||
qwaylandxdgsurface_p.h \
|
qwaylandxdgsurface_p.h \
|
||||||
|
qwaylandxdgshellintegration_p.h \
|
||||||
qwaylandextendedsurface_p.h \
|
qwaylandextendedsurface_p.h \
|
||||||
qwaylandsubsurface_p.h \
|
qwaylandsubsurface_p.h \
|
||||||
qwaylandtouch_p.h \
|
qwaylandtouch_p.h \
|
||||||
|
@ -77,16 +77,8 @@ struct wl_surface *QWaylandDisplay::createSurface(void *handle)
|
|||||||
|
|
||||||
QWaylandShellSurface *QWaylandDisplay::createShellSurface(QWaylandWindow *window)
|
QWaylandShellSurface *QWaylandDisplay::createShellSurface(QWaylandWindow *window)
|
||||||
{
|
{
|
||||||
if (mWaylandIntegration->shellIntegration())
|
Q_ASSERT(mWaylandIntegration->shellIntegration());
|
||||||
return mWaylandIntegration->shellIntegration()->createShellSurface(window);
|
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
struct ::wl_region *QWaylandDisplay::createRegion(const QRegion &qregion)
|
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);
|
mCompositor.init(registry, id, mCompositorVersion);
|
||||||
} else if (interface == QStringLiteral("wl_shm")) {
|
} else if (interface == QStringLiteral("wl_shm")) {
|
||||||
mShm = static_cast<struct wl_shm *>(wl_registry_bind(registry, id, &wl_shm_interface,1));
|
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")) {
|
} else if (interface == QStringLiteral("wl_seat")) {
|
||||||
QWaylandInputDevice *inputDevice = mWaylandIntegration->createInputDevice(this, version, id);
|
QWaylandInputDevice *inputDevice = mWaylandIntegration->createInputDevice(this, version, id);
|
||||||
mInputDevices.append(inputDevice);
|
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)
|
void QWaylandDisplay::addRegistryListener(RegistryListener listener, void *data)
|
||||||
{
|
{
|
||||||
Listener l = { listener, data };
|
Listener l = { listener, data };
|
||||||
@ -356,11 +352,6 @@ void QWaylandDisplay::forceRoundTrip()
|
|||||||
wl_callback_destroy(callback);
|
wl_callback_destroy(callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
QtWayland::xdg_shell *QWaylandDisplay::shellXdg()
|
|
||||||
{
|
|
||||||
return mShellXdg.data();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QWaylandDisplay::supportsWindowDecoration() const
|
bool QWaylandDisplay::supportsWindowDecoration() const
|
||||||
{
|
{
|
||||||
static bool disabled = qgetenv("QT_WAYLAND_DISABLE_WINDOWDECORATION").toInt();
|
static bool disabled = qgetenv("QT_WAYLAND_DISABLE_WINDOWDECORATION").toInt();
|
||||||
|
@ -128,9 +128,6 @@ public:
|
|||||||
QtWayland::wl_compositor *compositor() { return &mCompositor; }
|
QtWayland::wl_compositor *compositor() { return &mCompositor; }
|
||||||
int compositorVersion() const { return mCompositorVersion; }
|
int compositorVersion() const { return mCompositorVersion; }
|
||||||
|
|
||||||
QtWayland::wl_shell *shell() { return mShell.data(); }
|
|
||||||
QtWayland::xdg_shell *shellXdg();
|
|
||||||
|
|
||||||
QList<QWaylandInputDevice *> inputDevices() const { return mInputDevices; }
|
QList<QWaylandInputDevice *> inputDevices() const { return mInputDevices; }
|
||||||
QWaylandInputDevice *defaultInputDevice() const;
|
QWaylandInputDevice *defaultInputDevice() const;
|
||||||
QWaylandInputDevice *currentInputDevice() const { return defaultInputDevice(); }
|
QWaylandInputDevice *currentInputDevice() const { return defaultInputDevice(); }
|
||||||
@ -151,6 +148,7 @@ public:
|
|||||||
: id(id_), interface(interface_), version(version_), registry(registry_) { }
|
: id(id_), interface(interface_), version(version_), registry(registry_) { }
|
||||||
};
|
};
|
||||||
QList<RegistryGlobal> globals() const { return mGlobals; }
|
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
|
/* wl_registry_add_listener does not add but rather sets a listener, so this function is used
|
||||||
* to enable many listeners at once. */
|
* to enable many listeners at once. */
|
||||||
@ -193,8 +191,6 @@ private:
|
|||||||
struct wl_display *mDisplay;
|
struct wl_display *mDisplay;
|
||||||
QtWayland::wl_compositor mCompositor;
|
QtWayland::wl_compositor mCompositor;
|
||||||
struct wl_shm *mShm;
|
struct wl_shm *mShm;
|
||||||
QScopedPointer<QtWayland::wl_shell> mShell;
|
|
||||||
QScopedPointer<QWaylandXdgShell> mShellXdg;
|
|
||||||
QList<QWaylandScreen *> mScreens;
|
QList<QWaylandScreen *> mScreens;
|
||||||
QList<QWaylandInputDevice *> mInputDevices;
|
QList<QWaylandInputDevice *> mInputDevices;
|
||||||
QList<Listener> mRegistryListeners;
|
QList<Listener> mRegistryListeners;
|
||||||
|
@ -69,6 +69,8 @@
|
|||||||
|
|
||||||
#include "qwaylandshellintegration_p.h"
|
#include "qwaylandshellintegration_p.h"
|
||||||
#include "qwaylandshellintegrationfactory_p.h"
|
#include "qwaylandshellintegrationfactory_p.h"
|
||||||
|
#include "qwaylandxdgshellintegration_p.h"
|
||||||
|
#include "qwaylandwlshellintegration_p.h"
|
||||||
|
|
||||||
#include "qwaylandinputdeviceintegration_p.h"
|
#include "qwaylandinputdeviceintegration_p.h"
|
||||||
#include "qwaylandinputdeviceintegrationfactory_p.h"
|
#include "qwaylandinputdeviceintegrationfactory_p.h"
|
||||||
@ -360,17 +362,29 @@ void QWaylandIntegration::initializeShellIntegration()
|
|||||||
QByteArray integrationName = qgetenv("QT_WAYLAND_SHELL_INTEGRATION");
|
QByteArray integrationName = qgetenv("QT_WAYLAND_SHELL_INTEGRATION");
|
||||||
QString targetKey = QString::fromLocal8Bit(integrationName);
|
QString targetKey = QString::fromLocal8Bit(integrationName);
|
||||||
|
|
||||||
if (targetKey.isEmpty()) {
|
if (!targetKey.isEmpty()) {
|
||||||
return;
|
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();
|
Q_ASSERT(mShellIntegration);
|
||||||
if (keys.contains(targetKey)) {
|
|
||||||
mShellIntegration = QWaylandShellIntegrationFactory::create(targetKey, QStringList());
|
if (!mShellIntegration->initialize(mDisplay)) {
|
||||||
}
|
|
||||||
if (mShellIntegration && mShellIntegration->initialize(mDisplay)) {
|
|
||||||
qDebug("Using the '%s' shell integration", qPrintable(targetKey));
|
|
||||||
} else {
|
|
||||||
delete mShellIntegration;
|
delete mShellIntegration;
|
||||||
mShellIntegration = Q_NULLPTR;
|
mShellIntegration = Q_NULLPTR;
|
||||||
qWarning("Failed to load shell integration %s", qPrintable(targetKey));
|
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
|
QT_END_NAMESPACE
|
||||||
|
@ -115,6 +115,7 @@ private:
|
|||||||
void initializeServerBufferIntegration();
|
void initializeServerBufferIntegration();
|
||||||
void initializeShellIntegration();
|
void initializeShellIntegration();
|
||||||
void initializeInputDeviceIntegration();
|
void initializeInputDeviceIntegration();
|
||||||
|
QWaylandShellIntegration *createShellIntegration(const QString& interfaceName);
|
||||||
|
|
||||||
QPlatformFontDatabase *mFontDb;
|
QPlatformFontDatabase *mFontDb;
|
||||||
QPlatformClipboard *mClipboard;
|
QPlatformClipboard *mClipboard;
|
||||||
|
62
src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp
Normal file
62
src/plugins/platforms/wayland/qwaylandwlshellintegration.cpp
Normal file
@ -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
|
72
src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h
Normal file
72
src/plugins/platforms/wayland/qwaylandwlshellintegration_p.h
Normal file
@ -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
|
@ -37,6 +37,7 @@
|
|||||||
#include "qwaylandwindow_p.h"
|
#include "qwaylandwindow_p.h"
|
||||||
#include "qwaylandinputdevice_p.h"
|
#include "qwaylandinputdevice_p.h"
|
||||||
#include "qwaylandscreen_p.h"
|
#include "qwaylandscreen_p.h"
|
||||||
|
#include "qwaylandxdgsurface_p.h"
|
||||||
|
|
||||||
#include <QtCore/QDebug>
|
#include <QtCore/QDebug>
|
||||||
|
|
||||||
@ -60,6 +61,10 @@ QWaylandXdgShell::~QWaylandXdgShell()
|
|||||||
xdg_shell_destroy(object());
|
xdg_shell_destroy(object());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QWaylandXdgSurface *QWaylandXdgShell::createXdgSurface(QWaylandWindow *window)
|
||||||
|
{
|
||||||
|
return new QWaylandXdgSurface(this, window);
|
||||||
|
}
|
||||||
|
|
||||||
void QWaylandXdgShell::xdg_shell_ping(uint32_t serial)
|
void QWaylandXdgShell::xdg_shell_ping(uint32_t serial)
|
||||||
{
|
{
|
||||||
|
@ -61,15 +61,17 @@ namespace QtWaylandClient {
|
|||||||
|
|
||||||
class QWaylandWindow;
|
class QWaylandWindow;
|
||||||
class QWaylandInputDevice;
|
class QWaylandInputDevice;
|
||||||
|
class QWaylandXdgSurface;
|
||||||
|
|
||||||
class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShell : public QtWayland::xdg_shell
|
class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShell : public QtWayland::xdg_shell
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QWaylandXdgShell(struct ::xdg_shell *shell);
|
QWaylandXdgShell(struct ::xdg_shell *shell);
|
||||||
QWaylandXdgShell(struct ::wl_registry *registry, uint32_t id);
|
QWaylandXdgShell(struct ::wl_registry *registry, uint32_t id);
|
||||||
|
|
||||||
virtual ~QWaylandXdgShell();
|
virtual ~QWaylandXdgShell();
|
||||||
|
|
||||||
|
QWaylandXdgSurface *createXdgSurface(QWaylandWindow *window);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void xdg_shell_ping(uint32_t serial) Q_DECL_OVERRIDE;
|
void xdg_shell_ping(uint32_t serial) Q_DECL_OVERRIDE;
|
||||||
};
|
};
|
||||||
|
@ -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
|
@ -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
|
@ -39,16 +39,18 @@
|
|||||||
#include "qwaylandabstractdecoration_p.h"
|
#include "qwaylandabstractdecoration_p.h"
|
||||||
#include "qwaylandscreen_p.h"
|
#include "qwaylandscreen_p.h"
|
||||||
#include "qwaylandextendedsurface_p.h"
|
#include "qwaylandextendedsurface_p.h"
|
||||||
|
#include "qwaylandxdgshell_p.h"
|
||||||
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
namespace QtWaylandClient {
|
namespace QtWaylandClient {
|
||||||
|
|
||||||
QWaylandXdgSurface::QWaylandXdgSurface(struct ::xdg_surface *xdg_surface, QWaylandWindow *window)
|
QWaylandXdgSurface::QWaylandXdgSurface(QWaylandXdgShell *shell, QWaylandWindow *window)
|
||||||
: QWaylandShellSurface(window)
|
: QWaylandShellSurface(window)
|
||||||
, QtWayland::xdg_surface(xdg_surface)
|
, QtWayland::xdg_surface(shell->get_xdg_surface(window->object()))
|
||||||
, m_window(window)
|
, m_window(window)
|
||||||
|
, m_shell(shell)
|
||||||
, m_maximized(false)
|
, m_maximized(false)
|
||||||
, m_minimized(false)
|
, m_minimized(false)
|
||||||
, m_fullscreen(false)
|
, m_fullscreen(false)
|
||||||
@ -130,8 +132,7 @@ void QWaylandXdgSurface::updateTransientParent(QWindow *parent)
|
|||||||
QWaylandWindow *parent_wayland_window = static_cast<QWaylandWindow *>(parent->handle());
|
QWaylandWindow *parent_wayland_window = static_cast<QWaylandWindow *>(parent->handle());
|
||||||
if (!parent_wayland_window)
|
if (!parent_wayland_window)
|
||||||
return;
|
return;
|
||||||
QtWayland::xdg_shell *shell = parent_wayland_window->display()->shellXdg();
|
set_parent(m_shell->get_xdg_surface(parent_wayland_window->object()));
|
||||||
set_parent(shell->get_xdg_surface(parent_wayland_window->object()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWaylandXdgSurface::setTitle(const QString & title)
|
void QWaylandXdgSurface::setTitle(const QString & title)
|
||||||
|
@ -63,13 +63,14 @@ namespace QtWaylandClient {
|
|||||||
class QWaylandWindow;
|
class QWaylandWindow;
|
||||||
class QWaylandInputDevice;
|
class QWaylandInputDevice;
|
||||||
class QWaylandExtendedSurface;
|
class QWaylandExtendedSurface;
|
||||||
|
class QWaylandXdgShell;
|
||||||
|
|
||||||
class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurface : public QWaylandShellSurface
|
class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgSurface : public QWaylandShellSurface
|
||||||
, public QtWayland::xdg_surface
|
, public QtWayland::xdg_surface
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
QWaylandXdgSurface(struct ::xdg_surface *shell_surface, QWaylandWindow *window);
|
QWaylandXdgSurface(QWaylandXdgShell *shell, QWaylandWindow *window);
|
||||||
virtual ~QWaylandXdgSurface();
|
virtual ~QWaylandXdgSurface();
|
||||||
|
|
||||||
using QtWayland::xdg_surface::resize;
|
using QtWayland::xdg_surface::resize;
|
||||||
@ -105,6 +106,7 @@ private:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QWaylandWindow *m_window;
|
QWaylandWindow *m_window;
|
||||||
|
QWaylandXdgShell* m_shell;
|
||||||
bool m_maximized;
|
bool m_maximized;
|
||||||
bool m_minimized;
|
bool m_minimized;
|
||||||
bool m_fullscreen;
|
bool m_fullscreen;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user