Do not use wayland platform plugin on GNOME wayland sessions by default

This restores to the original behavior we had with Qt 6.2.0, we switched
to wayland by default in GNOME in Qt 6.2.1, which changed behavior in a
bugfix release.

Revert "Use wayland platform plugin on GNOME wayland sessions by default"

This reverts commit 75c6f11a36335ac1dcc3d352883910b3d7461232.

Change-Id: Ie5fee31e59e946c255489789df44528ca794bf5c
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
This commit is contained in:
Jan Grulich 2022-01-04 13:58:18 +01:00
parent 6cc509e63a
commit f9cd2235c3

View File

@ -1402,9 +1402,16 @@ void QGuiApplicationPrivate::createPlatformIntegration()
}
const bool defaultIsWayland = !defaultIsXcb && platformPluginBase.startsWith("wayland");
bool isGnome = false;
const QByteArray waylandPlatformName = defaultIsWayland ? platformName : "wayland";
if (hasWaylandDisplay || isWaylandSessionType) {
preferredPlatformOrder.prepend(waylandPlatformName);
const QByteArray currentDesktop = qgetenv("XDG_CURRENT_DESKTOP").toLower();
const QByteArray sessionDesktop = qgetenv("XDG_SESSION_DESKTOP").toLower();
isGnome = currentDesktop.contains("gnome") || sessionDesktop.contains("gnome");
if (isGnome)
preferredPlatformOrder.append(waylandPlatformName);
else
preferredPlatformOrder.prepend(waylandPlatformName);
if (defaultIsWayland)
platformName.clear();
@ -1472,7 +1479,14 @@ void QGuiApplicationPrivate::createPlatformIntegration()
argc = j;
}
#if defined(Q_OS_UNIX) && !defined(Q_OS_DARWIN)
if ((hasWaylandDisplay || isWaylandSessionType) && isGnome && !platformExplicitlySelected) {
qInfo() << "Warning: Ignoring WAYLAND_DISPLAY on Gnome."
<< "Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.";
}
#else
Q_UNUSED(platformExplicitlySelected);
#endif
init_platform(QLatin1String(platformName), platformPluginPath, platformThemeName, argc, argv);