diff --git a/Source/OpenTK/Input/Keyboard.cs b/Source/OpenTK/Input/Keyboard.cs
index 104a92fd..f2838c9f 100644
--- a/Source/OpenTK/Input/Keyboard.cs
+++ b/Source/OpenTK/Input/Keyboard.cs
@@ -40,28 +40,38 @@ namespace OpenTK.Input
static readonly IKeyboardDriver driver =
Platform.Factory.Default.CreateKeyboardDriver();
+ static readonly object SyncRoot = new object();
#endregion
#region Public Members
///
- /// Retrieves the KeyboardState for the default keyboard device.
+ /// Retrieves the combined for all keyboard devices.
///
- /// A structure containing the state of the keyboard device.
+ /// A structure containing the combined state for all keyboard devices.
public static KeyboardState GetState()
{
- return driver.GetState();
+ lock (SyncRoot)
+ {
+ return driver.GetState();
+ }
}
///
- /// Retrieves the KeyboardState for the specified keyboard device.
+ /// Retrieves the for the specified keyboard device.
///
/// The index of the keyboard device.
/// A structure containing the state of the keyboard device.
public static KeyboardState GetState(int index)
{
- return driver.GetState(index);
+ if (index < 0)
+ throw new ArgumentOutOfRangeException("index");
+
+ lock (SyncRoot)
+ {
+ return driver.GetState(index);
+ }
}
#endregion
diff --git a/Source/OpenTK/Input/Mouse.cs b/Source/OpenTK/Input/Mouse.cs
index e8239e97..0747339f 100644
--- a/Source/OpenTK/Input/Mouse.cs
+++ b/Source/OpenTK/Input/Mouse.cs
@@ -40,30 +40,38 @@ namespace OpenTK.Input
static readonly IMouseDriver driver =
Platform.Factory.Default.CreateMouseDriver();
+ static readonly object SyncRoot = new object();
#endregion
#region Public Members
///
- /// Retrieves the MouseState for the specified mouse device.
+ /// Retrieves the combined for all specified mouse devices.
///
- /// A structure containing the state of the mouse device.
+ /// A structure containing the combined state of all mouse devices.
public static MouseState GetState()
{
- return driver.GetState();
+ lock (SyncRoot)
+ {
+ return driver.GetState();
+ }
}
///
- /// Retrieves the MouseState for the specified mouse device.
+ /// Retrieves the for the specified mouse device.
///
/// The index of the mouse device.
- /// A structure containing the state of the mouse device.
+ /// A structure containing the state for the specified mouse device.
public static MouseState GetState(int index)
{
if (index < 0)
throw new ArgumentOutOfRangeException("index");
- return driver.GetState(index);
+
+ lock (SyncRoot)
+ {
+ return driver.GetState(index);
+ }
}
#endregion