Merge pull request #594 from VPeruS/sdl-position

Fix cursor incorreclty moved out of window
This commit is contained in:
Jarl Gullberg 2017-07-25 00:36:01 +02:00 committed by GitHub
commit 541df66b1f
2 changed files with 5 additions and 1 deletions

View file

@ -490,6 +490,10 @@ namespace OpenTK.Platform.SDL2
[DllImport(lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_WarpMouseInWindow", ExactSpelling = true)]
public static extern void WarpMouseInWindow(IntPtr window, int x, int y);
[SuppressUnmanagedCodeSecurity]
[DllImport (lib, CallingConvention = CallingConvention.Cdecl, EntryPoint = "SDL_WarpMouseGlobal", ExactSpelling = true)]
public static extern void WarpMouseGlobal(int x, int y);
/// <summary>
/// Retrieves driver-dependent window information.
/// </summary>

View file

@ -146,7 +146,7 @@ namespace OpenTK.Platform.SDL2
public void SetPosition(double x, double y)
{
SDL.WarpMouseInWindow(IntPtr.Zero, (int)x, (int)y);
SDL.WarpMouseGlobal((int)x, (int)y);
}
}
}