From patchwork Thu May 23 18:20:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 246011 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 9310A2C0296 for ; Fri, 24 May 2013 04:25:44 +1000 (EST) Received: from localhost ([::1]:39593 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UfaCs-0004I1-M5 for incoming@patchwork.ozlabs.org; Thu, 23 May 2013 14:25:42 -0400 Received: from eggs.gnu.org ([208.118.235.92]:49734) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ufa8D-0005JY-3h for qemu-devel@nongnu.org; Thu, 23 May 2013 14:21:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ufa85-0003WY-2P for qemu-devel@nongnu.org; Thu, 23 May 2013 14:20:52 -0400 Received: from mx1.redhat.com ([209.132.183.28]:15551) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ufa84-0003WT-Je for qemu-devel@nongnu.org; Thu, 23 May 2013 14:20:44 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r4NIKiaG030659 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 23 May 2013 14:20:44 -0400 Received: from localhost (ovpn-113-86.phx2.redhat.com [10.3.113.86]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r4NIKhuB027843; Thu, 23 May 2013 14:20:43 -0400 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Thu, 23 May 2013 14:20:31 -0400 Message-Id: <1369333232-24145-12-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1369333232-24145-1-git-send-email-lcapitulino@redhat.com> References: <1369333232-24145-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: aliguori@us.ibm.com Subject: [Qemu-devel] [PULL 11/12] ui/input.c: replace magic numbers with macros X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Amos Kong It's clearer to use defined macros than magic numbers. Signed-off-by: Amos Kong Reviewed-by: Lei Li Signed-off-by: Luiz Capitulino --- ui/input.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ui/input.c b/ui/input.c index 8ca1a03..92c44ca 100644 --- a/ui/input.c +++ b/ui/input.c @@ -28,6 +28,7 @@ #include "qapi/error.h" #include "qmp-commands.h" #include "qapi-types.h" +#include "ui/keymaps.h" struct QEMUPutMouseEntry { QEMUPutMouseEvent *qemu_put_mouse_event; @@ -260,10 +261,10 @@ static void free_keycodes(void) static void release_keys(void *opaque) { while (keycodes_size > 0) { - if (keycodes[--keycodes_size] & 0x80) { - kbd_put_keycode(0xe0); + if (keycodes[--keycodes_size] & SCANCODE_GREY) { + kbd_put_keycode(SCANCODE_EMUL0); } - kbd_put_keycode(keycodes[keycodes_size] | 0x80); + kbd_put_keycode(keycodes[keycodes_size] | SCANCODE_UP); } free_keycodes(); @@ -297,10 +298,10 @@ void qmp_send_key(KeyValueList *keys, bool has_hold_time, int64_t hold_time, return; } - if (keycode & 0x80) { - kbd_put_keycode(0xe0); + if (keycode & SCANCODE_GREY) { + kbd_put_keycode(SCANCODE_EMUL0); } - kbd_put_keycode(keycode & 0x7f); + kbd_put_keycode(keycode & SCANCODE_KEYCODEMASK); keycodes = g_realloc(keycodes, sizeof(int) * (keycodes_size + 1)); keycodes[keycodes_size++] = keycode;