graesslin created this revision. graesslin added a reviewer: Plasma. Restricted Application added a project: Plasma. Restricted Application added a subscriber: plasma-devel. graesslin requested review of this revision.
REVISION SUMMARY This is a preparation step to unset QT_QPA_PLATFORM from the wayland startup session script. Setting QT_QPA_PLATFORM breaks 3rd-party Qt software which does not bundle QtWayland. Most prominent example is the Qt installer itself (see https://bugreports.qt.io/browse/QTBUG-60222). On the other hand our Plasma workspace applications need to be forced to Wayland on a Wayland system. So we have a conflict between we want to set QT_QPA_PLATFORM and we don't want to set QT_QPA_PLATFORM. This change adds new API to KWorkspace to address this problem. The new method adjusts the QT_QPA_PLATFORM based on the XDG_SESSION_TYPE enviornment variable. It is completely opt-in. Meaning applications need to explicitly add the call prior to creating the QGuiApplication and if the user specifies either QT_QPA_PLATFORM env variable or any of the -platform command line argument variants, the platform detection is skipped. The change also adjusts all plasma-workspace applications which should use Wayland on Wayland to use the new API. The startup script on the other hand still sets QT_QPA_PLATFORM. We also have applications outside of plasma-workspace which needs this detection. Examples are: - powerdevil - systemsettings - kinfocenter Once this change is merged those applications can be adjusted by linking against PW::KWorkspace and afterwards QT_QPA_PLATFORM can be unset from startplasmacompositor. TEST PLAN See added autotest REPOSITORY R120 Plasma Workspace BRANCH platform-detection REVISION DETAIL https://phabricator.kde.org/D10816 AFFECTED FILES krunner/CMakeLists.txt krunner/main.cpp ksmserver/logout-greeter/main.cpp ksmserver/switchuser-greeter/main.cpp ksplash/ksplashqml/CMakeLists.txt ksplash/ksplashqml/main.cpp kuiserver/CMakeLists.txt kuiserver/main.cpp libkworkspace/CMakeLists.txt libkworkspace/autotests/CMakeLists.txt libkworkspace/autotests/testPlatformDetection.cpp libkworkspace/kworkspace.cpp libkworkspace/kworkspace.h shell/CMakeLists.txt shell/main.cpp startkde/kcminit/CMakeLists.txt startkde/kcminit/main.cpp systemmonitor/CMakeLists.txt systemmonitor/main.cpp To: graesslin, #plasma Cc: plasma-devel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart