Commit 4a5a8061 authored by Fabian Vogt's avatar Fabian Vogt
Browse files

Fix algorithm for common sizes in Generator::cloneScreens

The algorithm iterates all outputs and collects the intersection of all
supported sizes. To fill the set initially, it assigns the current sizes if
the preliminary result is empty, but this condition can also be true if the
previous intersection resulted in an empty set. This is the case for instance
when using 3 monitors, of which the second one doesn't have any modes in common
with the first (e.g. rotation) and without this fix, it would return all sizes
of the third monitor instead of an empty set.

Avoid this by giving up early when there's no intersection left.

BUG: 442822
parent 04803df9
......@@ -270,10 +270,14 @@ void Generator::cloneScreens(KScreen::OutputList &connectedOutputs)
// If we have nothing to compare against
if (commonSizes.isEmpty()) {
commonSizes = modeSizes;
continue;
} else {
commonSizes.intersect(modeSizes);
}
commonSizes.intersect(modeSizes);
// If there's already nothing in common, bail
if (commonSizes.isEmpty()) {
break;
}
}
qCDebug(KSCREEN_KDED) << "Common sizes: " << commonSizes;
......
Markdown is supported
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