From a2335092c918cfd268b622fa504bf907c86f44b1 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Sun, 4 May 2008 19:09:18 +0000 Subject: [PATCH] Added a work around for the "stuck cursor" issue, where the mouse cursor would stay at the resize state when entering the GameWindow. --- Source/OpenTK/Platform/Windows/WMInput.cs | 11 ++++++++++- Source/OpenTK/Platform/Windows/WinGLNative.cs | 2 ++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/Source/OpenTK/Platform/Windows/WMInput.cs b/Source/OpenTK/Platform/Windows/WMInput.cs index 2d9b1269..1628e9a8 100644 --- a/Source/OpenTK/Platform/Windows/WMInput.cs +++ b/Source/OpenTK/Platform/Windows/WMInput.cs @@ -59,15 +59,24 @@ namespace OpenTK.Platform.Windows #region protected override void WndProc(ref Message msg) + bool mouse_about_to_enter = false; protected override void WndProc(ref Message msg) { switch ((WindowMessage)msg.Msg) { // Mouse events: + case WindowMessage.NCMOUSEMOVE: + mouse_about_to_enter = true; // Used to simulate a mouse enter event. + break; + case WindowMessage.MOUSEMOVE: - //case WindowMessage.NCMOUSEMOVE: mouse.Position = new System.Drawing.Point(msg.LParam.ToInt32() & 0x0000FFFF, (int)(msg.LParam.ToInt32() & 0xFFFF0000) >> 16); + if (mouse_about_to_enter) + { + Cursor.Current = Cursors.Default; + mouse_about_to_enter = false; + } return; case WindowMessage.MOUSEWHEEL: diff --git a/Source/OpenTK/Platform/Windows/WinGLNative.cs b/Source/OpenTK/Platform/Windows/WinGLNative.cs index 60a9e57f..2b9dad1b 100644 --- a/Source/OpenTK/Platform/Windows/WinGLNative.cs +++ b/Source/OpenTK/Platform/Windows/WinGLNative.cs @@ -369,6 +369,8 @@ namespace OpenTK.Platform.Windows context = new GraphicsContext(mode, window); + Cursor.Current = Cursors.Default; + Debug.Unindent(); }