qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] ui/cocoa.m: Replace pc/xt keyboard keycode arra


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] ui/cocoa.m: Replace pc/xt keyboard keycode array with QKeyCode
Date: Tue, 1 Mar 2016 23:18:28 +0000

On 1 March 2016 at 22:12, Programmingkid <address@hidden> wrote:
> The old pc/xt keyboard keycode array is replaced with QEMU's own QKeyCode
> layout.
>
> Signed-off-by: John Arbuckle <address@hidden>
>
> ---
> Maintainer note:
> Please apply these patches before testing:
> - qapi-schema.json: Add kp_equals and power keys
> - adb.c: Replace pc_to_adb_keycode with more detailed array
> - MacKeys.h: initial commit

The correct way to do this is to send the patches as a single
patch series, which then will have them all in the right order,
together with 'cover letter' email which explains the series
and has all the patch mails as followups to it. Look at how
other people send out mails for multi-patch features.
(git format-patch and git send-email can do this for you.)

>
>  ui/cocoa.m |  300 
> ++++++++++++++++++++++++++----------------------------------
>  1 files changed, 128 insertions(+), 172 deletions(-)
>
> diff --git a/ui/cocoa.m b/ui/cocoa.m
> index 3ee5549..8ea39ad 100644
> --- a/ui/cocoa.m
> +++ b/ui/cocoa.m
> @@ -33,6 +33,7 @@
>  #include "sysemu/sysemu.h"
>  #include "qmp-commands.h"
>  #include "sysemu/blockdev.h"
> +#include "include/hw/input/MacKeys.h"

This should use the OSX header for the keycodes.

>  static int cocoa_keycode_to_qemu(int keycode)
>  {
> -    if (ARRAY_SIZE(keymap) <= keycode) {
> +    if (ARRAY_SIZE(macToQKeyCodeMap) <= keycode) {
>          fprintf(stderr, "(cocoa) warning unknown keycode 0x%x\n", keycode);
>          return 0;
>      }
> -    return keymap[keycode];
> +    return macToQKeyCodeMap[keycode];
>  }
>
>  /* Displays an alert dialog box with the specified message */
> @@ -564,14 +520,14 @@ QemuCocoaView *cocoaView;
>
>              if (keycode) {
>                  if (keycode == 58 || keycode == 69) { // emulate caps lock 
> and num lock keydown and keyup

Because cocoa_keycode_to_qemu() now returns a Q_KEY_* constant,
you need to change all the places like this that were checking
against hardcoded 58, 69, etc, to check against the correct
Q_KEY_* instead. (They're not the same numbers, so otherwise these
special cases will be broken.)

Otherwise this patch looks OK.

thanks
-- PMM



reply via email to

[Prev in Thread] Current Thread [Next in Thread]