From 7582decf5552fefd0b592469bb99e20359f11d39 Mon Sep 17 00:00:00 2001 From: Stefanos A Date: Mon, 9 Dec 2013 23:46:07 +0100 Subject: [PATCH] Cache size of char BlittableValueType caches the size of the type parameter. This way, we avoid calling Marshal.SizeOf repeatedly for every keyboard event. --- Source/OpenTK/Platform/MacOS/CarbonBindings/CarbonAPI.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/OpenTK/Platform/MacOS/CarbonBindings/CarbonAPI.cs b/Source/OpenTK/Platform/MacOS/CarbonBindings/CarbonAPI.cs index be079f95..83c41a43 100644 --- a/Source/OpenTK/Platform/MacOS/CarbonBindings/CarbonAPI.cs +++ b/Source/OpenTK/Platform/MacOS/CarbonBindings/CarbonAPI.cs @@ -684,9 +684,9 @@ namespace OpenTK.Platform.MacOS.Carbon char* codeAddr = &code; OSStatus result = API.GetEventParameter(inEvent, - EventParamName.KeyMacCharCode, EventParamType.typeChar, IntPtr.Zero, - (uint)System.Runtime.InteropServices.Marshal.SizeOf(typeof(char)), IntPtr.Zero, - (IntPtr)codeAddr); + EventParamName.KeyMacCharCode, EventParamType.typeChar, IntPtr.Zero, + (uint)BlittableValueType.Stride, IntPtr.Zero, + (IntPtr)codeAddr); if (result != OSStatus.NoError) {