[virt-tools-list] [PATCH virt-viewer 2/3] Set enabled status of all displays when we get a monitor update

Jonathon Jongsma jjongsma at redhat.com
Mon Aug 3 20:59:09 UTC 2015


Previously, when we received a new monitors update from the server, we
only called virt_viewer_display_set_enabled() for the displays that were
enabled. We simply assumed that those that were not enabled were already
set to disabled. This assumption is currently valid, but I have some
changes in the pipeline where this is not true. This change ensures that
we update the enabled state of all monitors when we get an updated
monitors conifguration.
---
 src/virt-viewer-session-spice.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/virt-viewer-session-spice.c b/src/virt-viewer-session-spice.c
index 1649a62..988fc5b 100644
--- a/src/virt-viewer-session-spice.c
+++ b/src/virt-viewer-session-spice.c
@@ -806,13 +806,15 @@ virt_viewer_session_spice_display_monitors(SpiceChannel *channel,
 
     for (i = 0; i < monitors->len; i++) {
         SpiceDisplayMonitorConfig *monitor = &g_array_index(monitors, SpiceDisplayMonitorConfig, i);
+        gboolean disabled = monitor->width == 0 || monitor->height == 0;
         display = g_ptr_array_index(displays, monitor->id);
         g_return_if_fail(display != NULL);
 
-        if (monitor->width == 0 || monitor->height == 0)
+        virt_viewer_display_set_enabled(VIRT_VIEWER_DISPLAY(display), !disabled);
+
+        if (disabled)
             continue;
 
-        virt_viewer_display_set_enabled(VIRT_VIEWER_DISPLAY(display), TRUE);
         virt_viewer_display_spice_set_desktop(VIRT_VIEWER_DISPLAY(display),
                                               monitor->x, monitor->y,
                                               monitor->width, monitor->height);
-- 
2.1.0




More information about the virt-tools-list mailing list