summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Grunt <pgrunt@redhat.com>2016-02-14 19:11:36 +0100
committerPavel Grunt <pgrunt@redhat.com>2016-02-15 13:51:13 +0100
commit724744ca209297322b04cd9ed11e898a3d68a281 (patch)
tree61447189b98b80f214529ddfdb0f3e4c43df5e77
parent529980e8d3fd7d5c042ad071b63a3fbd75ef456c (diff)
downloadvirt-viewer-724744ca209297322b04cd9ed11e898a3d68a281.tar.gz
virt-viewer-724744ca209297322b04cd9ed11e898a3d68a281.tar.xz
virt-viewer-724744ca209297322b04cd9ed11e898a3d68a281.zip
app: Compute monitor mapping only in fullscreen
-rw-r--r--src/virt-viewer-app.c26
1 files 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)
{