mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 08:00:42 -05:00
monitor-config-manager: Add MetaMonitorsConfig creation helper
Add a meta_monitors_config_new() helper. It's exposed outside of meta-monitor-config-manager.c already, as it'll be used externally in a later commit. https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
parent
81923410f6
commit
4b33f05eda
@ -431,8 +431,8 @@ MetaMonitorsConfig *
|
|||||||
meta_monitor_config_manager_create_linear (MetaMonitorConfigManager *config_manager)
|
meta_monitor_config_manager_create_linear (MetaMonitorConfigManager *config_manager)
|
||||||
{
|
{
|
||||||
MetaMonitorManager *monitor_manager = config_manager->monitor_manager;
|
MetaMonitorManager *monitor_manager = config_manager->monitor_manager;
|
||||||
|
GList *logical_monitor_configs;
|
||||||
MetaMonitor *primary_monitor;
|
MetaMonitor *primary_monitor;
|
||||||
MetaMonitorsConfig *config;
|
|
||||||
MetaLogicalMonitorConfig *primary_logical_monitor_config;
|
MetaLogicalMonitorConfig *primary_logical_monitor_config;
|
||||||
int x;
|
int x;
|
||||||
GList *monitors;
|
GList *monitors;
|
||||||
@ -440,13 +440,11 @@ meta_monitor_config_manager_create_linear (MetaMonitorConfigManager *config_mana
|
|||||||
|
|
||||||
primary_monitor = find_primary_monitor (monitor_manager);
|
primary_monitor = find_primary_monitor (monitor_manager);
|
||||||
|
|
||||||
config = g_object_new (META_TYPE_MONITORS_CONFIG, NULL);
|
|
||||||
|
|
||||||
primary_logical_monitor_config =
|
primary_logical_monitor_config =
|
||||||
create_preferred_logical_monitor_config (primary_monitor, 0, 0);
|
create_preferred_logical_monitor_config (primary_monitor, 0, 0);
|
||||||
primary_logical_monitor_config->is_primary = TRUE;
|
primary_logical_monitor_config->is_primary = TRUE;
|
||||||
config->logical_monitor_configs =
|
logical_monitor_configs = g_list_append (NULL,
|
||||||
g_list_append (NULL, primary_logical_monitor_config);
|
primary_logical_monitor_config);
|
||||||
|
|
||||||
x = primary_logical_monitor_config->layout.width;
|
x = primary_logical_monitor_config->layout.width;
|
||||||
monitors = meta_monitor_manager_get_monitors (monitor_manager);
|
monitors = meta_monitor_manager_get_monitors (monitor_manager);
|
||||||
@ -464,13 +462,13 @@ meta_monitor_config_manager_create_linear (MetaMonitorConfigManager *config_mana
|
|||||||
|
|
||||||
logical_monitor_config =
|
logical_monitor_config =
|
||||||
create_preferred_logical_monitor_config (monitor, x, 0);
|
create_preferred_logical_monitor_config (monitor, x, 0);
|
||||||
config->logical_monitor_configs =
|
logical_monitor_configs = g_list_append (logical_monitor_configs,
|
||||||
g_list_append (config->logical_monitor_configs, logical_monitor_config);
|
logical_monitor_config);
|
||||||
|
|
||||||
x += logical_monitor_config->layout.width;
|
x += logical_monitor_config->layout.width;
|
||||||
}
|
}
|
||||||
|
|
||||||
return config;
|
return meta_monitors_config_new (logical_monitor_configs);
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaMonitorsConfig *
|
MetaMonitorsConfig *
|
||||||
@ -478,27 +476,24 @@ meta_monitor_config_manager_create_fallback (MetaMonitorConfigManager *config_ma
|
|||||||
{
|
{
|
||||||
MetaMonitorManager *monitor_manager = config_manager->monitor_manager;
|
MetaMonitorManager *monitor_manager = config_manager->monitor_manager;
|
||||||
MetaMonitor *primary_monitor;
|
MetaMonitor *primary_monitor;
|
||||||
MetaMonitorsConfig *config;
|
GList *logical_monitor_configs;
|
||||||
MetaLogicalMonitorConfig *primary_logical_monitor_config;
|
MetaLogicalMonitorConfig *primary_logical_monitor_config;
|
||||||
|
|
||||||
primary_monitor = find_primary_monitor (monitor_manager);
|
primary_monitor = find_primary_monitor (monitor_manager);
|
||||||
|
|
||||||
config = g_object_new (META_TYPE_MONITORS_CONFIG, NULL);
|
|
||||||
|
|
||||||
primary_logical_monitor_config =
|
primary_logical_monitor_config =
|
||||||
create_preferred_logical_monitor_config (primary_monitor, 0, 0);
|
create_preferred_logical_monitor_config (primary_monitor, 0, 0);
|
||||||
primary_logical_monitor_config->is_primary = TRUE;
|
primary_logical_monitor_config->is_primary = TRUE;
|
||||||
config->logical_monitor_configs =
|
logical_monitor_configs = g_list_append (NULL,
|
||||||
g_list_append (NULL, primary_logical_monitor_config);
|
primary_logical_monitor_config);
|
||||||
|
|
||||||
return config;
|
return meta_monitors_config_new (logical_monitor_configs);
|
||||||
}
|
}
|
||||||
|
|
||||||
MetaMonitorsConfig *
|
MetaMonitorsConfig *
|
||||||
meta_monitor_config_manager_create_suggested (MetaMonitorConfigManager *config_manager)
|
meta_monitor_config_manager_create_suggested (MetaMonitorConfigManager *config_manager)
|
||||||
{
|
{
|
||||||
MetaMonitorManager *monitor_manager = config_manager->monitor_manager;
|
MetaMonitorManager *monitor_manager = config_manager->monitor_manager;
|
||||||
MetaMonitorsConfig *config;
|
|
||||||
MetaLogicalMonitorConfig *primary_logical_monitor_config = NULL;
|
MetaLogicalMonitorConfig *primary_logical_monitor_config = NULL;
|
||||||
MetaMonitor *primary_monitor;
|
MetaMonitor *primary_monitor;
|
||||||
GList *logical_monitor_configs;
|
GList *logical_monitor_configs;
|
||||||
@ -554,11 +549,7 @@ meta_monitor_config_manager_create_suggested (MetaMonitorConfigManager *config_m
|
|||||||
|
|
||||||
primary_logical_monitor_config->is_primary = TRUE;
|
primary_logical_monitor_config->is_primary = TRUE;
|
||||||
|
|
||||||
config = g_object_new (META_TYPE_MONITORS_CONFIG, NULL);
|
return meta_monitors_config_new (logical_monitor_configs);
|
||||||
|
|
||||||
config->logical_monitor_configs = logical_monitor_configs;
|
|
||||||
|
|
||||||
return config;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -614,6 +605,17 @@ meta_logical_monitor_config_free (MetaLogicalMonitorConfig *logical_monitor_conf
|
|||||||
g_free (logical_monitor_config);
|
g_free (logical_monitor_config);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MetaMonitorsConfig *
|
||||||
|
meta_monitors_config_new (GList *logical_monitor_configs)
|
||||||
|
{
|
||||||
|
MetaMonitorsConfig *config;
|
||||||
|
|
||||||
|
config = g_object_new (META_TYPE_MONITORS_CONFIG, NULL);
|
||||||
|
config->logical_monitor_configs = logical_monitor_configs;
|
||||||
|
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
meta_monitors_config_finalize (GObject *object)
|
meta_monitors_config_finalize (GObject *object)
|
||||||
{
|
{
|
||||||
|
@ -73,4 +73,6 @@ void meta_monitor_config_manager_set_current (MetaMonitorConfigManager *config_m
|
|||||||
|
|
||||||
MetaMonitorsConfig * meta_monitor_config_manager_get_current (MetaMonitorConfigManager *config_manager);
|
MetaMonitorsConfig * meta_monitor_config_manager_get_current (MetaMonitorConfigManager *config_manager);
|
||||||
|
|
||||||
|
MetaMonitorsConfig * meta_monitors_config_new (GList *logical_monitor_configs);
|
||||||
|
|
||||||
#endif /* META_MONITOR_CONFIG_MANAGER_H */
|
#endif /* META_MONITOR_CONFIG_MANAGER_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user