[mutter/gnome-3-28] monitor-manager: Cache the last known value of "lid-is-closed"
- From: Marco Trevisan <marcotrevi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/gnome-3-28] monitor-manager: Cache the last known value of "lid-is-closed"
- Date: Fri, 31 Aug 2018 14:59:11 +0000 (UTC)
commit 24b87b364dc5478600b4f14dbf78db082dd75846
Author: Bastien Nocera <hadess hadess net>
Date: Mon Apr 16 08:57:02 2018 +0000
monitor-manager: Cache the last known value of "lid-is-closed"
Restarting UPower will make every property of UpClient emit a "notify"
signal (as a GDBusProxy would). Avoid mutter reconfiguring the displays
when upower restarts by caching the last known value of "lid-is-closed"
and only reconfiguring the displays if it actually changed.
This fixes a black out of the screen when UPower restarts.
(cherry picked from commit 49b23c749044a855fb3661a0351521f337946c41)
src/backends/meta-monitor-manager-private.h | 1 +
src/backends/meta-monitor-manager.c | 9 ++++++++-
2 files changed, 9 insertions(+), 1 deletion(-)
---
diff --git a/src/backends/meta-monitor-manager-private.h b/src/backends/meta-monitor-manager-private.h
index a7a0671ae..9a59b99c9 100644
--- a/src/backends/meta-monitor-manager-private.h
+++ b/src/backends/meta-monitor-manager-private.h
@@ -181,6 +181,7 @@ struct _MetaMonitorManager
GnomePnpIds *pnp_ids;
UpClient *up_client;
+ gboolean lid_is_closed;
gulong experimental_features_changed_handler_id;
diff --git a/src/backends/meta-monitor-manager.c b/src/backends/meta-monitor-manager.c
index edfa1f64d..ec186009b 100644
--- a/src/backends/meta-monitor-manager.c
+++ b/src/backends/meta-monitor-manager.c
@@ -351,7 +351,13 @@ lid_is_closed_changed (UpClient *client,
gpointer user_data)
{
MetaMonitorManager *manager = user_data;
+ gboolean lid_is_closed;
+ lid_is_closed = up_client_get_lid_is_closed (manager->up_client);
+ if (lid_is_closed == manager->lid_is_closed)
+ return;
+
+ manager->lid_is_closed = lid_is_closed;
meta_monitor_manager_lid_is_closed_changed (manager);
}
@@ -361,7 +367,7 @@ meta_monitor_manager_real_is_lid_closed (MetaMonitorManager *manager)
if (!manager->up_client)
return FALSE;
- return up_client_get_lid_is_closed (manager->up_client);
+ return manager->lid_is_closed;
}
gboolean
@@ -737,6 +743,7 @@ meta_monitor_manager_constructed (GObject *object)
{
g_signal_connect_object (manager->up_client, "notify::lid-is-closed",
G_CALLBACK (lid_is_closed_changed), manager, 0);
+ manager->lid_is_closed = up_client_get_lid_is_closed (manager->up_client);
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]