From fa0abf0d511f44e3ad11353420f7f647d8cdb363 Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Thu, 28 Oct 2010 08:13:42 +0000 Subject: [PATCH] Minor fixes for code clarity. --- Source/OpenTK/Platform/Windows/WinRawMouse.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Source/OpenTK/Platform/Windows/WinRawMouse.cs b/Source/OpenTK/Platform/Windows/WinRawMouse.cs index 86ad4a33..ed614dfe 100644 --- a/Source/OpenTK/Platform/Windows/WinRawMouse.cs +++ b/Source/OpenTK/Platform/Windows/WinRawMouse.cs @@ -73,7 +73,7 @@ namespace OpenTK.Platform.Windows public MouseState GetState(int index) { - if (index < mice.Count) + if (mice.Count > index) return mice[index]; else return new MouseState(); @@ -192,10 +192,12 @@ namespace OpenTK.Platform.Windows ContextHandle handle = new ContextHandle(rin.Header.Device); MouseState mouse; - if (rawids.ContainsKey(handle)) - mouse = mice[rawids[handle]]; - else - return false; + if (!rawids.ContainsKey(handle)) + { + mice.Add(new MouseState()); + rawids.Add(handle, mice.Count - 1); + } + mouse = mice[rawids[handle]]; if ((raw.ButtonFlags & RawInputMouseState.LEFT_BUTTON_DOWN) != 0) mouse.EnableBit((int)MouseButton.Left); if ((raw.ButtonFlags & RawInputMouseState.LEFT_BUTTON_UP) != 0) mouse.DisableBit((int)MouseButton.Left);