legacy-monitor-config: Let the manager listen on lid closed changes

This is in preparation for making config-manager work alongside the
legacy configuration system.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
Jonas Ådahl 2017-03-04 15:18:29 +08:00
parent ac68631f4c
commit 57acbc53fb
3 changed files with 8 additions and 20 deletions

View File

@ -96,9 +96,6 @@ static gboolean meta_monitor_config_assign_crtcs (MetaConfiguration *config,
GPtrArray *crtcs, GPtrArray *crtcs,
GPtrArray *outputs); GPtrArray *outputs);
static void power_client_changed_cb (MetaMonitorManager *manager,
gpointer user_data);
static void static void
free_output_key (MetaOutputKey *key) free_output_key (MetaOutputKey *key)
{ {
@ -794,8 +791,6 @@ meta_monitor_config_new (MetaMonitorManager *manager)
self = g_object_new (META_TYPE_MONITOR_CONFIG, NULL); self = g_object_new (META_TYPE_MONITOR_CONFIG, NULL);
self->lid_is_closed = meta_monitor_manager_is_lid_closed (manager); self->lid_is_closed = meta_monitor_manager_is_lid_closed (manager);
g_signal_connect_object (manager, "lid-is-closed-changed",
G_CALLBACK (power_client_changed_cb), self, 0);
meta_monitor_config_load (self); meta_monitor_config_load (self);
@ -1584,11 +1579,10 @@ turn_off_laptop_display (MetaMonitorConfig *self,
self->current_is_for_laptop_lid = TRUE; self->current_is_for_laptop_lid = TRUE;
} }
static void void
power_client_changed_cb (MetaMonitorManager *manager, meta_monitor_config_lid_is_closed_changed (MetaMonitorConfig *self,
gpointer user_data) MetaMonitorManager *manager)
{ {
MetaMonitorConfig *self = user_data;
gboolean is_closed; gboolean is_closed;
is_closed = meta_monitor_manager_is_lid_closed (manager); is_closed = meta_monitor_manager_is_lid_closed (manager);

View File

@ -46,4 +46,7 @@ void meta_monitor_config_restore_previous (MetaMonitorConfig *con
gboolean meta_monitor_config_get_is_builtin_display_on (MetaMonitorConfig *config); gboolean meta_monitor_config_get_is_builtin_display_on (MetaMonitorConfig *config);
void meta_monitor_config_lid_is_closed_changed (MetaMonitorConfig *self,
MetaMonitorManager *manager);
#endif /* META_MONITOR_CONFIG_H */ #endif /* META_MONITOR_CONFIG_H */

View File

@ -45,7 +45,6 @@
enum { enum {
CONFIRM_DISPLAY_CHANGE, CONFIRM_DISPLAY_CHANGE,
LID_IS_CLOSED_CHANGED,
SIGNALS_LAST SIGNALS_LAST
}; };
@ -243,8 +242,8 @@ meta_monitor_manager_lid_is_closed_changed (MetaMonitorManager *manager)
{ {
if (manager->config_manager) if (manager->config_manager)
meta_monitor_manager_ensure_configured (manager); meta_monitor_manager_ensure_configured (manager);
else
g_signal_emit (manager, signals[LID_IS_CLOSED_CHANGED], 0); meta_monitor_config_lid_is_closed_changed (manager->legacy_config, manager);
} }
static void static void
@ -668,14 +667,6 @@ meta_monitor_manager_class_init (MetaMonitorManagerClass *klass)
0, 0,
NULL, NULL, NULL, NULL, NULL, NULL,
G_TYPE_NONE, 0); G_TYPE_NONE, 0);
signals[LID_IS_CLOSED_CHANGED] =
g_signal_new ("lid-is-closed-changed",
G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
0,
NULL, NULL, NULL,
G_TYPE_NONE, 0);
} }
static const double known_diagonals[] = { static const double known_diagonals[] = {