[Spice-devel] [PATCH spice-gtk 2/2] channel-main: Add support for VD_AGENT_CAP_SPARSE_MONITORS_CONFIG (rhbz#881072)

Hans de Goede hdegoede at redhat.com
Fri Jan 18 05:33:04 PST 2013


Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 gtk/channel-main.c | 20 ++++++++++++++------
 spice-common       |  2 +-
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 706c119..dfd2245 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -1019,11 +1019,15 @@ gboolean spice_main_send_monitor_config(SpiceMainChannel *channel)
     c = channel->priv;
     g_return_val_if_fail(c->agent_connected, FALSE);
 
-    monitors = 0;
-    /* FIXME: fix MonitorConfig to be per display */
-    for (i = 0; i < SPICE_N_ELEMENTS(c->display); i++) {
-        if (c->display[i].enabled)
-            monitors += 1;
+    if (spice_main_agent_test_capability(channel,
+                                     VD_AGENT_CAP_SPARSE_MONITORS_CONFIG)) {
+        monitors = SPICE_N_ELEMENTS(c->display);
+    } else {
+        monitors = 0;
+        for (i = 0; i < SPICE_N_ELEMENTS(c->display); i++) {
+            if (c->display[i].enabled)
+                monitors += 1;
+        }
     }
 
     size = sizeof(VDAgentMonitorsConfig) + sizeof(VDAgentMonConfig) * monitors;
@@ -1036,8 +1040,12 @@ gboolean spice_main_send_monitor_config(SpiceMainChannel *channel)
 
     j = 0;
     for (i = 0; i < SPICE_N_ELEMENTS(c->display); i++) {
-        if (!c->display[i].enabled)
+        if (!c->display[i].enabled) {
+            if (spice_main_agent_test_capability(channel,
+                                     VD_AGENT_CAP_SPARSE_MONITORS_CONFIG))
+                j++;
             continue;
+        }
         mon->monitors[j].depth  = c->display_color_depth ? c->display_color_depth : 32;
         mon->monitors[j].width  = c->display[j].width;
         mon->monitors[j].height = c->display[j].height;
diff --git a/spice-common b/spice-common
index 81f40cc..8a10919 160000
--- a/spice-common
+++ b/spice-common
@@ -1 +1 @@
-Subproject commit 81f40cca5f930bb256da62760859ac802f11b3a7
+Subproject commit 8a10919658950aa600bd5fcaf12c28b026fd70ad
-- 
1.8.0.2



More information about the Spice-devel mailing list