Received: from eggs.gnu.org ([2001:4830:134:3::10]:59523) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aavTD-0000Hs-A7 for qemu-devel@nongnu.org; Tue, 01 Mar 2016 20:20:56 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aavT8-0004CR-87 for qemu-devel@nongnu.org; Tue, 01 Mar 2016 20:20:55 -0500 Received: from mail-ig0-x235.google.com ([2607:f8b0:4001:c05::235]:38196) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aavT7-0004C8-W4 for qemu-devel@nongnu.org; Tue, 01 Mar 2016 20:20:50 -0500 Received: by mail-ig0-x235.google.com with SMTP id y8so32004704igp.1 for ; Tue, 01 Mar 2016 17:20:49 -0800 (PST) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Programmingkid In-Reply-To: <56D632F7.7000500@redhat.com> Date: Tue, 1 Mar 2016 20:20:47 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: <5F294002-672A-4E4D-948F-39070F53F063@gmail.com> References: <6FDF78F9-D147-4239-9B8E-CAB1417369AA@gmail.com> <56D622BC.6090600@redhat.com> <296156E0-31D8-4612-B3B7-AB93093353D3@gmail.com> <56D632F7.7000500@redhat.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: Eric Blake Cc: Peter Maydell , qemu-devel qemu-devel On Mar 1, 2016, at 7:25 PM, Eric Blake wrote: > On 03/01/2016 05:12 PM, Programmingkid wrote: >=20 >>>=20 >>>> + >>>> + [MAC_KEY_ESC] =3D Q_KEY_CODE_ESC, >>>> + //[MAC_KEY_F1] =3D Q_KEY_CODE_POWER, // Just in case you need = the power key >>>> + [MAC_KEY_F1] =3D Q_KEY_CODE_F1, >>>=20 >>> The comment looks weird. Probably worth a mention in the commit = message >>> why you need it. >>=20 >> Maybe this: >>=20 >> [MAC_KEY_ESC] =3D Q_KEY_CODE_ESC, >> //[MAC_KEY_F1] =3D Q_KEY_CODE_POWER, // You might need this key if = you use Macsbug.=20 >> [MAC_KEY_F1] =3D Q_KEY_CODE_F1, >=20 > Not a code comment, but a commit message comment stating why you = aren't > providing a mapping for q_KEY_CODE_POWER. For that matter, I don't > think a code comment is useful, just nuke the entire line (the comment > doesn't add anything). >=20 >>=20 >>=20 >>>=20 >>>>=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); >>>=20 >>> Pre-existing, but we should fix this to avoid fprintf. >>=20 >> What do you mean by pre-existing? >=20 > You weren't the original cause of the bug, so it is not necessarily = this > patch's job to fix the bug. Therefore, "pre-existing". But since the > bug was observed during review of your patch, you may want to fix it > anyways, probably as a separate patch. So you want this: if (ARRAY_SIZE(macToQKeyCodeMap) <=3D keycode) { error_report("(cocoa) warning unknown keycode 0x%x\n", keycode);