diff --git a/Source/Examples/OpenTK.Examples.csproj b/Source/Examples/OpenTK.Examples.csproj
index b52793d5..39d041e4 100644
--- a/Source/Examples/OpenTK.Examples.csproj
+++ b/Source/Examples/OpenTK.Examples.csproj
@@ -44,16 +44,16 @@
true
- true
+ True
285212672
DEBUG;TRACE;
- true
+ True
4096
- false
+ False
..\..\Binaries\OpenTK\Debug\
False
False
@@ -62,7 +62,7 @@
full
- true
+ True
285212672
@@ -70,7 +70,7 @@
4096
- true
+ True
..\..\Binaries\OpenTK\Release\
False
False
@@ -82,11 +82,11 @@
..\..\Binaries\OpenTK\Release\
none
4
- true
+ True
TRACE;
- true
+ True
285212672
@@ -94,7 +94,7 @@
4096
- true
+ True
..\..\Binaries\OpenTK\Release\
False
False
@@ -103,7 +103,7 @@
none
- true
+ True
..\..\OpenTK.snk
@@ -111,23 +111,18 @@
System
- False
System.Data
- False
System.Drawing
- False
System.Windows.Forms
- False
System.Xml
- False
@@ -560,6 +555,9 @@
Always
+
+ Code
+
diff --git a/Source/Examples/OpenTK/Test/BasicMouseInput.cs b/Source/Examples/OpenTK/Test/BasicMouseInput.cs
index 4ab4f63f..3e997291 100644
--- a/Source/Examples/OpenTK/Test/BasicMouseInput.cs
+++ b/Source/Examples/OpenTK/Test/BasicMouseInput.cs
@@ -40,7 +40,12 @@ namespace Examples.Tests
{
// Here's the big test!
if(OpenTK.Input.Mouse.GetState()[MouseButton.Left]){
- Console.WriteLine("You clicked the left mouse button!");
+ Console.WriteLine("The left mouse button is down!");
+ }
+
+ // While we are here, test keyboard.
+ if(OpenTK.Input.Keyboard.GetState()[Key.A]){
+ Console.WriteLine("The A key is down!");
}
if (Keyboard[OpenTK.Input.Key.Escape])
diff --git a/Source/OpenTK/Platform/MacOS/HIDInput.cs b/Source/OpenTK/Platform/MacOS/HIDInput.cs
index 1a5759a7..a706aac5 100755
--- a/Source/OpenTK/Platform/MacOS/HIDInput.cs
+++ b/Source/OpenTK/Platform/MacOS/HIDInput.cs
@@ -124,7 +124,7 @@ namespace OpenTK.Platform.MacOS
{
if (!MouseDevices.ContainsKey(device))
{
- Debug.Print("Mouse device {0} discovered", device);
+ Debug.Print("Mouse device {0:x} discovered, sender is {1:x}", device, sender);
MouseState state = new MouseState();
state.IsConnected = true;
MouseIndexToDevice.Add(MouseDevices.Count, device);
@@ -132,7 +132,7 @@ namespace OpenTK.Platform.MacOS
}
else
{
- Debug.Print("Mouse device {0} reconnected", device);
+ Debug.Print("Mouse device {0:x} reconnected, sender is {1:x}", device, sender);
MouseState state = MouseDevices[device];
state.IsConnected = true;
MouseDevices[device] = state;
@@ -144,7 +144,7 @@ namespace OpenTK.Platform.MacOS
{
if (!KeyboardDevices.ContainsKey(device))
{
- Debug.Print("Keyboard device {0} discovered", device);
+ Debug.Print("Keyboard device {0:x} discovered, sender is {1:x}", device, sender);
KeyboardState state = new KeyboardState();
state.IsConnected = true;
KeyboardIndexToDevice.Add(KeyboardDevices.Count, device);
@@ -152,15 +152,18 @@ namespace OpenTK.Platform.MacOS
}
else
{
- Debug.Print("Keyboard device {0} reconnected", device);
+ Debug.Print("Keyboard device {0:x} reconnected, sender is {1:x}", device, sender);
KeyboardState state = KeyboardDevices[device];
state.IsConnected = true;
KeyboardDevices[device] = state;
}
}
+ // The device is not normally available in the InputValueCallback (HandleDeviceValueReceived), so we include
+ // the device identifier as the context variable, so we can identify it and figure out the device later.
+ // Thanks to Jase: http://www.opentk.com/node/2800
NativeMethods.IOHIDDeviceRegisterInputValueCallback(device,
- HandleDeviceValueReceived, IntPtr.Zero);
+ HandleDeviceValueReceived, device);
NativeMethods.IOHIDDeviceScheduleWithRunLoop(device, RunLoop, InputLoopMode);
}
}
@@ -170,7 +173,7 @@ namespace OpenTK.Platform.MacOS
if (NativeMethods.IOHIDDeviceConformsTo(device, HIDPage.GenericDesktop, (int)HIDUsageGD.Mouse) &&
MouseDevices.ContainsKey(device))
{
- Debug.Print("Mouse device {0} disconnected", device);
+ Debug.Print("Mouse device {0:x} disconnected, sender is {1:x}", device, sender);
// Keep the device in case it comes back later on
MouseState state = MouseDevices[device];
@@ -181,7 +184,7 @@ namespace OpenTK.Platform.MacOS
if (NativeMethods.IOHIDDeviceConformsTo(device, HIDPage.GenericDesktop, (int)HIDUsageGD.Keyboard) &&
KeyboardDevices.ContainsKey(device))
{
- Debug.Print("Keyboard device {0} disconnected", device);
+ Debug.Print("Keyboard device {0:x} disconnected, sender is {1:x}", device, sender);
// Keep the device in case it comes back later on
KeyboardState state = KeyboardDevices[device];
@@ -197,13 +200,15 @@ namespace OpenTK.Platform.MacOS
{
MouseState mouse;
KeyboardState keyboard;
- if (MouseDevices.TryGetValue(sender, out mouse))
+ if (MouseDevices.TryGetValue(context, out mouse))
{
- MouseDevices[sender] = UpdateMouse(mouse, val);
+ MouseDevices[context] = UpdateMouse(mouse, val);
}
- else if (KeyboardDevices.TryGetValue(sender, out keyboard))
+ else if (KeyboardDevices.TryGetValue(context, out keyboard))
{
- KeyboardDevices[sender] = UpdateKeyboard(keyboard, val);
+ KeyboardDevices[context] = UpdateKeyboard(keyboard, val);
+ }else{
+ //Debug.Print ("Device {0:x} not found in list of keyboards or mice", sender);
}
}