diff options
author | Pavel Grunt <pgrunt@redhat.com> | 2015-06-03 14:43:53 +0200 |
---|---|---|
committer | Pavel Grunt <pgrunt@redhat.com> | 2015-06-04 10:58:09 +0200 |
commit | 233c61eaea20408d15eb8720a7bda784a975a9b3 (patch) | |
tree | 8092aec60996ce9cdbb8f0e2ed2c816b79af9cfd | |
parent | ad438e0b9676387bb12df9d7024b0a201770af9c (diff) |
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
-rw-r--r-- | man/remote-viewer.pod | 4 | ||||
-rw-r--r-- | man/virt-viewer.pod | 4 | ||||
-rw-r--r-- | src/virt-viewer-app.c | 9 |
3 files changed, 17 insertions, 0 deletions
diff --git a/man/remote-viewer.pod b/man/remote-viewer.pod index 00b474c..eb85532 100644 --- a/man/remote-viewer.pod +++ b/man/remote-viewer.pod @@ -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 diff --git a/man/virt-viewer.pod b/man/virt-viewer.pod index aaf9eff..ca1c9e8 100644 --- a/man/virt-viewer.pod +++ b/man/virt-viewer.pod @@ -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 diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c index b22a876..8a08b6b 100644 --- a/src/virt-viewer-app.c +++ b/src/virt-viewer-app.c @@ -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; } } |