[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
Thu Jan 10 14:52:51 PST 2013


Signed-off-by: Hans de Goede <hdegoede at redhat.com>
---
 gtk/channel-main.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 653b989..720fcfa 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -939,11 +939,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;
@@ -956,8 +960,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;
-- 
1.8.0.2



More information about the Spice-devel mailing list