From patchwork Mon May 3 12:31:19 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Corentin Chary X-Patchwork-Id: 51502 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id B4967B7D2E for ; Tue, 4 May 2010 01:16:35 +1000 (EST) Received: from localhost ([127.0.0.1]:43532 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O8xNn-0003gF-77 for incoming@patchwork.ozlabs.org; Mon, 03 May 2010 11:16:31 -0400 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 Received: from localhost.localdomain (localhost [127.0.0.1]) (Authenticated sender: corentincj@iksaif.net) by iksaif.net (Postfix) with ESMTPA id 69F4BC9001A; Mon, 3 May 2010 14:31:22 +0200 (CEST) From: Corentin Chary To: qemu-devel@nongnu.org Date: Mon, 3 May 2010 14:31:19 +0200 Message-Id: <1272889879-17563-2-git-send-email-corentincj@iksaif.net> X-Mailer: git-send-email 1.7.0.2 In-Reply-To: <1272889879-17563-1-git-send-email-corentincj@iksaif.net> References: <1272889879-17563-1-git-send-email-corentincj@iksaif.net> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Mailman-Approved-At: Mon, 03 May 2010 11:14:05 -0400 Cc: Corentin Chary , Anthony Liguori Subject: [Qemu-devel] [PATCH 2/2] vnc: set the right prefered encoding X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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;