qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] MacKeys.h: initial commit


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH] MacKeys.h: initial commit
Date: Tue, 1 Mar 2016 23:08:58 +0000

On 1 March 2016 at 22:07, Programmingkid <address@hidden> wrote:
> This patch adds the file MacKeys.h. It is a file that contains all the 
> constants
> for the Macintosh keyboard keycodes.
>
> Signed-off-by: John Arbuckle <address@hidden>
>
> ---
> Note to Peter Maydell:
> I know you wanted me to use the constants from the file HIToolbox/Events.h, 
> but
> I can't. It only exists on Mac OS X, so other operating systems like Linux
> would not be able to use it. This file is also used in the adb.c file, so
> cross-platform compatibility is a must.

What I suggested was that you should use the Events.h constants in
ui/cocoa.m (which is OSX only) and have a file in include/hw/input/
for the keys for the ADB keyboard emulation.

This patch should really be in a patch series with the patches that
use the new header.

>  include/hw/input/MacKeys.h |  139 
> ++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 139 insertions(+), 0 deletions(-)
>  create mode 100644 include/hw/input/MacKeys.h
>
> diff --git a/include/hw/input/MacKeys.h b/include/hw/input/MacKeys.h
> new file mode 100644
> index 0000000..7d00190
> --- /dev/null
> +++ b/include/hw/input/MacKeys.h
> @@ -0,0 +1,139 @@
> +/*
> + *  MacKeys.h
> + *
> + *  Provides a enum of all the Macintosh keycodes.
> + *  Note: keys like Power, volume related, and eject are handled at a lower
> + *        level and are not available to QEMU. That doesn't mean we can't
> + *        substitute one key for another. The function keys like F1 make a 
> good
> + *        substitute for these keys. This can be done in the GTK, SDL, or 
> Cocoa
> + *        code.
> + */

Can you include the standard copyright and license comment at the top,
please?

Header files need the usual #ifndef/#define/#endif wrappers to
guard against multiple inclusion.

> +
> +    /*
> +     * I didn't count the Power key as the largest value because it's very 
> large
> +     * value would cause arrays that depend on MAC_KEY_LARGEST_VALUE to be 
> too
> +     * big.
> +     */
> +    MAC_KEY_POWER = 32639,

The adb keyboard device appears to assume each keycode
is a byte, so how does this work? It looks like it's a two-byte
scancode, maybe. You probably want to handle that specially
somehow.

(Power is special anyway because as well as maybe being a
scancode it shorts the ADB pin 2 to ground, which is how a
powered-off mac actually gets woken up.)

> +/* Could not find the value for this key. */
> +/* #define MAC_KEY_EJECT */

thanks
-- PMM



reply via email to

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