summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>2021-02-26 08:20:22 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-03-30 15:14:16 +0000
commite7107e9a1d0136ab6d1c57297964fe7ac3c7bd94 (patch)
tree947617d6b92d57403baf0e5a47f40c7ab441bee1 /src
parent1a1d981b5615e2201e54e36d6d37cd66d682a1ed (diff)
wayland: Remove bogus warning about ignoring WAYLAND_DISPLAY
On Gnome, we will not default to Wayland at the moment, even if the desktop is run in Wayland mode. In this case, we warn users that they can still select Wayland manually using QT_QPA_PLATFORM. Problem was: We never checked if they had actually explicitly selected Wayland, so even in the cases where we would end up using that QPA plugin, people would still see the warning. This moves the check to the end of the platform selection algorithm, after we have collected all the information. Change-Id: I0d734bd0782c5e58d6dc63f69b7d531a479ad942 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io> (cherry picked from commit 642ed84a2db1ced7373707230d18e9d677277fa2) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qguiapplication.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index d607e75ecc..08a00d8227 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1408,18 +1408,16 @@ void QGuiApplicationPrivate::createPlatformIntegration()
}
const bool defaultIsWayland = !defaultIsXcb && platformPluginBase.startsWith("wayland");
+ bool isGnome = false;
const QByteArray waylandPlatformName = defaultIsWayland ? platformName : "wayland";
if (hasWaylandDisplay || isWaylandSessionType) {
const QByteArray currentDesktop = qgetenv("XDG_CURRENT_DESKTOP").toLower();
const QByteArray sessionDesktop = qgetenv("XDG_SESSION_DESKTOP").toLower();
- const bool isGnome = currentDesktop.contains("gnome") || sessionDesktop.contains("gnome");
- if (isGnome) {
- qInfo() << "Warning: Ignoring WAYLAND_DISPLAY on Gnome."
- << "Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.";
+ isGnome = currentDesktop.contains("gnome") || sessionDesktop.contains("gnome");
+ if (isGnome)
preferredPlatformOrder.append(waylandPlatformName);
- } else {
+ else
preferredPlatformOrder.prepend(waylandPlatformName);
- }
if (defaultIsWayland)
platformName.clear();
@@ -1431,9 +1429,11 @@ void QGuiApplicationPrivate::createPlatformIntegration()
platformName = preferredPlatformOrder.join(';');
#endif
+ bool platformExplicitlySelected = false;
QByteArray platformNameEnv = qgetenv("QT_QPA_PLATFORM");
if (!platformNameEnv.isEmpty()) {
platformName = platformNameEnv;
+ platformExplicitlySelected = true;
}
QString platformThemeName = QString::fromLocal8Bit(qgetenv("QT_QPA_PLATFORMTHEME"));
@@ -1458,8 +1458,10 @@ void QGuiApplicationPrivate::createPlatformIntegration()
if (++i < argc)
platformPluginPath = QString::fromLocal8Bit(argv[i]);
} else if (strcmp(arg, "-platform") == 0) {
- if (++i < argc)
+ if (++i < argc) {
+ platformExplicitlySelected = true;
platformName = argv[i];
+ }
} else if (strcmp(arg, "-platformtheme") == 0) {
if (++i < argc)
platformThemeName = QString::fromLocal8Bit(argv[i]);
@@ -1483,6 +1485,15 @@ 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);
if (!icon.isEmpty())