[Spice-devel] [PATCH spice-gtk v2 2/4] main: send only pending monitor config changes

Marc-André Lureau marcandre.lureau at redhat.com
Fri Apr 3 09:26:08 PDT 2015


When agent is ready, do not send current monitor configuration
immediately unless there are pending changes.
---
 gtk/channel-main.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/gtk/channel-main.c b/gtk/channel-main.c
index 86b69a8..e2a450c 100644
--- a/gtk/channel-main.c
+++ b/gtk/channel-main.c
@@ -101,6 +101,7 @@ struct _SpiceMainChannelPrivate  {
         gboolean                enabled_set;
     } display[MAX_DISPLAY];
     gint                        display_timer_id;
+    gboolean                    display_update_pending;
     GQueue                      *agent_msg_queue;
     GHashTable                  *file_xfer_tasks;
     GSList                      *flushing;
@@ -1291,9 +1292,12 @@ static gboolean timer_set_display(gpointer data)
     gint i;
 
     c->display_timer_id = 0;
-    if (!c->agent_connected)
+    if (!c->agent_connected) {
+        c->display_update_pending = TRUE;
         return FALSE;
+    }
 
+    c->display_update_pending = FALSE;
     session = spice_channel_get_session(SPICE_CHANNEL(channel));
 
     /* ensure we have an explicit monitor configuration at least for
@@ -1790,7 +1794,9 @@ static void main_agent_handle_msg(SpiceChannel *channel,
         }
         c->agent_caps_received = true;
         g_coroutine_signal_emit(self, signals[SPICE_MAIN_AGENT_UPDATE], 0);
-        update_display_timer(SPICE_MAIN_CHANNEL(channel), 0);
+
+        if (c->display_timer_id || c->display_update_pending)
+            update_display_timer(SPICE_MAIN_CHANNEL(channel), 0);
 
         if (caps->request)
             agent_announce_caps(self);
-- 
2.1.0



More information about the Spice-devel mailing list