Skip to content

Instantly share code, notes, and snippets.

@chamons
Created December 14, 2017 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chamons/5b36f57c40bb05cd612ff2e3d2e5df86 to your computer and use it in GitHub Desktop.
Save chamons/5b36f57c40bb05cd612ff2e3d2e5df86 to your computer and use it in GitHub Desktop.
public static class NSGestureRecognizerPatch
{
[DllImport ("/usr/lib/libobjc.dylib", EntryPoint = "objc_msgSend")]
public extern static CGPoint CGPoint_objc_msgSend_IntPtr (IntPtr receiver, IntPtr selector, IntPtr arg1);
static readonly IntPtr selLocationInView_Handle = ObjCRuntime.Selector.GetHandle ("locationInView:");
public static CGPoint GetLocationInView (this NSGestureRecognizer self, NSView view)
{
return CGPoint_objc_msgSend_IntPtr (self.Handle, selLocationInView_Handle, view == null ? IntPtr.Zero : view.Handle);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment