- common_resolution = [ set(( ( mode["width"], mode["height"] ) for mode in output_modes )) for output, output_modes in modes.items() if configuration[output].edid ]
- common_resolution = reduce(lambda a, b: a & b, common_resolution[1:], common_resolution[0])
- common_resolution = sorted(common_resolution, key=lambda a: int(a[0])*int(a[1]))
+ mode_sets = []
+ for output, output_modes in modes.items():
+ mode_set = set()
+ if configuration[output].edid:
+ for mode in output_modes:
+ mode_set.add((mode["width"], mode["height"]))
+ mode_sets.append(mode_set)
+ common_resolution = reduce(lambda a, b: a & b, mode_sets[1:], mode_sets[0])
+ common_resolution = sorted(common_resolution, key=lambda a: int(a[0]) * int(a[1]))