[gnome-control-center] display: Redraw the arrangement area widget when outputs change



commit 90cf23a70accc3ef554e59c5aadb68d47f721cf5
Author: Rui Matos <tiagomatos gmail com>
Date:   Mon Aug 21 15:24:52 2017 +0200

    display: Redraw the arrangement area widget when outputs change
    
    This ensures the arrangement area always reflects the current
    changes.

 panels/display/cc-display-panel.c |   23 +++++++++++++++++++++++
 1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/panels/display/cc-display-panel.c b/panels/display/cc-display-panel.c
index 71396b4..5e9971e 100644
--- a/panels/display/cc-display-panel.c
+++ b/panels/display/cc-display-panel.c
@@ -1333,6 +1333,27 @@ make_single_output_ui (CcDisplayPanel *panel)
   return make_scrollable (vbox);
 }
 
+static void
+monitor_output_changes (GtkWidget      *area,
+                        CcDisplayPanel *panel)
+{
+  CcDisplayPanelPrivate *priv = panel->priv;
+  const gchar *signals[] = { "rotation", "mode", "primary", "active", "scale" };
+  GList *outputs, *l;
+  guint i;
+
+  outputs = cc_display_config_get_monitors (priv->current_config);
+  for (l = outputs; l; l = l->next)
+    {
+      CcDisplayMonitor *output = l->data;
+      for (i = 0; i < G_N_ELEMENTS (signals); ++i)
+        {
+          g_signal_connect_object (output, signals[i], G_CALLBACK (gtk_widget_queue_draw),
+                                   area, G_CONNECT_SWAPPED);
+        }
+    }
+}
+
 static GtkWidget *
 make_arrangement_row (CcDisplayPanel *panel)
 {
@@ -1346,6 +1367,8 @@ make_arrangement_row (CcDisplayPanel *panel)
   g_signal_connect (area, "viewport_changed",
                     G_CALLBACK (on_viewport_changed), panel);
 
+  monitor_output_changes (area, panel);
+
   row = g_object_new (CC_TYPE_LIST_BOX_ROW, NULL);
   gtk_container_add (GTK_CONTAINER (row), area);
 


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