diff options
author | Jan Grulich <jgrulich@redhat.com> | 2022-01-04 13:58:18 +0100 |
---|---|---|
committer | Jan Grulich <jgrulich@redhat.com> | 2022-01-07 09:38:00 +0100 |
commit | f9cd2235c374630fae8f45246ef11e255a97c023 (patch) | |
tree | 7d0d087f931fce10be36efbff428210b4fe06f19 /src | |
parent | 6cc509e63a418fd35d419d6a0fb587aaaa11e783 (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index dff86d0edf..bad15cf1da 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -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); |