<table><tr><td style="">graesslin created this revision.<br />graesslin added a reviewer: Plasma.<br />Restricted Application added a project: Plasma.<br />Restricted Application added a subscriber: plasma-devel.<br />graesslin requested review of this revision.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D10816" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>This is a preparation step to unset QT_QPA_PLATFORM from the wayland<br />
startup session script. Setting QT_QPA_PLATFORM breaks 3rd-party Qt<br />
software which does not bundle QtWayland. Most prominent example is<br />
the Qt installer itself (see<br />
<a href="https://bugreports.qt.io/browse/QTBUG-60222" class="remarkup-link" target="_blank" rel="noreferrer">https://bugreports.qt.io/browse/QTBUG-60222</a>).</p>

<p>On the other hand our Plasma workspace applications need to be forced to<br />
Wayland on a Wayland system. So we have a conflict between we want to<br />
set QT_QPA_PLATFORM and we don't want to set QT_QPA_PLATFORM.</p>

<p>This change adds new API to KWorkspace to address this problem. The new<br />
method adjusts the QT_QPA_PLATFORM based on the XDG_SESSION_TYPE<br />
enviornment variable. It is completely opt-in. Meaning applications need<br />
to explicitly add the call prior to creating the QGuiApplication and if<br />
the user specifies either QT_QPA_PLATFORM env variable or any of the<br />
-platform command line argument variants, the platform detection is<br />
skipped.</p>

<p>The change also adjusts all plasma-workspace applications which should<br />
use Wayland on Wayland to use the new API. The startup script on the<br />
other hand still sets QT_QPA_PLATFORM. We also have applications outside<br />
of plasma-workspace which needs this detection. Examples are:</p>

<ul class="remarkup-list">
<li class="remarkup-list-item">powerdevil</li>
<li class="remarkup-list-item">systemsettings</li>
<li class="remarkup-list-item">kinfocenter</li>
</ul>

<p>Once this change is merged those applications can be adjusted by linking<br />
against PW::KWorkspace and afterwards QT_QPA_PLATFORM can be unset from<br />
startplasmacompositor.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>See added autotest</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R120 Plasma Workspace</div></div></div><br /><div><strong>BRANCH</strong><div><div>platform-detection</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D10816" rel="noreferrer">https://phabricator.kde.org/D10816</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>krunner/CMakeLists.txt<br />
krunner/main.cpp<br />
ksmserver/logout-greeter/main.cpp<br />
ksmserver/switchuser-greeter/main.cpp<br />
ksplash/ksplashqml/CMakeLists.txt<br />
ksplash/ksplashqml/main.cpp<br />
kuiserver/CMakeLists.txt<br />
kuiserver/main.cpp<br />
libkworkspace/CMakeLists.txt<br />
libkworkspace/autotests/CMakeLists.txt<br />
libkworkspace/autotests/testPlatformDetection.cpp<br />
libkworkspace/kworkspace.cpp<br />
libkworkspace/kworkspace.h<br />
shell/CMakeLists.txt<br />
shell/main.cpp<br />
startkde/kcminit/CMakeLists.txt<br />
startkde/kcminit/main.cpp<br />
systemmonitor/CMakeLists.txt<br />
systemmonitor/main.cpp</div></div></div><br /><div><strong>To: </strong>graesslin, Plasma<br /><strong>Cc: </strong>plasma-devel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart<br /></div>