summaryrefslogtreecommitdiff
path: root/src/backends/meta-monitor-config.c
diff options
context:
space:
mode:
authorGiovanni Campagna <gcampagna@src.gnome.org>2014-05-06 19:59:16 +0200
committerGiovanni Campagna <gcampagna@src.gnome.org>2014-05-06 21:28:41 +0200
commit2ca2c18c2adf23d7a5a215822255e17a1f49b0cd (patch)
tree1175020f3e81c51e6207fc6fcbb80e7234154e32 /src/backends/meta-monitor-config.c
parent01cd4b2ba02a729dcbcc06afa3aec315bc70ef2f (diff)
MetaMonitorConfig: don't always restore the previous config when opening the laptop lid
Only do it if the current configuration was actually created as the result of closing the laptop lid. https://bugzilla.gnome.org/show_bug.cgi?id=725637
Diffstat (limited to 'src/backends/meta-monitor-config.c')
-rw-r--r--src/backends/meta-monitor-config.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/backends/meta-monitor-config.c b/src/backends/meta-monitor-config.c
index 41fe60d9..a829daa4 100644
--- a/src/backends/meta-monitor-config.c
+++ b/src/backends/meta-monitor-config.c
@@ -78,6 +78,7 @@ struct _MetaMonitorConfig {
GHashTable *configs;
MetaConfiguration *current;
gboolean current_is_stored;
+ gboolean current_is_for_laptop_lid;
MetaConfiguration *previous;
GFile *file;
@@ -906,6 +907,10 @@ apply_configuration (MetaMonitorConfig *self,
self->current = config;
self->current_is_stored = stored;
+ /* If true, we'll be overridden at the end of this call
+ inside turn_off_laptop_display()
+ */
+ self->current_is_for_laptop_lid = FALSE;
if (self->current == self->previous)
self->previous = NULL;
@@ -1022,8 +1027,16 @@ meta_monitor_config_apply_stored (MetaMonitorConfig *self,
if (self->lid_is_closed &&
stored->n_outputs > 1 &&
laptop_display_is_on (stored))
- return apply_configuration (self, make_laptop_lid_config (stored),
- manager, FALSE);
+ {
+ if (apply_configuration (self, make_laptop_lid_config (stored),
+ manager, FALSE))
+ {
+ self->current_is_for_laptop_lid = TRUE;
+ return TRUE;
+ }
+ else
+ return FALSE;
+ }
else
return apply_configuration (self, stored, manager, TRUE);
}
@@ -1370,6 +1383,7 @@ turn_off_laptop_display (MetaMonitorConfig *self,
new = make_laptop_lid_config (self->current);
apply_configuration (self, new, manager, FALSE);
+ self->current_is_for_laptop_lid = TRUE;
}
static void
@@ -1389,7 +1403,7 @@ power_client_changed_cb (UpClient *client,
if (is_closed)
turn_off_laptop_display (self, manager);
- else
+ else if (self->current_is_for_laptop_lid)
meta_monitor_config_restore_previous (self, manager);
}
}