[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [plasma-workspace] /: No longer export QT_QPA_PLATFORM env variable to the session
From:       Martin_Flöser <null () kde ! org>
Date:       2018-03-21 5:51:56
Message-ID: E1eyWfE-0004QW-2i () code ! kde ! org
[Download RAW message or body]

Git commit c4a0d6925ec63a66a23c61a5ee22a1d718a3dae5 by Martin Flöser.
Committed on 21/03/2018 at 05:51.
Pushed by graesslin into branch 'master'.

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

M  +5    -0    krunner/main.cpp
M  +5    -0    shell/main.cpp
M  +0    -4    startkde/startplasmacompositor.cmake

https://commits.kde.org/plasma-workspace/c4a0d6925ec63a66a23c61a5ee22a1d718a3dae5

diff --git a/krunner/main.cpp b/krunner/main.cpp
index 6dd63499..cf228f86 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 8f6ae1b6..58f6334d 100644
--- a/shell/main.cpp
+++ b/shell/main.cpp
@@ -59,8 +59,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
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic