[gnome-control-center/gnome-3-26] display: Reset configuration when switching layouting modes
- From: Benjamin Berg <bberg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center/gnome-3-26] display: Reset configuration when switching layouting modes
- Date: Fri, 8 Dec 2017 16:08:59 +0000 (UTC)
commit 0a57c675883eff010ee0c246afd621226139d591
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 e84a53e..f98b397 100644
--- a/panels/display/cc-display-panel.c
+++ b/panels/display/cc-display-panel.c
@@ -125,6 +125,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)
@@ -1893,6 +1895,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)
{
@@ -2185,38 +2189,26 @@ 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;
if (priv->dialog)
gtk_dialog_response (GTK_DIALOG (priv->dialog), GTK_RESPONSE_NONE);
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)
{
@@ -2228,10 +2220,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]