Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O8uro-0008JD-0C for qemu-devel@nongnu.org; Mon, 03 May 2010 08:35:20 -0400 Received: from [140.186.70.92] (port=35546 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O8urj-0008H5-SE for qemu-devel@nongnu.org; Mon, 03 May 2010 08:35:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O8uri-00023X-9C for qemu-devel@nongnu.org; Mon, 03 May 2010 08:35:15 -0400 Received: from iksaif.net ([88.191.73.63]:38178) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O8urh-00022U-UX for qemu-devel@nongnu.org; Mon, 03 May 2010 08:35:14 -0400 From: Corentin Chary Date: Mon, 3 May 2010 14:31:19 +0200 Message-Id: <1272889879-17563-2-git-send-email-corentincj@iksaif.net> In-Reply-To: <1272889879-17563-1-git-send-email-corentincj@iksaif.net> References: <1272889879-17563-1-git-send-email-corentincj@iksaif.net> Subject: [Qemu-devel] [PATCH 2/2] vnc: set the right prefered encoding List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Corentin Chary , Anthony Liguori >From RFB specs: "The order of the encoding types given in this message is a hint bby the client as to its preference (the first encoding specified being most preferred)" Signed-off-by: Corentin Chary --- vnc.c | 11 +++++++---- 1 files changed, 7 insertions(+), 4 deletions(-) diff --git a/vnc.c b/vnc.c index d332099..ad5b5af 100644 --- a/vnc.c +++ b/vnc.c @@ -1767,7 +1767,7 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings) vnc_zlib_init(vs); vs->features = 0; - vs->vnc_encoding = 0; + vs->vnc_encoding = -1; vs->tight_compression = 9; vs->tight_quality = 9; vs->absolute = -1; @@ -1776,18 +1776,21 @@ static void set_encodings(VncState *vs, int32_t *encodings, size_t n_encodings) enc = encodings[i]; switch (enc) { case VNC_ENCODING_RAW: - vs->vnc_encoding = enc; + if (vs->vnc_encoding != -1) + vs->vnc_encoding = enc; break; case VNC_ENCODING_COPYRECT: vs->features |= VNC_FEATURE_COPYRECT_MASK; break; case VNC_ENCODING_HEXTILE: vs->features |= VNC_FEATURE_HEXTILE_MASK; - vs->vnc_encoding = enc; + if (vs->vnc_encoding != -1) + vs->vnc_encoding = enc; break; case VNC_ENCODING_ZLIB: vs->features |= VNC_FEATURE_ZLIB_MASK; - vs->vnc_encoding = enc; + if (vs->vnc_encoding != -1) + vs->vnc_encoding = enc; break; case VNC_ENCODING_DESKTOPRESIZE: vs->features |= VNC_FEATURE_RESIZE_MASK; -- 1.7.0.2