From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:58038) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UcVTO-0005xp-Mf for qemu-devel@nongnu.org; Wed, 15 May 2013 02:46:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UcVTN-0000Qn-Co for qemu-devel@nongnu.org; Wed, 15 May 2013 02:46:02 -0400 Received: from mx1.redhat.com ([209.132.183.28]:1199) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UcVTM-0000QU-Tm for qemu-devel@nongnu.org; Wed, 15 May 2013 02:46:01 -0400 Message-ID: <51932EE9.7050904@redhat.com> Date: Wed, 15 May 2013 08:44:57 +0200 From: Gerd Hoffmann MIME-Version: 1.0 References: <1366867752-11578-1-git-send-email-lilei@linux.vnet.ibm.com> <1366867752-11578-3-git-send-email-lilei@linux.vnet.ibm.com> <51922170.8070808@redhat.com> <5193259F.9020803@linux.vnet.ibm.com> In-Reply-To: <5193259F.9020803@linux.vnet.ibm.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 2/4] vnc: Support for LED state extension List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Lei Li Cc: lagarcia@br.ibm.com, aliguori@us.ibm.com, Laszlo Ersek , qemu-devel@nongnu.org On 05/15/13 08:05, Lei Li wrote: > On 05/14/2013 07:35 PM, Gerd Hoffmann wrote: >> On 04/25/13 07:29, Lei Li wrote: >>> + /* Sending the current led state message to the client */ >>> + if (ledstate != current_led_state(vs)) { >>> + vnc_led_state_change(vs); >>> + } >> This check never becomes true as the vnc modifier/led state just got >> updated to match ledstate ... > > Oh... then how about get rid of this check, let vnc_led_state_change send > the current led state message directly? Only sending an update if something did actually change makes sense I think, but you need to check before updating the state, i.e. something like this: bool has_changed = ledstate != current_led_state(vs); [ update modifiers/led state ] if (has_changed) vnc_led_state_change() cheers, Gerd