From 9ec00014eb924371653cce8c4003842e51194bf6 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Tue, 19 Oct 2010 09:25:09 +0000 Subject: [PATCH] Take into account the fact that ShowCursor(true/false) calls are cumulative (we want boolean behavior instead). --- Source/OpenTK/Platform/Windows/WinGLNative.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/Source/OpenTK/Platform/Windows/WinGLNative.cs b/Source/OpenTK/Platform/Windows/WinGLNative.cs index 2efd2c78..6c084f62 100644 --- a/Source/OpenTK/Platform/Windows/WinGLNative.cs +++ b/Source/OpenTK/Platform/Windows/WinGLNative.cs @@ -849,7 +849,11 @@ namespace OpenTK.Platform.Windows { if (value && cursor_visible_count < 0) { - cursor_visible_count = Functions.ShowCursor(true); + do + { + cursor_visible_count = Functions.ShowCursor(true); + } + while (cursor_visible_count < 0); if (!Functions.ClipCursor(IntPtr.Zero)) Debug.WriteLine(String.Format("Failed to grab cursor. Error: {0}", @@ -857,9 +861,13 @@ namespace OpenTK.Platform.Windows } else if (!value && cursor_visible_count >= 0) { - cursor_visible_count = Functions.ShowCursor(false); + do + { + cursor_visible_count = Functions.ShowCursor(false); + } + while (cursor_visible_count >= 0); - Win32Rectangle rect = Win32Rectangle.From(ClientRectangle); + Win32Rectangle rect = Win32Rectangle.From(Bounds); if (!Functions.ClipCursor(ref rect)) Debug.WriteLine(String.Format("Failed to grab cursor. Error: {0}", Marshal.GetLastWin32Error()));