[mutter/wip/up-client-cleanups: 134/136] monitor-manager: Cache the last known value of "lid-is-closed"
- From: Jonas Ådahl <jadahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter/wip/up-client-cleanups: 134/136] monitor-manager: Cache the last known value of "lid-is-closed"
- Date: Wed, 18 Jul 2018 10:19:07 +0000 (UTC)
commit 49b23c749044a855fb3661a0351521f337946c41
Author: Bastien Nocera <hadess hadess net>
Date: Mon Apr 16 10:57:02 2018 +0200
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.
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 2dde4f711..80802c477 100644
--- a/src/backends/meta-monitor-manager-private.h
+++ b/src/backends/meta-monitor-manager-private.h
@@ -180,6 +180,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 5c7eae8e9..a6c7f9a0d 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]