From cce40d60b0cc778d3fb3596d7991a72ff5a1dbb0 Mon Sep 17 00:00:00 2001 From: David Jeske Date: Sat, 10 Aug 2013 19:41:50 -0700 Subject: [PATCH] fix MacOS bug mapping modifier keys to the scancode array --- .../OpenTK/Platform/MacOS/CarbonBindings/MacOSKeys.cs | 11 +++++++++++ Source/OpenTK/Platform/MacOS/CarbonGLNative.cs | 10 +++++----- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/Source/OpenTK/Platform/MacOS/CarbonBindings/MacOSKeys.cs b/Source/OpenTK/Platform/MacOS/CarbonBindings/MacOSKeys.cs index b7fab61b..cd7eaf96 100644 --- a/Source/OpenTK/Platform/MacOS/CarbonBindings/MacOSKeys.cs +++ b/Source/OpenTK/Platform/MacOS/CarbonBindings/MacOSKeys.cs @@ -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, diff --git a/Source/OpenTK/Platform/MacOS/CarbonGLNative.cs b/Source/OpenTK/Platform/MacOS/CarbonGLNative.cs index 1b59b727..a3fd3b7a 100644 --- a/Source/OpenTK/Platform/MacOS/CarbonGLNative.cs +++ b/Source/OpenTK/Platform/MacOS/CarbonGLNative.cs @@ -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); }