diff options
author | Johan Klokkhammer Helsing <johan.helsing@qt.io> | 2018-06-01 15:12:05 +0200 |
---|---|---|
committer | Johan Helsing <johan.helsing@qt.io> | 2018-06-05 13:10:45 +0000 |
commit | 36d2ef5af9875afd9d398f5e37102194040cb1d9 (patch) | |
tree | 5750c1ccd84dd0dd7f186cbc24a6a90f24587d30 /src/gui | |
parent | a15db3a81aa6053d1b3ce346b4cb160c064a2c43 (diff) |
Ignore XDG_SESSION_TYPE=wayland on gnome-shell
[ChangeLog][Wayland] In Qt 5.11.0, support for selecting a platform plugin based
on the XDG_SESSION_TYPE environment variable was added. On gnome-shell, however,
bugs—in both Qt and gnome-shell—made many widget applications almost unusable.
So until those bugs are fixed XDG_SESSION_TYPE=wayland is now ignored on
gnome-shell.
Task-number: QTBUG-68619
Change-Id: I902acd1c4fc996f46e8431c12c0a5cdbab883abf
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index c73dac42d6..2ef689b5b9 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1297,10 +1297,18 @@ void QGuiApplicationPrivate::createPlatformIntegration() #if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN) QByteArray sessionType = qgetenv("XDG_SESSION_TYPE"); if (!sessionType.isEmpty()) { - if (sessionType == QByteArrayLiteral("x11") && !platformName.contains(QByteArrayLiteral("xcb"))) + if (sessionType == QByteArrayLiteral("x11") && !platformName.contains(QByteArrayLiteral("xcb"))) { platformName = QByteArrayLiteral("xcb"); - else if (sessionType == QByteArrayLiteral("wayland") && !platformName.contains(QByteArrayLiteral("wayland"))) - platformName = QByteArrayLiteral("wayland"); + } else if (sessionType == QByteArrayLiteral("wayland") && !platformName.contains(QByteArrayLiteral("wayland"))) { + QByteArray currentDesktop = qgetenv("XDG_CURRENT_DESKTOP").toLower(); + QByteArray sessionDesktop = qgetenv("XDG_SESSION_DESKTOP").toLower(); + if (currentDesktop.contains("gnome") || sessionDesktop.contains("gnome")) { + qInfo() << "Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome." + << "Use QT_QPA_PLATFORM=wayland to run on Wayland anyway."; + } else { + platformName = QByteArrayLiteral("wayland"); + } + } } #ifdef QT_QPA_DEFAULT_PLATFORM_NAME // Add it as fallback in case XDG_SESSION_TYPE is something wrong |