--- v2: move monitor config setting from _set_uuid_string() --- src/virt-viewer-app.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/src/virt-viewer-app.c b/src/virt-viewer-app.c index c49d3e8..55559d6 100644 --- a/src/virt-viewer-app.c +++ b/src/virt-viewer-app.c @@ -473,15 +473,13 @@ virt_viewer_app_get_monitor_mapping_for_section(VirtViewerApp *self, const gchar } static -void virt_viewer_app_set_uuid_string(VirtViewerApp *self, const gchar *uuid_string) +void virt_viewer_app_apply_monitor_mapping(VirtViewerApp *self) { GHashTable *mapping = NULL; - g_debug("%s: UUID changed to %s", G_STRFUNC, uuid_string); + g_return_if_fail(virt_viewer_app_get_fullscreen(self)); - g_free(self->priv->uuid); - self->priv->uuid = g_strdup(uuid_string); - mapping = virt_viewer_app_get_monitor_mapping_for_section(self, uuid_string); + mapping = virt_viewer_app_get_monitor_mapping_for_section(self, self->priv->uuid); if (!mapping) { g_debug("No guest-specific fullscreen config, using fallback"); mapping = virt_viewer_app_get_monitor_mapping_for_section(self, "fallback"); @@ -494,7 +492,7 @@ void virt_viewer_app_set_uuid_string(VirtViewerApp *self, const gchar *uuid_stri // if we're changing our initial display map, move any existing windows to // the appropriate monitors according to the per-vm configuration - if (mapping && self->priv->fullscreen) { + if (mapping) { GList *l; gint i = 0; @@ -505,6 +503,22 @@ void virt_viewer_app_set_uuid_string(VirtViewerApp *self, const gchar *uuid_stri } } +static +void virt_viewer_app_set_uuid_string(VirtViewerApp *self, const gchar *uuid_string) +{ + if (g_strcmp0(self->priv->uuid, uuid_string) == 0) + return; + + g_debug("%s: UUID changed to %s", G_STRFUNC, uuid_string); + + g_free(self->priv->uuid); + self->priv->uuid = g_strdup(uuid_string); + + // apply mapping only in fullscreen + if (virt_viewer_app_get_fullscreen(self)) + virt_viewer_app_apply_monitor_mapping(self); +} + void virt_viewer_app_maybe_quit(VirtViewerApp *self, VirtViewerWindow *window) { -- 2.5.0 _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list