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"); QByteArray integrationName = qgetenv("QT_WAYLAND_SHELL_INTEGRATION");
QString targetKey = QString::fromLocal8Bit(integrationName); QString targetKey = QString::fromLocal8Bit(integrationName);
QStringList preferredShells;
if (!targetKey.isEmpty()) { if (!targetKey.isEmpty()) {
QStringList keys = QWaylandShellIntegrationFactory::keys(); preferredShells << targetKey;
if (keys.contains(targetKey)) {
qDebug("Using the '%s' shell integration", qPrintable(targetKey));
mShellIntegration.reset(QWaylandShellIntegrationFactory::create(targetKey, QStringList()));
}
} else { } else {
QStringList preferredShells; preferredShells << QLatin1String("xdg-shell-v6");
preferredShells << QLatin1String("zxdg_shell_v6"); QString useXdgShell = QString::fromLocal8Bit(qgetenv("QT_WAYLAND_USE_XDG_SHELL"));
if (qEnvironmentVariableIsSet("QT_WAYLAND_USE_XDG_SHELL")) if (!useXdgShell.isEmpty() && useXdgShell != QLatin1String("0")) {
preferredShells << QLatin1String("xdg_shell"); 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) {
mShellIntegration.reset(createShellIntegration(preferredShell));
Q_FOREACH (QString preferredShell, preferredShells) { if (mShellIntegration) {
if (mDisplay->hasRegistryGlobal(preferredShell)) { qDebug("Using the '%s' shell integration", qPrintable(preferredShell));
mShellIntegration.reset(createShellIntegration(preferredShell)); break;
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")) { if (integrationName == QLatin1Literal("wl-shell")) {
return new QWaylandWlShellIntegration(mDisplay.data()); return QWaylandWlShellIntegration::create(mDisplay.data());
} else if (interfaceName == QLatin1Literal("xdg_shell")) { } else if (integrationName == QLatin1Literal("xdg-shell-v5")) {
return new QWaylandXdgShellIntegration(mDisplay.data()); return QWaylandXdgShellIntegration::create(mDisplay.data());
} else if (interfaceName == QLatin1Literal("zxdg_shell_v6")) { } else if (integrationName == QLatin1Literal("xdg-shell-v6")) {
return new QWaylandXdgShellV6Integration(mDisplay.data()); return QWaylandXdgShellV6Integration::create(mDisplay.data());
} else if (QWaylandShellIntegrationFactory::keys().contains(integrationName)) {
return QWaylandShellIntegrationFactory::create(integrationName, QStringList());
} else { } else {
return Q_NULLPTR; return nullptr;
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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