[gnome-control-center/benzea/ensure-valid-config-after-loading: 84/91] display: Ensure we have a primary monitor after all were disabled



commit abb2bbccec6abba7849daa83f5c6621b392b5c1f
Author: Benjamin Berg <bberg redhat com>
Date:   Wed Mar 20 14:29:22 2019 +0100

    display: Ensure we have a primary monitor after all were disabled
    
    When enabling the first monitor, we need to select it as primary as we
    otherwise end up without a primary monitor (rendering the configuration
    invalid). "Unsetting" the NULL primary monitor effectively causes the
    first and only available monitor to become the primary, while not doing
    anything if we have a primary monitor.

 panels/display/cc-display-config-dbus.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/panels/display/cc-display-config-dbus.c b/panels/display/cc-display-config-dbus.c
index 8c04119c9..6db267d8b 100644
--- a/panels/display/cc-display-config-dbus.c
+++ b/panels/display/cc-display-config-dbus.c
@@ -411,8 +411,11 @@ cc_display_monitor_dbus_set_logical_monitor (CcDisplayMonitorDBus *self,
     {
       g_hash_table_add (self->logical_monitor->monitors, self);
       g_object_ref (self->logical_monitor);
+      /* unset primary with NULL will select this monitor if it is the only one.*/
       if (was_primary)
         cc_display_config_dbus_set_primary (self->config, self);
+      else
+        cc_display_config_dbus_unset_primary (self->config, NULL);
     }
 }
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]