monitor-config-manager: Reject a suggested config with gaps

It could happen that monitors suggest to use coordinates that don't take
in consideration the scaling applied to one monitor, and such the
generated configuration is not valid because not all the monitors are
adjacent.

So enforce this check before accepting a suggested configuration as it
is.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/522>
This commit is contained in:
Marco Trevisan (Treviño) 2019-03-16 00:22:31 +01:00 committed by Marge Bot
parent 58c2f423f7
commit be9e6dcc4f

View File

@ -904,6 +904,21 @@ meta_monitor_config_manager_create_suggested (MetaMonitorConfigManager *config_m
region = g_list_prepend (region, &logical_monitor_config->layout);
}
for (l = region; region->next && l; l = l->next)
{
MetaRectangle *rect = l->data;
if (!meta_rectangle_is_adjacent_to_any_in_region (region, rect))
{
g_warning ("Suggested monitor config has monitors with no neighbors, "
"rejecting");
g_list_free (region);
g_list_free_full (logical_monitor_configs,
(GDestroyNotify) meta_logical_monitor_config_free);
return NULL;
}
}
g_list_free (region);
if (!logical_monitor_configs)