diff --git a/src/OpenTK/Platform/SDL2/Sdl2.cs b/src/OpenTK/Platform/SDL2/Sdl2.cs index 5a77a8ff..130a3fd0 100644 --- a/src/OpenTK/Platform/SDL2/Sdl2.cs +++ b/src/OpenTK/Platform/SDL2/Sdl2.cs @@ -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); + /// /// Retrieves driver-dependent window information. /// diff --git a/src/OpenTK/Platform/SDL2/Sdl2Mouse.cs b/src/OpenTK/Platform/SDL2/Sdl2Mouse.cs index 894bb09a..23de55b2 100644 --- a/src/OpenTK/Platform/SDL2/Sdl2Mouse.cs +++ b/src/OpenTK/Platform/SDL2/Sdl2Mouse.cs @@ -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); } } }