Removed obsolete legacy input driver.

This commit is contained in:
Jarl Gullberg 2017-06-20 15:52:16 +02:00
parent 094e79a570
commit 92141295cd
No known key found for this signature in database
GPG key ID: 750FF6F6BDA72D23
6 changed files with 35 additions and 226 deletions

View file

@ -594,38 +594,6 @@ namespace OpenTK
#endregion #endregion
#region Keyboard
#pragma warning disable 0612
/// <summary>
/// Gets the primary Keyboard device, or null if no Keyboard exists.
/// </summary>
public KeyboardDevice Keyboard
{
get { return InputDriver.Keyboard.Count > 0 ? InputDriver.Keyboard[0] : null; }
}
#pragma warning restore 0612
#endregion
#region Mouse
#pragma warning disable 0612
/// <summary>
/// Gets the primary Mouse device, or null if no Mouse exists.
/// </summary>
public MouseDevice Mouse
{
get { return InputDriver.Mouse.Count > 0 ? InputDriver.Mouse[0] : null; }
}
#pragma warning restore 0612
#endregion
#region --- GameWindow Timing --- #region --- GameWindow Timing ---
// TODO: Disabled because it is not reliable enough. Use vsync as a workaround. // TODO: Disabled because it is not reliable enough. Use vsync as a workaround.

View file

@ -128,12 +128,6 @@ namespace OpenTK
/// </summary> /// </summary>
Size ClientSize { get; set; } Size ClientSize { get; set; }
/// <summary>
/// This property is deprecated and should not be used.
/// </summary>
[Obsolete("Use OpenTK.Input.Mouse/Keyboard/Joystick/GamePad instead.")]
OpenTK.Input.IInputDriver InputDriver { get; }
/// <summary> /// <summary>
/// Gets or sets the <see cref="OpenTK.MouseCursor"/> for this window. /// Gets or sets the <see cref="OpenTK.MouseCursor"/> for this window.
/// </summary> /// </summary>

View file

@ -367,23 +367,6 @@ namespace OpenTK
#endregion #endregion
#region InputDriver
/// <summary>
/// This property is deprecated.
/// </summary>
[Obsolete]
public IInputDriver InputDriver
{
get
{
EnsureUndisposed();
return implementation.InputDriver;
}
}
#endregion
#region Location #region Location
/// <summary> /// <summary>

View file

@ -736,7 +736,6 @@
<Compile Include="Platform\MacOS\Cocoa\NSOpenGLPixelFormatAttribute.cs" /> <Compile Include="Platform\MacOS\Cocoa\NSOpenGLPixelFormatAttribute.cs" />
<Compile Include="Platform\MacOS\Cocoa\NSOpenGLProfile.cs" /> <Compile Include="Platform\MacOS\Cocoa\NSOpenGLProfile.cs" />
<Compile Include="Platform\MacOS\Cocoa\NSOpenGLContextParameter.cs" /> <Compile Include="Platform\MacOS\Cocoa\NSOpenGLContextParameter.cs" />
<Compile Include="Platform\LegacyInputDriver.cs" />
<Compile Include="Platform\MacOS\Cocoa\NSEventType.cs" /> <Compile Include="Platform\MacOS\Cocoa\NSEventType.cs" />
<Compile Include="Platform\MacOS\Cocoa\NSEventModifierMask.cs" /> <Compile Include="Platform\MacOS\Cocoa\NSEventModifierMask.cs" />
<Compile Include="Platform\MacOS\Cocoa\NSTrackingAreaOptions.cs" /> <Compile Include="Platform\MacOS\Cocoa\NSTrackingAreaOptions.cs" />

View file

@ -1,119 +0,0 @@
#region License
//
// LegacyInputDriver.cs
//
// Author:
// Stefanos A. <stapostol@gmail.com>
//
// Copyright (c) 2006-2014 Stefanos Apostolopoulos
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#endregion
using System;
using System.Collections.Generic;
using OpenTK.Input;
namespace OpenTK.Platform
{
// IInputDriver implementation to satisfy INativeWindow
// while reducing code duplication.
[Obsolete]
class LegacyInputDriver : IInputDriver
{
List<KeyboardDevice> dummy_keyboard_list = new List<KeyboardDevice>(1);
List<MouseDevice> dummy_mice_list = new List<MouseDevice>(1);
readonly LegacyJoystickDriver JoystickDriver = new LegacyJoystickDriver();
internal LegacyInputDriver(INativeWindow window)
{
if (window == null)
throw new ArgumentNullException();
var mouse = new MouseDevice();
mouse.Description = "Standard Mouse";
mouse.NumberOfButtons = 3;
mouse.NumberOfWheels = 1;
dummy_mice_list.Add(mouse);
var keyboard = new KeyboardDevice();
keyboard.Description = "Standard Keyboard";
keyboard.NumberOfKeys = 101;
keyboard.NumberOfLeds = 3;
keyboard.NumberOfFunctionKeys = 12;
dummy_keyboard_list.Add(keyboard);
// Hook mouse events
window.MouseDown += mouse.HandleMouseDown;
window.MouseUp += mouse.HandleMouseUp;
window.MouseMove += mouse.HandleMouseMove;
window.MouseWheel += mouse.HandleMouseWheel;
// Hook keyboard events
window.KeyDown += keyboard.HandleKeyDown;
window.KeyUp += keyboard.HandleKeyUp;
}
#region IInputDriver Members
public void Poll()
{
}
#endregion
#region IKeyboardDriver Members
public IList<KeyboardDevice> Keyboard
{
get { return dummy_keyboard_list; }
}
#endregion
#region IMouseDriver Members
public IList<MouseDevice> Mouse
{
get { return dummy_mice_list; }
}
#endregion
#region IJoystickDriver Members
public IList<JoystickDevice> Joysticks
{
get { return JoystickDriver.Joysticks; }
}
#endregion
#region IDisposable Members
public void Dispose()
{
}
#endregion
}
}

View file

@ -40,10 +40,6 @@ namespace OpenTK.Platform
// Common base class for all INativeWindow implementations // Common base class for all INativeWindow implementations
abstract class NativeWindowBase : INativeWindow abstract class NativeWindowBase : INativeWindow
{ {
#pragma warning disable 612,618
readonly LegacyInputDriver LegacyInputDriver;
#pragma warning restore 612,618
readonly MouseButtonEventArgs MouseDownArgs = new MouseButtonEventArgs(); readonly MouseButtonEventArgs MouseDownArgs = new MouseButtonEventArgs();
readonly MouseButtonEventArgs MouseUpArgs = new MouseButtonEventArgs(); readonly MouseButtonEventArgs MouseUpArgs = new MouseButtonEventArgs();
readonly MouseMoveEventArgs MouseMoveArgs = new MouseMoveEventArgs(); readonly MouseMoveEventArgs MouseMoveArgs = new MouseMoveEventArgs();
@ -62,9 +58,6 @@ namespace OpenTK.Platform
internal NativeWindowBase() internal NativeWindowBase()
{ {
#pragma warning disable 612,618
LegacyInputDriver = new LegacyInputDriver(this);
#pragma warning restore 612,618
MouseState.SetIsConnected(true); MouseState.SetIsConnected(true);
KeyboardState.SetIsConnected(true); KeyboardState.SetIsConnected(true);
PreviousMouseState.SetIsConnected(true); PreviousMouseState.SetIsConnected(true);
@ -448,15 +441,6 @@ namespace OpenTK.Platform
public abstract Size ClientSize { get; set; } public abstract Size ClientSize { get; set; }
[Obsolete]
public virtual IInputDriver InputDriver
{
get
{
return LegacyInputDriver;
}
}
public abstract bool CursorVisible { get; set; } public abstract bool CursorVisible { get; set; }
public abstract MouseCursor Cursor { get; set; } public abstract MouseCursor Cursor { get; set; }