Merge pull request #19 from jeske/fix

fix MacOS bug mapping modifier keys to the scancode array
This commit is contained in:
Andy Korth 2013-08-11 20:45:11 -07:00
commit 7961997abe
2 changed files with 16 additions and 5 deletions

View file

@ -31,6 +31,9 @@ using System.Text;
namespace OpenTK.Platform.MacOS.Carbon namespace OpenTK.Platform.MacOS.Carbon
{ {
//
// http://web.archive.org/web/20100501161453/http://www.classicteck.com/rbarticles/mackeyboard.php
enum MacOSKeyCode enum MacOSKeyCode
{ {
A = 0, A = 0,
@ -90,6 +93,13 @@ namespace OpenTK.Platform.MacOS.Carbon
Backspace = 51, Backspace = 51,
Return = 52, Return = 52,
Esc = 53, Esc = 53,
Command = 55,
Shift = 56,
CapsLock = 57,
OptionAlt = 58,
Control = 59,
KeyPad_Decimal = 65, KeyPad_Decimal = 65,
KeyPad_Multiply = 67, KeyPad_Multiply = 67,
KeyPad_Add = 69, KeyPad_Add = 69,
@ -107,6 +117,7 @@ namespace OpenTK.Platform.MacOS.Carbon
KeyPad_7 = 89, KeyPad_7 = 89,
KeyPad_8 = 91, KeyPad_8 = 91,
KeyPad_9 = 92, KeyPad_9 = 92,
F1 = 122, F1 = 122,
F2 = 120, F2 = 120,
F3 = 99, F3 = 99,

View file

@ -617,19 +617,19 @@ namespace OpenTK.Platform.MacOS
Input.KeyboardDevice keyboard = InputDriver.Keyboard[0]; Input.KeyboardDevice keyboard = InputDriver.Keyboard[0];
if (keyboard[OpenTK.Input.Key.AltLeft] ^ option) if (keyboard[OpenTK.Input.Key.AltLeft] ^ option)
keyboard.SetKey(OpenTK.Input.Key.AltLeft, (uint)MacOSKeyModifiers.Option, option); keyboard.SetKey(OpenTK.Input.Key.AltLeft, (uint)MacOSKeyCode.OptionAlt, option);
if (keyboard[OpenTK.Input.Key.ShiftLeft] ^ shift) if (keyboard[OpenTK.Input.Key.ShiftLeft] ^ shift)
keyboard.SetKey(OpenTK.Input.Key.ShiftLeft, (uint)MacOSKeyModifiers.Shift, shift); keyboard.SetKey(OpenTK.Input.Key.ShiftLeft, (uint)MacOSKeyCode.Shift, shift);
if (keyboard[OpenTK.Input.Key.WinLeft] ^ command) if (keyboard[OpenTK.Input.Key.WinLeft] ^ command)
keyboard.SetKey(OpenTK.Input.Key.WinLeft, (uint)MacOSKeyModifiers.Command, command); keyboard.SetKey(OpenTK.Input.Key.WinLeft, (uint)MacOSKeyCode.Command, command);
if (keyboard[OpenTK.Input.Key.ControlLeft] ^ control) if (keyboard[OpenTK.Input.Key.ControlLeft] ^ control)
keyboard.SetKey(OpenTK.Input.Key.ControlLeft, (uint)MacOSKeyModifiers.Control, control); keyboard.SetKey(OpenTK.Input.Key.ControlLeft, (uint)MacOSKeyCode.Control, control);
if (keyboard[OpenTK.Input.Key.CapsLock] ^ caps) if (keyboard[OpenTK.Input.Key.CapsLock] ^ caps)
keyboard.SetKey(OpenTK.Input.Key.CapsLock, (uint)MacOSKeyModifiers.CapsLock, caps); keyboard.SetKey(OpenTK.Input.Key.CapsLock, (uint)MacOSKeyCode.CapsLock, caps);
} }