diff --git a/Source/Examples/OpenTK/Test/InputLogger.cs b/Source/Examples/OpenTK/Test/InputLogger.cs
index b6f49d13..3ef58210 100644
--- a/Source/Examples/OpenTK/Test/InputLogger.cs
+++ b/Source/Examples/OpenTK/Test/InputLogger.cs
@@ -188,7 +188,7 @@ namespace Examples.Tests
ControlLogMouseWheel ControlLogMouseWheelChanges =
delegate(GameWindow input_window, InputLogger control, object sender, MouseWheelEventArgs e)
{
- control.MouseWheelText.Text = e.Value.ToString();
+ control.MouseWheelText.Text = e.ValuePrecise.ToString("F2");
};
#endregion
diff --git a/Source/OpenTK/Input/MouseDevice.cs b/Source/OpenTK/Input/MouseDevice.cs
index aba9524e..fc7a2604 100644
--- a/Source/OpenTK/Input/MouseDevice.cs
+++ b/Source/OpenTK/Input/MouseDevice.cs
@@ -46,7 +46,7 @@ namespace OpenTK.Input
IntPtr id;
int numButtons, numWheels;
readonly bool[] button_state = new bool[Enum.GetValues(typeof(MouseButton)).Length];
- int wheel, last_wheel;
+ float wheel, last_wheel;
Point pos = new Point(), last_pos = new Point();
MouseMoveEventArgs move_args = new MouseMoveEventArgs();
MouseButtonEventArgs button_args = new MouseButtonEventArgs();
@@ -131,9 +131,19 @@ namespace OpenTK.Input
#region public int Wheel
///
- /// Gets an integer representing the absolute wheel position.
+ /// Gets the absolute wheel position in integer units.
+ /// To support high-precision mice, it is recommended to use instead.
///
public int Wheel
+ {
+ get { return (int)(wheel + 0.5f); }
+ internal set { WheelPrecise = value; }
+ }
+
+ ///
+ /// Gets the absolute wheel position in floating-point units.
+ ///
+ public float WheelPrecise
{
get { return wheel; }
internal set
@@ -142,11 +152,11 @@ namespace OpenTK.Input
wheel_args.X = pos.X;
wheel_args.Y = pos.Y;
- wheel_args.Value = wheel;
- wheel_args.Delta = wheel - last_wheel;
-
- WheelChanged(this, wheel_args );
-
+ wheel_args.ValuePrecise = wheel;
+ wheel_args.DeltaPrecise = wheel - last_wheel;
+
+ WheelChanged(this, wheel_args);
+
last_wheel = wheel;
}
}
@@ -296,8 +306,8 @@ namespace OpenTK.Input
{
get
{
- int result = wheel - wheel_last_accessed;
- wheel_last_accessed = wheel;
+ int result = (int)(wheel - wheel_last_accessed + 0.5f);
+ wheel_last_accessed = (int)wheel;
return result;
}
}
@@ -561,8 +571,8 @@ namespace OpenTK.Input
{
#region Fields
- int value;
- int delta;
+ float value;
+ float delta;
#endregion
@@ -601,14 +611,26 @@ namespace OpenTK.Input
#region Public Members
///
- /// Gets the value of the wheel.
+ /// Gets the value of the wheel in integer units.
+ /// To support high-precision mice, it is recommended to use instead.
///
- public int Value { get { return this.value; } internal set { this.value = value; } }
+ public int Value { get { return (int)(value + 0.5f); } }
///
- /// Gets the change in value of the wheel for this event.
+ /// Gets the change in value of the wheel for this event in integer units.
+ /// To support high-precision mice, it is recommended to use instead.
///
- public int Delta { get { return delta; } internal set { delta = value; } }
+ public int Delta { get { return (int)(delta + 0.5f); } }
+
+ ///
+ /// Gets the precise value of the wheel in floating-point units.
+ ///
+ public float ValuePrecise { get { return value; } internal set { this.value = value; } }
+
+ ///
+ /// Gets the precise change in value of the wheel for this event in floating-point units.
+ ///
+ public float DeltaPrecise { get { return delta; } internal set { delta = value; } }
#endregion
}
diff --git a/Source/OpenTK/Platform/Windows/WinGLNative.cs b/Source/OpenTK/Platform/Windows/WinGLNative.cs
index 812809ba..ed0ba013 100644
--- a/Source/OpenTK/Platform/Windows/WinGLNative.cs
+++ b/Source/OpenTK/Platform/Windows/WinGLNative.cs
@@ -316,7 +316,7 @@ namespace OpenTK.Platform.Windows
case WindowMessage.MOUSEWHEEL:
// This is due to inconsistent behavior of the WParam value on 64bit arch, whese
// wparam = 0xffffffffff880000 or wparam = 0x00000000ff100000
- mouse.Wheel += (int)((long)wParam << 32 >> 48) / 120;
+ mouse.WheelPrecise += ((long)wParam << 32 >> 48) / 120.0f;
break;
case WindowMessage.LBUTTONDOWN: