[gnome-control-center/benzea/prevent-scale-snap] display: Prevent snapping unmodified display




commit 9d14644caf3aeaa7859d9459ec24a7a461136227
Author: Benjamin Berg <bberg redhat com>
Date:   Thu Jul 29 16:57:36 2021 +0200

    display: Prevent snapping unmodified display
    
    Rebuilding the UI would trigger the scale to be re-applied. This in turn
    would cause the monitor to be snapped and possibly changing a correct
    configuration.
    
    Note that this really is a bug in the snapping code. But that code is a
    mess and not fireing the signal is a good thing either way.
    
    Closes: #1412

 panels/display/cc-display-settings.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/panels/display/cc-display-settings.c b/panels/display/cc-display-settings.c
index 1e53dc8f7..c9f89f24c 100644
--- a/panels/display/cc-display-settings.c
+++ b/panels/display/cc-display-settings.c
@@ -429,13 +429,14 @@ cc_display_settings_rebuild_ui (CcDisplaySettings *self)
           gtk_toggle_button_set_mode (GTK_TOGGLE_BUTTON (scale_btn), FALSE);
           gtk_widget_show (scale_btn);
           gtk_container_add (GTK_CONTAINER (self->scale_bbox), scale_btn);
+          /* Set active before connecting the signal */
+          if (is_selected)
+            gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (scale_btn), TRUE);
+
           g_signal_connect_object (scale_btn,
                                    "notify::active",
                                    G_CALLBACK (on_scale_btn_active_changed_cb),
                                    self, 0);
-
-          if (is_selected)
-            gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (scale_btn), TRUE);
         }
     }
 


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