backends/drm: fix placeholder output check

Non-desktop outputs must be ignored
This commit is contained in:
Xaver Hugl 2022-07-26 00:00:02 +02:00
parent e67e9b6e28
commit b7d7a99fcb

View file

@ -537,14 +537,17 @@ void DrmBackend::enableOutput(DrmAbstractOutput *output, bool enable)
m_enabledOutputs << output; m_enabledOutputs << output;
Q_EMIT outputEnabled(output); Q_EMIT outputEnabled(output);
checkOutputsAreOn(); checkOutputsAreOn();
if (m_placeHolderOutput) { if (m_placeHolderOutput && !output->isNonDesktop()) {
qCDebug(KWIN_DRM) << "removing placeholder output"; qCDebug(KWIN_DRM) << "removing placeholder output";
primaryGpu()->removeVirtualOutput(m_placeHolderOutput); primaryGpu()->removeVirtualOutput(m_placeHolderOutput);
m_placeHolderOutput = nullptr; m_placeHolderOutput = nullptr;
m_placeholderFilter.reset(); m_placeholderFilter.reset();
} }
} else { } else {
if (m_enabledOutputs.count() == 1 && !kwinApp()->isTerminating()) { int normalOutputsCount = std::count_if(m_enabledOutputs.begin(), m_enabledOutputs.end(), [](const auto output) {
return !output->isNonDesktop();
});
if (normalOutputsCount == 1 && !output->isNonDesktop() && !kwinApp()->isTerminating()) {
qCDebug(KWIN_DRM) << "adding placeholder output"; qCDebug(KWIN_DRM) << "adding placeholder output";
m_placeHolderOutput = primaryGpu()->createVirtualOutput({}, m_enabledOutputs.constFirst()->pixelSize(), 1, DrmVirtualOutput::Type::Placeholder); m_placeHolderOutput = primaryGpu()->createVirtualOutput({}, m_enabledOutputs.constFirst()->pixelSize(), 1, DrmVirtualOutput::Type::Placeholder);
// placeholder doesn't actually need to render anything // placeholder doesn't actually need to render anything