Permalink
Browse files

[Mac] Remove call to NewEventHandlerUPP

NewEventHandlerUPP fails to load when running through MonoKickstart. It
appears that this function is only used for old PPC systems that had
trouble with function pointers - sample code online indicates that we
do not need to call this.
  • Loading branch information...
1 parent cf3a30d commit 88a60b14c5fbbe7b3efdd36e0c270c0dee69b9cf @thefiddler thefiddler committed Apr 4, 2014
Showing with 6 additions and 5 deletions.
  1. +6 −5 Source/OpenTK/Platform/MacOS/CarbonGLNative.cs
@@ -32,6 +32,7 @@
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
+using System.Runtime.InteropServices;
using System.Text;
using OpenTK.Graphics;
using OpenTK.Input;
@@ -179,7 +180,7 @@ void CreateNativeWindow(WindowClass @class, WindowAttributes attrib, Rect r)
{
Debug.Print("Creating window...");
Debug.Indent();
-
+
IntPtr windowRef = API.CreateNewWindow(@class, attrib, r);
API.SetWindowTitle(windowRef, title);
@@ -230,13 +231,13 @@ void ConnectEvents()
//new EventTypeSpec(EventClass.Keyboard, KeyboardEventKind.RawKeyUp),
//new EventTypeSpec(EventClass.Keyboard, KeyboardEventKind.RawKeyModifiersChanged),
};
-
+
MacOSEventHandler handler = EventHandler;
- uppHandler = API.NewEventHandlerUPP(handler);
-
+ uppHandler = Marshal.GetFunctionPointerForDelegate(handler);
+
API.InstallWindowEventHandler(window.Handle, uppHandler, eventTypes,
window.Handle, IntPtr.Zero);
-
+
Application.WindowEventHandler = this;
}

0 comments on commit 88a60b1

Please sign in to comment.