fix MacOS bug mapping modifier keys to the scancode array

This commit is contained in:
David Jeske 2013-08-10 19:41:50 -07:00
parent 2c29df6296
commit cce40d60b0
2 changed files with 16 additions and 5 deletions

View file

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

View file

@ -617,19 +617,19 @@ namespace OpenTK.Platform.MacOS
Input.KeyboardDevice keyboard = InputDriver.Keyboard[0];
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)
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)
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)
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)
keyboard.SetKey(OpenTK.Input.Key.CapsLock, (uint)MacOSKeyModifiers.CapsLock, caps);
keyboard.SetKey(OpenTK.Input.Key.CapsLock, (uint)MacOSKeyCode.CapsLock, caps);
}