Skip to content

display: Don't always set the primary monitor to the first in list

As per the binding that we have between the list store and the combo-box, when the first element is added to the list-store, the combo box set this value as the selected one, and this leads to setting the first-listed monitor as primary and unsetting the real primary monitor.

To avoid this, don't emit the notify signals until we've added all the monitors to the model, so that when this happen the combo selected index matches the primary monitor.

Fixes #419 (closed)


That said, I'm not totally a fan of this solution, so other options are:

  1. Make cc_display_config_get_ui_sorted_monitors to return a list where the primary monitor is always the first one (too fragile imho)
  2. Add a cc_display_config_get_primary_monitor function, and use this value to store the output variable before the loop, and we use this value instead of cc_display_monitor_is_primary to check if the current one is the primary or not.

Merge request reports