outputconfigurationstore: handle missing EDID identifiers correctly

master
Xaver Hugl 11 months ago
parent fde1393076
commit 04766c384a

@ -128,26 +128,23 @@ std::optional<std::pair<OutputConfigurationStore::Setup *, std::unordered_map<Ou
std::optional<size_t> OutputConfigurationStore::findOutput(Output *output, const QList<Output *> &allOutputs) const
{
const bool duplicateEdid = std::any_of(allOutputs.begin(), allOutputs.end(), [output](Output *otherOutput) {
const bool uniqueEdid = !output->edid().identifier().isEmpty() && std::none_of(allOutputs.begin(), allOutputs.end(), [output](Output *otherOutput) {
return otherOutput != output && otherOutput->edid().identifier() == output->edid().identifier();
});
const bool duplicateMst = std::any_of(allOutputs.begin(), allOutputs.end(), [output](Output *otherOutput) {
const bool uniqueMst = !output->mstPath().isEmpty() && std::none_of(allOutputs.begin(), allOutputs.end(), [output](Output *otherOutput) {
return otherOutput != output && otherOutput->edid().identifier() == output->edid().identifier() && otherOutput->mstPath() == output->mstPath();
});
const auto it = std::find_if(m_outputs.begin(), m_outputs.end(), [duplicateEdid, duplicateMst, output](const auto &outputState) {
const auto it = std::find_if(m_outputs.begin(), m_outputs.end(), [uniqueEdid, uniqueMst, output](const auto &outputState) {
if (outputState.edidIdentifier != output->edid().identifier()) {
return false;
}
if (!duplicateEdid) {
} else if (uniqueEdid) {
return true;
}
if (!output->mstPath().isEmpty()) {
if (outputState.mstPath != output->mstPath()) {
return false;
} else if (!duplicateMst) {
} else if (uniqueMst) {
return true;
}
}
return outputState.connectorName == output->name();
});
if (it != m_outputs.end()) {

Loading…
Cancel
Save