[gnome-control-center/gnome-3-12] display: Check whether the rotation changes when relayouting



commit ee5c36afea5c1fd3497d8a6027c13fc2b0004b9d
Author: Bastien Nocera <hadess hadess net>
Date:   Tue Jun 3 17:31:34 2014 +0200

    display: Check whether the rotation changes when relayouting
    
    Consider whether rotation has changed when checking whether
    we need to relayout the screens. Before, we would only have changed the
    layout if the resolution changed.
    
    This doesn't fix the problem of the relayouting code not taking rotation
    into account, but it will at least allow us to run that code when only
    the rotation changes.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=731166

 panels/display/cc-display-panel.c |   20 +++++++++++++-------
 1 files changed, 13 insertions(+), 7 deletions(-)
---
diff --git a/panels/display/cc-display-panel.c b/panels/display/cc-display-panel.c
index 5b3793a..bff77fc 100644
--- a/panels/display/cc-display-panel.c
+++ b/panels/display/cc-display-panel.c
@@ -521,7 +521,7 @@ on_screen_changed (CcDisplayPanel *panel)
 }
 
 static void
-realign_outputs_after_resolution_change (CcDisplayPanel *self, GnomeRROutputInfo *output_that_changed, int 
old_width, int old_height)
+realign_outputs_after_resolution_change (CcDisplayPanel *self, GnomeRROutputInfo *output_that_changed, int 
old_width, int old_height, GnomeRRRotation old_rotation)
 {
   /* We find the outputs that were below or to the right of the output that
    * changed, and realign them; we also do that for outputs that shared the
@@ -534,12 +534,14 @@ realign_outputs_after_resolution_change (CcDisplayPanel *self, GnomeRROutputInfo
   int dx, dy;
   int x, y, width, height;
   GnomeRROutputInfo **outputs;
+  GnomeRRRotation rotation;
 
   g_assert (self->priv->current_configuration != NULL);
 
-  gnome_rr_output_info_get_geometry (output_that_changed, &x, &y, &width, &height); 
+  gnome_rr_output_info_get_geometry (output_that_changed, &x, &y, &width, &height);
+  rotation = gnome_rr_output_info_get_rotation (output_that_changed);
 
-  if (width == old_width && height == old_height)
+  if (width == old_width && height == old_height && rotation == old_rotation)
     return;
 
   old_right_edge = x + old_width;
@@ -2267,6 +2269,8 @@ show_setup_dialog (CcDisplayPanel *panel)
                 }
             }
 
+          sanity_check_rotation (priv->current_output);
+
           /* if the display was previously in clone mode, ensure the outputs
            * are arranged correctly */
           if ((was_clone && !clone))
@@ -2275,11 +2279,13 @@ show_setup_dialog (CcDisplayPanel *panel)
           if (!clone)
             realign_outputs_after_resolution_change (panel,
                                                      priv->current_output,
-                                                     old_width, old_height);
+                                                     old_width, old_height, rotation);
+        }
+      else
+        {
+          /* check rotation */
+          sanity_check_rotation (priv->current_output);
         }
-
-      /* check rotation */
-      sanity_check_rotation (priv->current_output);
 
       apply_current_configuration (panel);
     }


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