[PATCH] Defer the first framebuffer request to an idle event



From: Jonh Wendell <jonh wendell intel com>

It seems the first framebuffer update request sometimes is
not being correctly sent to the server.

Delaying its execution to an idle event seems to fix that.

https://bugzilla.gnome.org/show_bug.cgi?id=703326

Signed-off-by: Jonh Wendell <jonh wendell intel com>
---
 src/vncdisplay.c | 28 +++++++++++++++++++---------
 1 file changed, 19 insertions(+), 9 deletions(-)

diff --git a/src/vncdisplay.c b/src/vncdisplay.c
index 37de008..a428a2a 100644
--- a/src/vncdisplay.c
+++ b/src/vncdisplay.c
@@ -1432,6 +1432,24 @@ static void on_connected(VncConnection *conn G_GNUC_UNUSED,
     VNC_DEBUG("Connected to VNC server");
 }
 
+static gboolean
+request_first_update (VncDisplay *obj)
+{
+    VNC_DEBUG("Requesting first framebuffer update");
+    if (vnc_connection_framebuffer_update_request(obj->priv->conn, 0, 0, 0,
+                                                  vnc_connection_get_width(obj->priv->conn),
+                                                  vnc_connection_get_height(obj->priv->conn)))
+      {
+          g_signal_emit(G_OBJECT(obj), signals[VNC_INITIALIZED], 0);
+          VNC_DEBUG("Initialized VNC server");
+      }
+    else
+      {
+          vnc_connection_shutdown(obj->priv->conn);
+      }
+
+    return FALSE;
+}
 
 static void on_initialized(VncConnection *conn G_GNUC_UNUSED,
                            gpointer opaque)
@@ -1496,15 +1514,7 @@ static void on_initialized(VncConnection *conn G_GNUC_UNUSED,
     if (!vnc_connection_set_encodings(priv->conn, n_encodings, encodings))
         goto error;
 
-    VNC_DEBUG("Requesting first framebuffer update");
-    if (!vnc_connection_framebuffer_update_request(priv->conn, 0, 0, 0,
-                                                   vnc_connection_get_width(priv->conn),
-                                                   vnc_connection_get_height(priv->conn)))
-        goto error;
-
-    g_signal_emit(G_OBJECT(obj), signals[VNC_INITIALIZED], 0);
-
-    VNC_DEBUG("Initialized VNC server");
+    g_idle_add ((GSourceFunc) request_first_update, obj);
     return;
 
  error:
-- 
1.8.1.4



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]