From 8f5fc9cdd8ae6cd59de92f0c11e3bcf60a202946 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Sun, 5 Aug 2007 16:26:01 +0000 Subject: [PATCH] Corrected an invalid cast exception in X11Keyboard constructor. --- Source/OpenTK/Platform/X11/X11Keyboard.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Source/OpenTK/Platform/X11/X11Keyboard.cs b/Source/OpenTK/Platform/X11/X11Keyboard.cs index bdd9252b..514b98f9 100644 --- a/Source/OpenTK/Platform/X11/X11Keyboard.cs +++ b/Source/OpenTK/Platform/X11/X11Keyboard.cs @@ -107,17 +107,20 @@ namespace OpenTK.Platform.X11 IntPtr keysym_ptr = API.GetKeyboardMapping(window.Display, (byte)firstKeyCode, lastKeyCode - firstKeyCode + 1, ref keysyms_per_keycode); - keysyms = (IntPtr[])Marshal.PtrToStructure(keysym_ptr, typeof(IntPtr[])); + keysyms = new IntPtr[(lastKeyCode - firstKeyCode + 1) * keysyms_per_keycode]; + Marshal.PtrToStructure(keysym_ptr, keysyms); + //keysyms = (IntPtr[])Marshal.PtrToStructure(keysym_ptr, typeof(IntPtr[])); + API.Free(keysym_ptr); } #region internal bool ProcessKeyboardEvent(API.RawInput rin) /// - /// Processes raw input events. + /// Processes X11 KeyEvents. /// - /// - /// + /// The X11.KeyEvent to process + /// True if the event was processed, false otherwise. internal bool ProcessKeyboardEvent(X11.KeyEvent e) { return false;