[virt-tools-list] [PATCH virt-viewer v4 1/3] monitor-mapping: Do not allow to skip a display
Jonathon Jongsma
jjongsma at redhat.com
Mon May 4 16:44:04 UTC 2015
On Mon, 2015-05-04 at 17:20 +0200, Pavel Grunt wrote:
> Skipping a display does not have an effect because displays will be
> reconfigured and shifted on the guest side anyway.
>
> these are not valid monitor mappings:
> 'monitor-mapping=1:2;3:1' - display #2 is not specified
> 'monitor-mapping=4:2;2:1' - displays #1, #3 are not specified
>
> Related: rhbz#1212802
> ---
> src/virt-viewer-app.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
>
> 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;
> }
> }
>
I'm OK with this additional restriction, but we should perhaps modify
the documentation to explain this.
More information about the virt-tools-list
mailing list