Deprecate QT_WAYLAND_USE_XDG_SHELL

In favor of QT_WAYLAND_SHELL_INTEGRATION, which can be set to:

- ivi-shell
- wl-shell
- xdg-shell-v5
- xdg-shell-v6

Change-Id: Ie2ca1184f22dcac56beb441329ea8b5a9a81baf4
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
Johan Klokkhammer Helsing 2016-11-22 13:37:10 +01:00 committed by Paul Olav Tvete
parent 4f2c0f1a4e
commit 6caaf81f9b
7 changed files with 56 additions and 27 deletions

View File

@ -375,25 +375,25 @@ void QWaylandIntegration::initializeShellIntegration()
QByteArray integrationName = qgetenv("QT_WAYLAND_SHELL_INTEGRATION");
QString targetKey = QString::fromLocal8Bit(integrationName);
QStringList preferredShells;
if (!targetKey.isEmpty()) {
QStringList keys = QWaylandShellIntegrationFactory::keys();
if (keys.contains(targetKey)) {
qDebug("Using the '%s' shell integration", qPrintable(targetKey));
mShellIntegration.reset(QWaylandShellIntegrationFactory::create(targetKey, QStringList()));
}
preferredShells << targetKey;
} else {
QStringList preferredShells;
preferredShells << QLatin1String("zxdg_shell_v6");
if (qEnvironmentVariableIsSet("QT_WAYLAND_USE_XDG_SHELL"))
preferredShells << QLatin1String("xdg_shell");
preferredShells << QLatin1String("xdg-shell-v6");
QString useXdgShell = QString::fromLocal8Bit(qgetenv("QT_WAYLAND_USE_XDG_SHELL"));
if (!useXdgShell.isEmpty() && useXdgShell != QLatin1String("0")) {
qWarning() << "QT_WAYLAND_USE_XDG_SHELL is deprecated, "
"please specify the shell using QT_WAYLAND_SHELL_INTEGRATION instead";
preferredShells << QLatin1String("xdg-shell-v5");
}
preferredShells << QLatin1String("wl-shell");
}
preferredShells << QLatin1String("wl_shell");
Q_FOREACH (QString preferredShell, preferredShells) {
if (mDisplay->hasRegistryGlobal(preferredShell)) {
mShellIntegration.reset(createShellIntegration(preferredShell));
break;
}
Q_FOREACH (QString preferredShell, preferredShells) {
mShellIntegration.reset(createShellIntegration(preferredShell));
if (mShellIntegration) {
qDebug("Using the '%s' shell integration", qPrintable(preferredShell));
break;
}
}
@ -429,16 +429,18 @@ void QWaylandIntegration::initializeInputDeviceIntegration()
}
}
QWaylandShellIntegration *QWaylandIntegration::createShellIntegration(const QString &interfaceName)
QWaylandShellIntegration *QWaylandIntegration::createShellIntegration(const QString &integrationName)
{
if (interfaceName == QLatin1Literal("wl_shell")) {
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());
if (integrationName == QLatin1Literal("wl-shell")) {
return QWaylandWlShellIntegration::create(mDisplay.data());
} else if (integrationName == QLatin1Literal("xdg-shell-v5")) {
return QWaylandXdgShellIntegration::create(mDisplay.data());
} else if (integrationName == QLatin1Literal("xdg-shell-v6")) {
return QWaylandXdgShellV6Integration::create(mDisplay.data());
} else if (QWaylandShellIntegrationFactory::keys().contains(integrationName)) {
return QWaylandShellIntegrationFactory::create(integrationName, QStringList());
} else {
return Q_NULLPTR;
return nullptr;
}
}

View File

@ -41,6 +41,13 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
QWaylandWlShellIntegration *QWaylandWlShellIntegration::create(QWaylandDisplay *display)
{
if (display->hasRegistryGlobal(QLatin1String("wl_shell")))
return new QWaylandWlShellIntegration(display);
return nullptr;
}
QWaylandWlShellIntegration::QWaylandWlShellIntegration(QWaylandDisplay *display)
: m_wlShell(Q_NULLPTR)
{

View File

@ -57,11 +57,13 @@ namespace QtWaylandClient {
class Q_WAYLAND_CLIENT_EXPORT QWaylandWlShellIntegration : public QWaylandShellIntegration
{
public:
QWaylandWlShellIntegration(QWaylandDisplay* display);
static QWaylandWlShellIntegration *create(QWaylandDisplay* display);
bool initialize(QWaylandDisplay *) Q_DECL_OVERRIDE;
QWaylandShellSurface *createShellSurface(QWaylandWindow *window) Q_DECL_OVERRIDE;
private:
QWaylandWlShellIntegration(QWaylandDisplay* display);
QtWayland::wl_shell *m_wlShell;
};

View File

@ -43,6 +43,13 @@ QT_BEGIN_NAMESPACE
namespace QtWaylandClient {
QWaylandXdgShellIntegration *QWaylandXdgShellIntegration::create(QWaylandDisplay *display)
{
if (display->hasRegistryGlobal(QLatin1String("xdg_shell")))
return new QWaylandXdgShellIntegration(display);
return nullptr;
}
QWaylandXdgShellIntegration::QWaylandXdgShellIntegration(QWaylandDisplay *display)
: m_xdgShell(Q_NULLPTR)
{

View File

@ -58,12 +58,14 @@ class QWaylandXdgShell;
class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellIntegration : public QWaylandShellIntegration
{
public:
QWaylandXdgShellIntegration(QWaylandDisplay *display);
static QWaylandXdgShellIntegration *create(QWaylandDisplay* display);
bool initialize(QWaylandDisplay *display) Q_DECL_OVERRIDE;
QWaylandShellSurface *createShellSurface(QWaylandWindow *window) Q_DECL_OVERRIDE;
void handleKeyboardFocusChanged(QWaylandWindow *newFocus, QWaylandWindow *oldFocus) Q_DECL_OVERRIDE;
private:
QWaylandXdgShellIntegration(QWaylandDisplay *display);
QWaylandXdgShell *m_xdgShell;
};

View File

@ -55,6 +55,13 @@ QWaylandXdgShellV6Integration::QWaylandXdgShellV6Integration(QWaylandDisplay *di
}
}
QWaylandXdgShellV6Integration *QWaylandXdgShellV6Integration::create(QWaylandDisplay *display)
{
if (display->hasRegistryGlobal(QLatin1String("zxdg_shell_v6")))
return new QWaylandXdgShellV6Integration(display);
return nullptr;
}
bool QWaylandXdgShellV6Integration::initialize(QWaylandDisplay *display)
{
QWaylandShellIntegration::initialize(display);

View File

@ -58,11 +58,13 @@ class QWaylandXdgShellV6;
class Q_WAYLAND_CLIENT_EXPORT QWaylandXdgShellV6Integration : public QWaylandShellIntegration
{
public:
QWaylandXdgShellV6Integration(QWaylandDisplay *display);
static QWaylandXdgShellV6Integration *create(QWaylandDisplay* display);
bool initialize(QWaylandDisplay *display) override;
QWaylandShellSurface *createShellSurface(QWaylandWindow *window) override;
private:
QWaylandXdgShellV6Integration(QWaylandDisplay *display);
QWaylandXdgShellV6 *m_xdgShell;
};