Re: [gtk-vnc-devel] [PATCH 2/7] Add support for LastRect encoding 2008-11-20 Federico Mena Quintero <federico novell com>



On Thu, 2008-12-18 at 20:10 +0000, Daniel P. Berrange wrote:

> ACK to Federico's patch then, provided we add this explanation in a
> comment at the 'break' statement so we remember just why it works :-)

Attached :)

  Federico
commit 39ae8411111e971d0e795d8cad08c547539b5d97
Author: Federico Mena Quintero <federico novell com>
Date:   Thu Nov 20 13:15:36 2008 -0600

    Add support for LastRect encoding
    2008-11-20  Federico Mena Quintero  <federico novell com>
    
    	Add support for LastRect encoding to make life easier (?) on the
    	VNC server.
    
    	* src/gvnc.h (gvnc_encoding): Define GVNC_ENCODING_LAST_RECT.
    
    	* src/vncdisplay.c (vnc_coroutine): Advertise
    	GVNC_ENCODING_LAST_RECT as a supported encoding.
    
    	* src/gvnc.c (gvnc_server_message): Stop processing rectangles
    	in FramebufferUpdate when we get a LastRect rectangle.
    
    Signed-off-by: Federico Mena Quintero <federico novell com>

diff --git a/ChangeLog b/ChangeLog
index 64355ca..6ce4994 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2008-11-20  Federico Mena Quintero  <federico novell com>
+
+	Add support for LastRect encoding to make life easier (?) on the
+	VNC server.
+
+	* src/gvnc.h (gvnc_encoding): Define GVNC_ENCODING_LAST_RECT.
+
+	* src/vncdisplay.c (vnc_coroutine): Advertise
+	GVNC_ENCODING_LAST_RECT as a supported encoding.
+
+	* src/gvnc.c (gvnc_server_message): Stop processing rectangles
+	in FramebufferUpdate when we get a LastRect rectangle.
+
 2008-11-18  Federico Mena Quintero  <federico novell com>
 
 	* src/vncdisplay.c (vnc_coroutine): Specify the encodings in the
diff --git a/src/gvnc.c b/src/gvnc.c
index 9cf1204..035c504 100644
--- a/src/gvnc.c
+++ b/src/gvnc.c
@@ -2022,7 +2022,7 @@ gboolean gvnc_server_message(struct gvnc *gvnc)
 	switch (msg) {
 	case 0: { /* FramebufferUpdate */
 		uint8_t pad[1];
-		uint16_t n_rects;
+		int n_rects;
 		int i;
 
 		gvnc_read(gvnc, pad, 1);
@@ -2037,6 +2037,21 @@ gboolean gvnc_server_message(struct gvnc *gvnc)
 			h = gvnc_read_u16(gvnc);
 			etype = gvnc_read_s32(gvnc);
 
+			if (etype == GVNC_ENCODING_LAST_RECT) {
+				/* We break the loop here, as LastRect type means
+				 * "this was the last rectangle".  In this case,
+				 * the VNC server sent us n_rects=65535, so it
+				 * doesn't have to count in advance how many
+				 * rectangles there will be.  It can also send
+				 * updates to the pointer position in the middle
+				 * of the rectangles (see
+				 * GVNC_ENCODING_CURSOR_POS, which may want to
+				 * implement at some point).
+				 */
+				GVNC_DEBUG ("FramebufferUpdate(LastRect)\n");
+				break;
+			}
+
 			gvnc_framebuffer_update(gvnc, etype, x, y, w, h);
 		}
 	}	break;
diff --git a/src/gvnc.h b/src/gvnc.h
index 0bd42e2..f1314eb 100644
--- a/src/gvnc.h
+++ b/src/gvnc.h
@@ -89,6 +89,7 @@ typedef enum {
 
 	/* Pseudo encodings */
 	GVNC_ENCODING_DESKTOP_RESIZE = -223,
+	GVNC_ENCODING_LAST_RECT = -224,
         GVNC_ENCODING_WMVi = 0x574D5669,
 
 	GVNC_ENCODING_CURSOR_POS = -232,
diff --git a/src/vncdisplay.c b/src/vncdisplay.c
index fa081a2..45ef57a 100644
--- a/src/vncdisplay.c
+++ b/src/vncdisplay.c
@@ -1278,7 +1278,7 @@ static void *vnc_coroutine(void *opaque)
 				GVNC_ENCODING_XCURSOR,
 				GVNC_ENCODING_RICH_CURSOR,
 				/* GVNC_ENCODING_CURSOR_POS, */	/* we don't implement this */
-				/* GVNC_ENCODING_LAST_RECT, */	/* we don't implement this */
+				GVNC_ENCODING_LAST_RECT,
 				GVNC_ENCODING_DESKTOP_RESIZE,
 
 				/* TightVNC's encodings end above; the following are our own proposed encodings */


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