Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NkbV0-0003Yu-J4 for qemu-devel@nongnu.org; Thu, 25 Feb 2010 06:03:18 -0500 Received: from [199.232.76.173] (port=37294 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NkbUz-0003YX-Er for qemu-devel@nongnu.org; Thu, 25 Feb 2010 06:03:17 -0500 Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1NkbUy-0006rg-3Z for qemu-devel@nongnu.org; Thu, 25 Feb 2010 06:03:17 -0500 Received: from mx1.redhat.com ([209.132.183.28]:21919) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NkbUx-0006ra-OQ for qemu-devel@nongnu.org; Thu, 25 Feb 2010 06:03:15 -0500 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o1PB3EUo017296 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 25 Feb 2010 06:03:14 -0500 From: Juan Quintela In-Reply-To: <1267087161-15204-5-git-send-email-kraxel@redhat.com> (Gerd Hoffmann's message of "Thu, 25 Feb 2010 09:39:21 +0100") References: <1267087161-15204-1-git-send-email-kraxel@redhat.com> <1267087161-15204-5-git-send-email-kraxel@redhat.com> Date: Thu, 25 Feb 2010 12:03:12 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: [Qemu-devel] Re: [PATCH 4/4] kbd keds: vnc List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gerd Hoffmann Cc: qemu-devel@nongnu.org Gerd Hoffmann wrote: > Use led status notification support in vnc. > +static void kbd_leds(void *opaque, int ledstate) > +{ > + VncState *vs = opaque; > + int caps, num; > + > + caps = ledstate & QEMU_CAPS_LOCK_LED ? 1 : 0; > + num = ledstate & QEMU_NUM_LOCK_LED ? 1 : 0; I think it is clearer to use a bool. bool caps = ledstate & QEMU_CAPS_LOCK_LED; > + if (vs->modifiers_state[0x3a] != caps) { > + vs->modifiers_state[0x3a] = caps; modifiers_state type needs to go from uint8_t to bool. It simplifies lots of !!foo around. But the change is independent of this series. > + } > + if (vs->modifiers_state[0x45] != num) { > + vs->modifiers_state[0x45] = num; > + } > +} > + > static void do_key_event(VncState *vs, int down, int keycode, int sym) > { > /* QEMU console switch */ > @@ -1521,7 +1538,7 @@ static void do_key_event(VncState *vs, int down, int keycode, int sym) > break; > case 0x3a: /* CapsLock */ > case 0x45: /* NumLock */ > - if (!down) > + if (down) > vs->modifiers_state[keycode] ^= 1; > break; > } This needs a comment on the changelog why this is needed IMHO. Later, Juan.