From 9dd3d4711ac74fd9d93344db7e6c2691026f21c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Fl=C3=B6ser?= Date: Sun, 18 Mar 2018 11:08:02 +0100 Subject: [PATCH 3/3] No longer export QT_QPA_PLATFORM env variable to the session Summary: As discussed the env variables are no longer exported. Thus Qt applications follow the default qpa platform they are compiled with and thus still function if they are packaged with a Qt without QtWayland. Plasma's internal processes pick the qpa platform depending on the session type as well as our flatpak apps. KRunner and Plasmashell are adjusted to not leak the env variable they set for themselves. Test Plan: Started a wayland session, verified with KWin's debug console that plasmashell and krunner are wayland. Launched kwrite from both plasma and krunner and verified that it's xcb Reviewers: #plasma Subscribers: plasma-devel Tags: #plasma Differential Revision: https://phabricator.kde.org/D11447 --- krunner/main.cpp | 5 +++++ shell/main.cpp | 5 +++++ startkde/startplasmacompositor.cmake | 4 ---- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/krunner/main.cpp b/krunner/main.cpp index 06bf47c0..329eca7e 100644 --- a/krunner/main.cpp +++ b/krunner/main.cpp @@ -44,9 +44,14 @@ int main(int argc, char **argv) qunsetenv("QT_DEVICE_PIXEL_RATIO"); QCoreApplication::setAttribute(Qt::AA_DisableHighDpiScaling); + const bool qpaVariable = qEnvironmentVariableIsSet("QT_QPA_PLATFORM"); KWorkSpace::detectPlatform(argc, argv); QQuickWindow::setDefaultAlphaBuffer(true); QApplication app(argc, argv); + if (!qpaVariable) { + // don't leak the env variable to processes we start + qunsetenv("QT_QPA_PLATFORM"); + } KLocalizedString::setApplicationDomain("krunner"); KQuickAddons::QtQuickSettings::init(); diff --git a/shell/main.cpp b/shell/main.cpp index 09cca77a..037eb8f3 100644 --- a/shell/main.cpp +++ b/shell/main.cpp @@ -57,8 +57,13 @@ int main(int argc, char *argv[]) QQuickWindow::setDefaultAlphaBuffer(true); + const bool qpaVariable = qEnvironmentVariableIsSet("QT_QPA_PLATFORM"); KWorkSpace::detectPlatform(argc, argv); QApplication app(argc, argv); + if (!qpaVariable) { + // don't leak the env variable to processes we start + qunsetenv("QT_QPA_PLATFORM"); + } KLocalizedString::setApplicationDomain("plasmashell"); // The executable's path is added to the library/plugin paths. diff --git a/startkde/startplasmacompositor.cmake b/startkde/startplasmacompositor.cmake index 8ac47aa7..dd9e304d 100644 --- a/startkde/startplasmacompositor.cmake +++ b/startkde/startplasmacompositor.cmake @@ -218,10 +218,6 @@ export KDE_SESSION_UID XDG_CURRENT_DESKTOP=KDE export XDG_CURRENT_DESKTOP -#enforce wayland QPA -QT_QPA_PLATFORM=wayland -export QT_QPA_PLATFORM - # kwin_wayland can possibly also start dbus-activated services which need env variables. # In that case, the update in startplasma might be too late. if which dbus-update-activation-environment >/dev/null 2>/dev/null ; then -- 2.16.2