On 14 January 2015 at 00:12, Programmingkid <programmingk...@gmail.com> wrote: > This patch allows for all the keys on an Apple extended keyboard to work in > QEMU. > > Signed-off-by: John Arbuckle <programmingk...@gmail.com> > > --- > ui/cocoa.m | 29 ++++++++++++++++++++--------- > 1 files changed, 20 insertions(+), 9 deletions(-) > > diff --git a/ui/cocoa.m b/ui/cocoa.m > index c8535a3..afac987 100644 > --- a/ui/cocoa.m > +++ b/ui/cocoa.m > @@ -128,18 +128,26 @@ int keymap[] = > 14, // 51 0x33 0x0e BKSP QZ_BACKSPACE > 0, // 52 0x34 Undefined > 1, // 53 0x35 0x01 ESC QZ_ESCAPE > - 220, // 54 0x36 0xdc E0,5C R GUI QZ_RMETA > - 219, // 55 0x37 0xdb E0,5B L GUI QZ_LMETA > + 219,// 54 0x36 QZ_RMETA > + 219,// 55 0x37 QZ_LMETA
This looks wrong: we shouldn't be mapping right meta and left meta to the same thing, they're different keys. > 42, // 56 0x38 0x2a L SHFT QZ_LSHIFT > 58, // 57 0x39 0x3a CAPS QZ_CAPSLOCK > 56, // 58 0x3A 0x38 L ALT QZ_LALT > 29, // 59 0x3B 0x1d L CTRL QZ_LCTRL > - 54, // 60 0x3C 0x36 R SHFT QZ_RSHIFT > - 184,// 61 0x3D 0xb8 E0,38 R ALT QZ_RALT > - 157,// 62 0x3E 0x9d E0,1D R CTRL QZ_RCTRL > + > + /* > + Map right shift, control, option, and command keys to left counterpart > + to improve compatibility with Mac OS. > + */ > + > + 42, // 60 0x3C 0x36 R SHFT QZ_RSHIFT > + 56, // 61 0x3D 0xb8 E0,38 R ALT QZ_RALT > + 29, // 62 0x3E 0x9d E0,1D R CTRL QZ_RCTRL Compatibility with Mac OS as a host or as a guest? These are different keys, and if we do this then we won't be able to work correctly with guests that really do treat them as different. > + > + > 0, // 63 0x3F Undefined > 0, // 64 0x40 Undefined > - 0, // 65 0x41 Undefined > + 0x53,// 65 0x41 Keypad . Can we be consistent with the other entries, please? SDLi entry in decimal, and appropriate items in the other columns including whatever the QZ_ constant is if we can find it. > 0, // 66 0x42 Undefined > 55, // 67 0x43 0x37 KP * QZ_KP_MULTIPLY > 0, // 68 0x44 Undefined > @@ -150,12 +158,12 @@ int keymap[] = > 0, // 73 0x49 Undefined > 0, // 74 0x4A Undefined > 181,// 75 0x4B 0xb5 E0,35 KP / QZ_KP_DIVIDE > - 152,// 76 0x4C 0x9c E0,1C KP EN QZ_KP_ENTER > + 0xe01c, //152,// 76 0x4C 0x9c E0,1C KP EN QZ_KP_ENTER Only entry in the entire table that's not a one-byte value? > 0, // 77 0x4D undefined > 74, // 78 0x4E 0x4a KP - QZ_KP_MINUS > 0, // 79 0x4F Undefined > 0, // 80 0x50 Undefined > - 0, // 81 0x51 QZ_KP_EQUALS > + 13, // 81 0x51 QZ_KP_EQUALS The keypad = key and the normal = key ought to have different values here. Otherwise the guest can't tell them apart. > 82, // 82 0x52 0x52 KP 0 QZ_KP0 > 79, // 83 0x53 0x4f KP 1 QZ_KP1 > 80, // 84 0x54 0x50 KP 2 QZ_KP2 > @@ -201,10 +209,13 @@ int keymap[] = > 205,// 124 0x7C 0xcd e0,4D R ARROW QZ_RIGHT > 208,// 125 0x7D 0xd0 E0,50 D ARROW QZ_DOWN > 200,// 126 0x7E 0xc8 E0,48 U ARROW QZ_UP > + > /* completed according to > http://www.libsdl.org/cgi/cvsweb.cgi/SDL12/src/video/quartz/SDL_QuartzKeys.h?rev=1.6&content-type=text/x-cvsweb-markup > */ > > -/* Additional 104 Key XP-Keyboard Scancodes from > http://www.computer-engineering.org/ps2keyboard/scancodes1.html */ > +/* Aditional 104 Key XP-Keyboard Scancodes from > http://www.computer-engineering.org/ps2keyboard/scancodes1.html */ This is reintroducing a typo that was fixed back in 2013 (in commit 49b9bd4dc). > /* > + 219 // 0xdb e0,5b L GUI > + 220 // 0xdc e0,5c R GUI > 221 // 0xdd e0,5d APPS > // E0,2A,E0,37 PRNT SCRN > // E1,1D,45,E1,9D,C5 PAUSE -- PMM