[gtk-vnc] src: add support for "last rect" encoding type



commit b23dda74d8851265cbdba838540049c8ca3833ee
Author: Daniel P. Berrangé <dan berrange com>
Date:   Fri Dec 11 14:59:03 2020 +0000

    src: add support for "last rect" encoding type
    
    The last rect encoding allows servers to be more efficient by sending
    rectangles before knowing how many there will be in total.
    
    Signed-off-by: Daniel P. Berrangé <berrange redhat com>

 src/vncconnection.c | 6 ++++++
 src/vncconnection.h | 1 +
 src/vncdisplay.c    | 1 +
 3 files changed, 8 insertions(+)
---
diff --git a/src/vncconnection.c b/src/vncconnection.c
index d335700..c3c9728 100644
--- a/src/vncconnection.c
+++ b/src/vncconnection.c
@@ -3475,6 +3475,7 @@ static gboolean vnc_connection_server_message(VncConnection *conn)
 
         vnc_connection_read(conn, pad, 1);
         n_rects = vnc_connection_read_u16(conn);
+        VNC_DEBUG("Num rects %d", n_rects);
         for (i = 0; i < n_rects; i++) {
             guint16 x, y, w, h;
             gint32 etype;
@@ -3485,6 +3486,11 @@ static gboolean vnc_connection_server_message(VncConnection *conn)
             h = vnc_connection_read_u16(conn);
             etype = vnc_connection_read_s32(conn);
 
+            if (etype == VNC_CONNECTION_ENCODING_LAST_RECT) {
+                VNC_DEBUG("Last rect");
+                break;
+            }
+
             if (!vnc_connection_framebuffer_update(conn, etype, x, y, w, h))
                 break;
         }
diff --git a/src/vncconnection.h b/src/vncconnection.h
index aac2a6b..85041e1 100644
--- a/src/vncconnection.h
+++ b/src/vncconnection.h
@@ -114,6 +114,7 @@ typedef enum {
 
     /* Pseudo encodings */
     VNC_CONNECTION_ENCODING_DESKTOP_RESIZE = -223,
+    VNC_CONNECTION_ENCODING_LAST_RECT = -224,
     VNC_CONNECTION_ENCODING_WMVi = 0x574D5669,
 
     VNC_CONNECTION_ENCODING_CURSOR_POS = -232,
diff --git a/src/vncdisplay.c b/src/vncdisplay.c
index ae9a1bd..67f8854 100644
--- a/src/vncdisplay.c
+++ b/src/vncdisplay.c
@@ -1634,6 +1634,7 @@ static void on_initialized(VncConnection *conn G_GNUC_UNUSED,
                             VNC_CONNECTION_ENCODING_EXT_KEY_EVENT,
                             VNC_CONNECTION_ENCODING_LED_STATE,
                             VNC_CONNECTION_ENCODING_DESKTOP_RESIZE,
+                            VNC_CONNECTION_ENCODING_LAST_RECT,
                             VNC_CONNECTION_ENCODING_WMVi,
                             VNC_CONNECTION_ENCODING_AUDIO,
                             VNC_CONNECTION_ENCODING_ALPHA_CURSOR,


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