Skip to content

Commit

Permalink
Ignore XDG_SESSION_TYPE=wayland on gnome-shell
Browse files Browse the repository at this point in the history
[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>
  • Loading branch information
Johan Klokkhammer Helsing committed Jun 5, 2018
1 parent a15db3a commit 36d2ef5
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/gui/kernel/qguiapplication.cpp
Expand Up @@ -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
Expand Down

0 comments on commit 36d2ef5

Please sign in to comment.