[virt-tools-list] [PATCH virt-viewer 2/2] Do not enable extra monitors until they are explicitely enabled

Marc-André Lureau marcandre.lureau at gmail.com
Thu Mar 28 18:38:22 UTC 2013


From: Marc-André Lureau <marcandre.lureau at redhat.com>

---
 src/virt-viewer-display-spice.c | 5 +++--
 src/virt-viewer-display.c       | 2 ++
 src/virt-viewer-display.h       | 1 +
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/virt-viewer-display-spice.c b/src/virt-viewer-display-spice.c
index 4ce8641..c589909 100644
--- a/src/virt-viewer-display-spice.c
+++ b/src/virt-viewer-display-spice.c
@@ -99,14 +99,15 @@ show_hint_changed(VirtViewerDisplay *self)
 {
     SpiceMainChannel *main_channel = get_main(self);
     guint enabled = TRUE;
-    guint nth;
+    guint nth, hint = virt_viewer_display_get_show_hint(self);
 
     /* this may happen when finalizing */
     if (!main_channel)
         return;
 
     g_object_get(self, "nth-display", &nth, NULL);
-    if (virt_viewer_display_get_show_hint(self) & VIRT_VIEWER_DISPLAY_SHOW_HINT_DISABLED)
+    if (!(hint & VIRT_VIEWER_DISPLAY_SHOW_HINT_SET) ||
+        hint & VIRT_VIEWER_DISPLAY_SHOW_HINT_DISABLED)
         enabled = FALSE;
 
     spice_main_set_display_enabled(main_channel, nth, enabled);
diff --git a/src/virt-viewer-display.c b/src/virt-viewer-display.c
index e509092..3ec79d6 100644
--- a/src/virt-viewer-display.c
+++ b/src/virt-viewer-display.c
@@ -600,6 +600,8 @@ void virt_viewer_display_set_enabled(VirtViewerDisplay *self, gboolean enabled)
 {
     g_return_if_fail(VIRT_VIEWER_IS_DISPLAY(self));
 
+    virt_viewer_display_set_show_hint(self, VIRT_VIEWER_DISPLAY_SHOW_HINT_SET, TRUE);
+
     virt_viewer_display_set_show_hint(self, VIRT_VIEWER_DISPLAY_SHOW_HINT_DISABLED, !enabled);
 }
 
diff --git a/src/virt-viewer-display.h b/src/virt-viewer-display.h
index 17b44a9..fd238c5 100644
--- a/src/virt-viewer-display.h
+++ b/src/virt-viewer-display.h
@@ -58,6 +58,7 @@ typedef struct _VirtViewerDisplayChannel VirtViewerDisplayChannel;
 typedef enum {
     VIRT_VIEWER_DISPLAY_SHOW_HINT_READY            = 1 << 0,
     VIRT_VIEWER_DISPLAY_SHOW_HINT_DISABLED         = 1 << 1,
+    VIRT_VIEWER_DISPLAY_SHOW_HINT_SET              = 1 << 2,
 } VirtViewerDisplayShowHintFlags;
 
 /* perhaps this become an interface, and be pushed in gtkvnc and spice? */
-- 
1.8.1.1.439.g50a6b54




More information about the virt-tools-list mailing list