From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54908) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aauVB-0005bR-NL for qemu-devel@nongnu.org; Tue, 01 Mar 2016 19:18:54 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aauV8-0003tW-GM for qemu-devel@nongnu.org; Tue, 01 Mar 2016 19:18:53 -0500 Received: from mail-ig0-x22a.google.com ([2607:f8b0:4001:c05::22a]:33779) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aauV8-0003tH-9J for qemu-devel@nongnu.org; Tue, 01 Mar 2016 19:18:50 -0500 Received: by mail-ig0-x22a.google.com with SMTP id y8so33585452igp.0 for ; Tue, 01 Mar 2016 16:18:50 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Programmingkid In-Reply-To: Date: Tue, 1 Mar 2016 19:18:47 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: <3D07F69F-F34B-4A2F-90A8-9E26F8D7D82B@gmail.com> References: <6FDF78F9-D147-4239-9B8E-CAB1417369AA@gmail.com> Subject: Re: [Qemu-devel] [PATCH] ui/cocoa.m: Replace pc/xt keyboard keycode array with QKeyCode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel qemu-devel On Mar 1, 2016, at 6:18 PM, Peter Maydell wrote: > On 1 March 2016 at 22:12, Programmingkid = wrote: >> The old pc/xt keyboard keycode array is replaced with QEMU's own = QKeyCode >> layout. >>=20 >> Signed-off-by: John Arbuckle >>=20 >> --- >> 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 >=20 > 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.) Yes you are right. I will learn how to use git send-email. >=20 >>=20 >> ui/cocoa.m | 300 = ++++++++++++++++++++++++++---------------------------------- >> 1 files changed, 128 insertions(+), 172 deletions(-) >>=20 >> 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" >=20 > This should use the OSX header for the keycodes. If you really prefer I use Events.h and its keycodes, it shouldn't be a = problem. A quick Find & Replace should make the changes that are needed. >=20 >> static int cocoa_keycode_to_qemu(int keycode) >> { >> - if (ARRAY_SIZE(keymap) <=3D keycode) { >> + if (ARRAY_SIZE(macToQKeyCodeMap) <=3D keycode) { >> fprintf(stderr, "(cocoa) warning unknown keycode 0x%x\n", = keycode); >> return 0; >> } >> - return keymap[keycode]; >> + return macToQKeyCodeMap[keycode]; >> } >>=20 >> /* Displays an alert dialog box with the specified message */ >> @@ -564,14 +520,14 @@ QemuCocoaView *cocoaView; >>=20 >> if (keycode) { >> if (keycode =3D=3D 58 || keycode =3D=3D 69) { // = emulate caps lock and num lock keydown and keyup >=20 > 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.) Good idea.=