Commit eac5fe14 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

(cherry picked from commit 4a5a8061)
parent 7070ab79
......@@ -270,10 +270,14 @@ void Generator::cloneScreens(KScreen::OutputList &connectedOutputs)
// If we have nothing to compare against
if (commonSizes.isEmpty()) {
commonSizes = modeSizes;
} else {
// If there's already nothing in common, bail
if (commonSizes.isEmpty()) {
qCDebug(KSCREEN_KDED) << "Common sizes: " << commonSizes;
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