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



commit 6d825b9660e05133d758f2501133cb089e8263eb
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 06d9579..2312b17 100644
--- a/panels/display/cc-display-panel.c
+++ b/panels/display/cc-display-panel.c
@@ -2487,6 +2487,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);
@@ -2544,8 +2545,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]