monitor-config-manager: Verify monitor modes in logical monitor config

Verify that each monitor in a logical monitor has the same dimensions,
i.e. that it they all fill out the same logical monitor space.

https://bugzilla.gnome.org/show_bug.cgi?id=777732
This commit is contained in:
Jonas Ådahl 2017-02-14 19:43:10 +08:00
parent 9a5b94a340
commit 7eaeba520a

View File

@ -865,6 +865,10 @@ gboolean
meta_verify_logical_monitor_config (MetaLogicalMonitorConfig *logical_monitor_config, meta_verify_logical_monitor_config (MetaLogicalMonitorConfig *logical_monitor_config,
GError **error) GError **error)
{ {
GList *l;
int layout_width;
int layout_height;
if (logical_monitor_config->scale < 1) if (logical_monitor_config->scale < 1)
{ {
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED, g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
@ -890,6 +894,21 @@ meta_verify_logical_monitor_config (MetaLogicalMonitorConfig *logical_monitor_co
return FALSE; return FALSE;
} }
layout_width = logical_monitor_config->layout.width;
layout_height = logical_monitor_config->layout.height;
for (l = logical_monitor_config->monitor_configs; l; l = l->next)
{
MetaMonitorConfig *monitor_config = l->data;
if (monitor_config->mode_spec->width != layout_width ||
monitor_config->mode_spec->height != layout_height)
{
g_set_error (error, G_IO_ERROR, G_IO_ERROR_FAILED,
"Monitor modes in logical monitor conflict");
return FALSE;
}
}
return TRUE; return TRUE;
} }