Commit 07bc5f88 authored by Alberts Muktupāvels's avatar Alberts Muktupāvels

monitor-manager: cache the last known value of "lid-is-closed"

Based on mutter commit:
mutter@49b23c74
parent cc7cf987
......@@ -70,6 +70,7 @@ struct _GfMonitorManager
GnomePnpIds *pnp_ids;
UpClient *up_client;
gboolean lid_is_closed;
GfMonitorSwitchConfigType current_switch_config;
};
......
......@@ -1989,7 +1989,7 @@ gf_monitor_manager_real_is_lid_closed (GfMonitorManager *manager)
if (!manager->up_client)
return FALSE;
return up_client_get_lid_is_closed (manager->up_client);
return manager->lid_is_closed;
}
static void
......@@ -1997,8 +1997,16 @@ lid_is_closed_changed (UpClient *client,
GParamSpec *pspec,
gpointer user_data)
{
GfMonitorManager *manager = user_data;
GfMonitorManager *manager;
gboolean lid_is_closed;
manager = user_data;
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;
gf_monitor_manager_ensure_configured (manager);
}
......@@ -2024,6 +2032,8 @@ gf_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);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment