monitor-config-manager: Find builtin configuration even when inactive

When creating the configuration for the builtin monitor we try to get
the panel configuration for the builtin panel, but we don't proceed if
that monitor is currently inactive.

This is fine when adjusting an active configuration to the current
device rotation, but it isn't correct when we want to create a new
configuration based on another where the monitor is configured but not
yet enabled.

So, only find the panel configuration without looking the current state
but ensuring that the passed configuration will enable it.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1233>
This commit is contained in:
Marco Trevisan (Treviño) 2021-07-30 14:12:40 +02:00 committed by Jonas Ådahl
parent f803c0ee0a
commit c326313370

View File

@ -1007,7 +1007,7 @@ find_logical_config_for_builtin_display_rotation (MetaMonitorConfigManager *conf
GList *l; GList *l;
panel = meta_monitor_manager_get_laptop_panel (config_manager->monitor_manager); panel = meta_monitor_manager_get_laptop_panel (config_manager->monitor_manager);
if (panel && meta_monitor_is_active (panel)) if (panel)
{ {
for (l = logical_monitor_configs; l; l = l->next) for (l = logical_monitor_configs; l; l = l->next)
{ {
@ -1022,9 +1022,16 @@ find_logical_config_for_builtin_display_rotation (MetaMonitorConfigManager *conf
monitor_config = logical_monitor_config->monitor_configs->data; monitor_config = logical_monitor_config->monitor_configs->data;
if (meta_monitor_spec_equals (meta_monitor_get_spec (panel), if (meta_monitor_spec_equals (meta_monitor_get_spec (panel),
monitor_config->monitor_spec)) monitor_config->monitor_spec))
{
MetaMonitorMode *mode;
mode = meta_monitor_get_mode_from_spec (panel,
monitor_config->mode_spec);
if (mode)
return logical_monitor_config; return logical_monitor_config;
} }
} }
}
return NULL; return NULL;
} }