[virt-tools-list] [PATCH virt-viewer v3] app: Compute monitor mapping only in fullscreen
Pavel Grunt
pgrunt at redhat.com
Mon Feb 15 11:14:13 UTC 2016
---
v3: g_return changed to early return
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..60157e9 100644
--- a/src/virt-viewer-app.c
+++ b/src/virt-viewer-app.c
@@ -473,15 +473,15 @@ 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);
+ // apply mapping only in fullscreen
+ if (!virt_viewer_app_get_fullscreen(self))
+ return;
- 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 +494,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 +505,20 @@ 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);
+
+ virt_viewer_app_apply_monitor_mapping(self);
+}
+
void
virt_viewer_app_maybe_quit(VirtViewerApp *self, VirtViewerWindow *window)
{
--
2.5.0
More information about the virt-tools-list
mailing list