mirror of
https://github.com/Ryujinx/Opentk.git
synced 2025-03-08 10:10:00 +00:00
Fix macos x64 wrong mouse input
This commit is contained in:
parent
f1fed27afd
commit
85541f6449
|
@ -160,7 +160,32 @@ namespace OpenTK.Platform.MacOS
|
|||
// Not the _stret version, perhaps because a NSPoint fits in one register?
|
||||
// thefiddler: gcc is indeed using objc_msgSend for NSPoint on i386
|
||||
[DllImport (LibObjC, EntryPoint="objc_msgSend")]
|
||||
public extern static NSPoint SendPoint(IntPtr receiver, IntPtr selector);
|
||||
public extern static NSPointF SendPointF(IntPtr receiver, IntPtr selector);
|
||||
[DllImport (LibObjC, EntryPoint="objc_msgSend")]
|
||||
public extern static NSPointD SendPointD(IntPtr receiver, IntPtr selector);
|
||||
|
||||
public static NSPoint SendPoint(IntPtr receiver, IntPtr selector)
|
||||
{
|
||||
NSPoint r = new NSPoint();
|
||||
|
||||
unsafe
|
||||
{
|
||||
if (IntPtr.Size == 4)
|
||||
{
|
||||
NSPointF pf = SendPointF(receiver, selector);
|
||||
r.X.Value = *(IntPtr *)&pf.x;
|
||||
r.Y.Value = *(IntPtr *)&pf.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
NSPointD pd = SendPointD(receiver, selector);
|
||||
r.X.Value = *(IntPtr *)&pd.x;
|
||||
r.Y.Value = *(IntPtr *)&pd.y;
|
||||
}
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
[DllImport (LibObjC, EntryPoint="objc_msgSend_stret")]
|
||||
extern static void SendRect(out NSRect retval, IntPtr receiver, IntPtr selector);
|
||||
|
|
|
@ -45,6 +45,18 @@ namespace OpenTK.Platform.MacOS
|
|||
{
|
||||
IntPtr value;
|
||||
|
||||
public IntPtr Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return value;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.value = value;
|
||||
}
|
||||
}
|
||||
|
||||
public static implicit operator NSFloat(float v)
|
||||
{
|
||||
NSFloat f;
|
||||
|
@ -179,5 +191,17 @@ namespace OpenTK.Platform.MacOS
|
|||
return new RectangleF(s.Location, s.Size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Using IntPtr in NSFloat cause that if imported function
|
||||
// return struct that consist of them you will get wrong data
|
||||
// This types are used for such function.
|
||||
public struct NSPointF
|
||||
{
|
||||
public float x, y;
|
||||
}
|
||||
|
||||
public struct NSPointD
|
||||
{
|
||||
public double x, y;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue