Commit af3a5953 authored by Harald Sitter's avatar Harald Sitter 🏳️‍🌈
Browse files

loosen the duplication check a tad

we can generally expect the ids to be different unless the manufacturer
hasn't obeyed the spec. with that in mind let's only prime the
duplication detection tech when multiple duplicated outputs are actually
connected. outputs may be temporarily duplicated for reasons other than
duplicated ids. e.g. some devices change output names (DP-1 to DP-2) on
hotplugs and we'd incorrectly handled them as duplicates even when the
old name wasn't connected and bound to go away
parent 30376403
Pipeline #211979 passed with stage
in 3 minutes and 22 seconds
......@@ -352,14 +352,18 @@ void Output::readInOutputs(KScreen::ConfigPtr config, const QVariantList &output
// to be able to tell apart multiple identical outputs, these need special treatment
QStringList duplicateIds;
{
QStringList allIds;
allIds.reserve(outputs.count());
QStringList allConnectedIds;
allConnectedIds.reserve(outputs.count());
for (const KScreen::OutputPtr &output : outputs) {
if (!output->isConnected()) {
// Duplicated IDs only matter if the duplicates are actually connected. Duplicates may also be transient.
continue;
}
const auto outputId = output->hash();
if (allIds.contains(outputId) && !duplicateIds.contains(outputId)) {
if (allConnectedIds.contains(outputId) && !duplicateIds.contains(outputId)) {
duplicateIds << outputId;
}
allIds << outputId;
allConnectedIds << outputId;
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment