monitor-mapping: Do not allow to skip a display

Skipping a display does not have an effect because displays will be
reconfigured and shifted on the guest side anyway.

these monitor mappings are not valid:
 'monitor-mapping=1:2;3:1' - display #2 is not specified
 'monitor-mapping=4:2;2:1' - displays #1, #3 are not specified
 'monitor-mapping=3:3'     - displays #1, #2 are not specified
This commit is contained in:
Pavel Grunt 2015-06-03 14:43:53 +02:00
parent ad438e0b96
commit 233c61eaea
3 changed files with 17 additions and 0 deletions

View File

@ -332,6 +332,10 @@ guest with a UUID of e4591275-d9d3-4a44-a18b-ef2fbc8ac3e2, use:
[e4591275-d9d3-4a44-a18b-ef2fbc8ac3e2]
monitor-mapping=1:2;2:3
The monitor-mapping must contain ids of all displays from 1 to the last
desired display id, e.g. "monitor-mapping=3:3" is invalid because mappings
for displays 1 and 2 are not specified.
=head1 EXAMPLES
To connect to SPICE server on host "makai" with port 5900

View File

@ -151,6 +151,10 @@ guest with a UUID of e4591275-d9d3-4a44-a18b-ef2fbc8ac3e2, use:
[e4591275-d9d3-4a44-a18b-ef2fbc8ac3e2]
monitor-mapping=1:2;2:3
The monitor-mapping must contain ids of all displays from 1 to the last
desired display id, e.g. "monitor-mapping=3:3" is invalid because mappings
for displays 1 and 2 are not specified.
=head1 EXAMPLES
To connect to the guest called 'demo' running under Xen

View File

@ -370,6 +370,7 @@ virt_viewer_app_parse_monitor_mappings(gchar **mappings, gsize nmappings)
GHashTable *displaymap = g_hash_table_new(g_direct_hash, g_direct_equal);
GHashTable *monitormap = g_hash_table_new(g_direct_hash, g_direct_equal);
int i = 0;
int max_display_id = 0;
gchar **tokens = NULL;
for (i = 0; i < nmappings; i++) {
@ -414,6 +415,14 @@ virt_viewer_app_parse_monitor_mappings(gchar **mappings, gsize nmappings)
g_debug("Fullscreen config: mapping guest display %i to monitor %i", display, monitor);
g_hash_table_insert(displaymap, GINT_TO_POINTER(display), GINT_TO_POINTER(monitor));
g_hash_table_insert(monitormap, GINT_TO_POINTER(monitor), GINT_TO_POINTER(display));
max_display_id = MAX(display, max_display_id);
}
}
for (i = 0; i < max_display_id; i++) {
if (!g_hash_table_lookup_extended(displaymap, GINT_TO_POINTER(i), NULL, NULL)) {
g_warning("Invalid monitor-mapping configuration: display #%d was not specified", i+1);
goto configerror;
}
}