Received: from eggs.gnu.org ([2001:4830:134:3::10]:51030) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ys1XM-0002ya-Gj for qemu-devel@nongnu.org; Tue, 12 May 2015 00:11:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ys1XH-0002Gd-HT for qemu-devel@nongnu.org; Tue, 12 May 2015 00:11:20 -0400 Received: from mail-qk0-x22d.google.com ([2607:f8b0:400d:c09::22d]:33775) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ys1XH-0002GZ-Bv for qemu-devel@nongnu.org; Tue, 12 May 2015 00:11:15 -0400 Received: by qkx62 with SMTP id 62so102092415qkx.0 for ; Mon, 11 May 2015 21:11:15 -0700 (PDT) Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Programmingkid In-Reply-To: Date: Tue, 12 May 2015 00:11:11 -0400 Content-Transfer-Encoding: quoted-printable Message-Id: References: <5C3348EC-EC8B-4453-8B78-A7BDAE9FD64F@gmail.com> Subject: Re: [Qemu-devel] [PATCH v2] Fixes key mapping so all keys work List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: qemu-devel qemu-devel On May 10, 2015, at 2:45 PM, Peter Maydell wrote: > On 15 January 2015 at 21:13, Programmingkid = wrote: >> Fixes keyboard mapping so right shift, right command, right option, = right control, keypad period, keypad '=3D', keypad enter, and F13 all = work. >>=20 >> Signed-off-by: John Arbuckle >>=20 >> --- >> Undid most changes to keyboard map in cocoa.m. >> Most changes made to keyboard map in adb.c. >> Since there is no keypad '=3D' key for the PC/AT or PC/XT layouts, I = had to invent my own number for it. It works for the Mac OS X guest. = Guest like Windows XP are not effected because they don't use the = Macintosh keyboard layout. >>=20 >> Signed-off-by: John Arbuckle >>=20 >> --- >> hw/input/adb.c | 8 ++++---- >> ui/cocoa.m | 4 ++-- >=20 > This is two conceptually separate fixes: > (1) better handle key input to the ADB keyboard > (2) output the right keycodes on the OSX cocoa UI > which should be in separate patches. >=20 > We should also be doing the support for keypad-=3D by converting both > the cocoa UI and the ADB keyboard device to the QKeyCode APIs, > which can cleanly handle these key without inventing fake PC > keycode numbers, as suggested by Gerd: > https://lists.gnu.org/archive/html/qemu-devel/2015-02/msg01322.html So what you want is to eliminate the ps/xt key mappings found in the = cocoa.m and use the QKeyCode API? I really didn't like how in the cocoa.m file, a key press is first = translated to a ps/xt key value, then translated to a Macintosh ADB = keycode.=20 Basically this:=20 Macintosh host key code =3D> PS/XT key code =3D> ADB key code I do admit I'm not fully sure how the new API is suppose to work.=20 For a Macintosh host and guest it probably should work like this: Macintosh host key code =3D> sent directly to guest OS For a Macintosh host and a PC guest, it probably should work like this: Macintosh host key code =3D> PS/2 key code (not PS/XT) For a PC host and a PC guest, it probably should work like this: PC host key code =3D> sent directly to guest OS For a PC host and a Macintosh guest, it might work like this: PC host key code (PS/2) =3D> ADB key code The above shouldn't be hard to do. Code would need to be added to the cocoa.m file to detect the currently used emulator.=20 Host key code =3D> QKeyCode =3D> guest key code=20 I would like to avoid this translation because it would be relatively = slow. It would be as inefficient as what we have now.=20 > My apologies for this review being so delayed; I'm now > trying to process my queue of OSX to-review patches. Five months is a long time, but it is way better than never.=