[gnome-control-center] display: Reset configuration when switching layouting modes
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] display: Reset configuration when switching layouting modes
- Date: Fri, 8 Dec 2017 16:11:54 +0000 (UTC)
commit 3f3c4bed874b9f8e6cbd071a292564d3006dccbb
Author: Benjamin Berg <bberg redhat com>
Date: Fri Nov 24 14:27:49 2017 +0100
display: Reset configuration when switching layouting modes
When switching between screen mirroring and joining displays the
configuration needs to be reset. Otherwise the monitor scaling will
not be set back to the current scaling again.
Split out the code to reset the current configuration and call that when
the mode is switched to ensure the changes are minimal.
https://bugzilla.gnome.org/show_bug.cgi?id=790768
panels/display/cc-display-panel.c | 50 +++++++++++++++++++++++++------------
1 files changed, 34 insertions(+), 16 deletions(-)
---
diff --git a/panels/display/cc-display-panel.c b/panels/display/cc-display-panel.c
index 21f597d..256fc86 100644
--- a/panels/display/cc-display-panel.c
+++ b/panels/display/cc-display-panel.c
@@ -124,6 +124,8 @@ on_area_paint (FooScrollArea *area,
static char *
make_display_size_string (int width_mm,
int height_mm);
+static void
+reset_current_config (CcDisplayPanel *panel);
static char *
make_output_ui_name (CcDisplayMonitor *output)
@@ -1751,6 +1753,8 @@ two_output_visible_child_changed (CcDisplayPanel *panel,
GtkWidget *bin;
GList *children, *l;
+ reset_current_config (panel);
+
children = gtk_container_get_children (GTK_CONTAINER (stack));
for (l = children; l; l = l->next)
{
@@ -2038,35 +2042,23 @@ make_multi_output_ui (CcDisplayPanel *panel)
}
static void
-on_screen_changed (CcDisplayPanel *panel)
+reset_current_config (CcDisplayPanel *panel)
{
CcDisplayPanelPrivate *priv = panel->priv;
- CcDisplayConfig *current;
GList *outputs, *l;
- GtkWidget *main_widget;
- guint n_outputs;
-
- if (!priv->manager)
- return;
-
- reset_titlebar (panel);
-
- main_widget = gtk_stack_get_child_by_name (GTK_STACK (priv->stack), "main");
- if (main_widget)
- gtk_widget_destroy (main_widget);
+ CcDisplayConfig *current;
g_clear_object (&priv->current_config);
+ priv->current_output = NULL;
current = cc_display_config_manager_get_current (priv->manager);
if (!current)
- goto show_error;
+ return;
priv->current_config = current;
ensure_output_numbers (panel);
- ensure_monitor_labels (panel);
- priv->current_output = NULL;
outputs = g_object_get_data (G_OBJECT (current), "ui-sorted-outputs");
for (l = outputs; l; l = l->next)
{
@@ -2078,10 +2070,36 @@ on_screen_changed (CcDisplayPanel *panel)
priv->current_output = output;
break;
}
+}
+
+static void
+on_screen_changed (CcDisplayPanel *panel)
+{
+ CcDisplayPanelPrivate *priv = panel->priv;
+ GtkWidget *main_widget;
+ GList *outputs;
+ guint n_outputs;
+
+ if (!priv->manager)
+ return;
+
+ reset_titlebar (panel);
+
+ main_widget = gtk_stack_get_child_by_name (GTK_STACK (priv->stack), "main");
+ if (main_widget)
+ gtk_widget_destroy (main_widget);
+
+ reset_current_config (panel);
+
+ if (!priv->current_config)
+ goto show_error;
+
+ ensure_monitor_labels (panel);
if (!priv->current_output)
goto show_error;
+ outputs = g_object_get_data (G_OBJECT (priv->current_config), "ui-sorted-outputs");
n_outputs = g_list_length (outputs);
if (priv->lid_is_closed)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]