All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lei Li <lilei@linux.vnet.ibm.com>
To: Amos Kong <akong@redhat.com>
Cc: qemu-devel@nongnu.org, lcapitulino@redhat.com
Subject: Re: [Qemu-devel] [PATCH] ui/input.c: replace magic numbers with macros
Date: Thu, 16 May 2013 14:07:00 +0800	[thread overview]
Message-ID: <51947784.7050706@linux.vnet.ibm.com> (raw)
In-Reply-To: <1368681587-10206-1-git-send-email-akong@redhat.com>

On 05/16/2013 01:19 PM, Amos Kong wrote:
> It's clearer to use defined macros than magic numbers.
>
> Signed-off-by: Amos Kong <akong@redhat.com>
> ---
>   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;

Looks good to me.

Reviewed-by: Lei Li <lilei@linux.vnet.ibm.com>


-- 
Lei

  reply	other threads:[~2013-05-16  6:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-16  5:19 [Qemu-devel] [PATCH] ui/input.c: replace magic numbers with macros Amos Kong
2013-05-16  6:07 ` Lei Li [this message]
2013-05-23 13:55 ` Luiz Capitulino

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51947784.7050706@linux.vnet.ibm.com \
    --to=lilei@linux.vnet.ibm.com \
    --cc=akong@redhat.com \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.