[gnome-control-center/gnome-3-20] display: Ensure only one output is set as primary



commit 3eb4000554fa563f27c6d2c9cf7b9de0f581ffac
Author: Rui Matos <tiagomatos gmail com>
Date:   Thu Mar 24 17:40:51 2016 +0100

    display: Ensure only one output is set as primary
    
    When switching an output to secondary we'd set all other outputs as
    primary. Instead, set only the first we find.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=764155

 panels/display/cc-display-panel.c |   12 ++++++++++--
 1 files changed, 10 insertions(+), 2 deletions(-)
---
diff --git a/panels/display/cc-display-panel.c b/panels/display/cc-display-panel.c
index b6d104a..94e7508 100644
--- a/panels/display/cc-display-panel.c
+++ b/panels/display/cc-display-panel.c
@@ -2445,6 +2445,7 @@ show_setup_dialog (CcDisplayPanel *panel)
       if (g_hash_table_size (output_ids) > 1)
         {
           gint new_width, new_height;
+          gboolean primary_chosen = FALSE;
 
           gnome_rr_output_info_get_geometry (priv->current_output, NULL, NULL,
                                              &new_width, &new_height);
@@ -2502,8 +2503,15 @@ show_setup_dialog (CcDisplayPanel *panel)
                   /* ensure no other outputs are primary if this output is now
                    * primary, or find another output to set as primary if this
                    * output is no longer primary */
-
-                  gnome_rr_output_info_set_primary (outputs[i], !primary);
+                  if (primary)
+                    {
+                      gnome_rr_output_info_set_primary (outputs[i], FALSE);
+                    }
+                  else if (!primary_chosen && gnome_rr_output_info_is_primary_tile (outputs[i]))
+                    {
+                      gnome_rr_output_info_set_primary (outputs[i], TRUE);
+                      primary_chosen = TRUE;
+                    }
                 }
             }
 


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