Cleaned up a number of obsolete warnings

This commit is contained in:
thefiddler 2014-07-21 16:39:58 +02:00
parent 6d1149cccd
commit 461fbce45f
10 changed files with 17 additions and 6 deletions

View file

@ -78,8 +78,12 @@ namespace OpenTK
const double MaxFrequency = 500.0; // Frequency cap for Update/RenderFrame events const double MaxFrequency = 500.0; // Frequency cap for Update/RenderFrame events
readonly Stopwatch watch = new Stopwatch(); readonly Stopwatch watch = new Stopwatch();
#pragma warning disable 612,618
readonly IJoystickDriver LegacyJoystick = readonly IJoystickDriver LegacyJoystick =
Factory.Default.CreateLegacyJoystickDriver(); Factory.Default.CreateLegacyJoystickDriver();
#pragma warning restore 612,618
IGraphicsContext glContext; IGraphicsContext glContext;

View file

@ -13,6 +13,7 @@ namespace OpenTK.Input
/// <summary> /// <summary>
/// Defines the interface for an input driver. /// Defines the interface for an input driver.
/// </summary> /// </summary>
[Obsolete("This interface has been replaced by OpenTK.Input.Keyboard, Mouse, Joystick and GamePad.")]
public interface IInputDriver : IKeyboardDriver, IMouseDriver, IJoystickDriver, IDisposable public interface IInputDriver : IKeyboardDriver, IMouseDriver, IJoystickDriver, IDisposable
{ {
/// <summary> /// <summary>

View file

@ -152,6 +152,7 @@ namespace OpenTK.Platform
return default_implementation.CreateJoystickDriver(); return default_implementation.CreateJoystickDriver();
} }
[Obsolete]
public IJoystickDriver CreateLegacyJoystickDriver() public IJoystickDriver CreateLegacyJoystickDriver()
{ {
return default_implementation.CreateLegacyJoystickDriver(); return default_implementation.CreateLegacyJoystickDriver();

View file

@ -53,6 +53,7 @@ namespace OpenTK.Platform
Input.IJoystickDriver2 CreateJoystickDriver(); Input.IJoystickDriver2 CreateJoystickDriver();
[Obsolete]
Input.IJoystickDriver CreateLegacyJoystickDriver(); Input.IJoystickDriver CreateLegacyJoystickDriver();
} }
} }

View file

@ -35,6 +35,7 @@ namespace OpenTK.Platform
{ {
// IInputDriver implementation to satisfy INativeWindow // IInputDriver implementation to satisfy INativeWindow
// while reducing code duplication. // while reducing code duplication.
[Obsolete]
class LegacyInputDriver : IInputDriver class LegacyInputDriver : IInputDriver
{ {
List<KeyboardDevice> dummy_keyboard_list = new List<KeyboardDevice>(1); List<KeyboardDevice> dummy_keyboard_list = new List<KeyboardDevice>(1);

View file

@ -141,7 +141,6 @@ namespace OpenTK.Platform.MacOS
private int normalLevel; private int normalLevel;
private bool shouldClose; private bool shouldClose;
private int suppressResize; private int suppressResize;
private bool cursorInsideWindow = true;
private MouseCursor selectedCursor = MouseCursor.Default; // user-selected cursor private MouseCursor selectedCursor = MouseCursor.Default; // user-selected cursor
public CocoaNativeWindow(int x, int y, int width, int height, string title, GraphicsMode mode, GameWindowFlags options, DisplayDevice device) public CocoaNativeWindow(int x, int y, int width, int height, string title, GraphicsMode mode, GameWindowFlags options, DisplayDevice device)

View file

@ -38,7 +38,9 @@ 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; 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();
@ -58,7 +60,9 @@ namespace OpenTK.Platform
internal NativeWindowBase() internal NativeWindowBase()
{ {
#pragma warning disable 612,618
LegacyInputDriver = new LegacyInputDriver(this); 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);
@ -445,6 +449,7 @@ namespace OpenTK.Platform
public abstract Size ClientSize { get; set; } public abstract Size ClientSize { get; set; }
[Obsolete]
public virtual IInputDriver InputDriver public virtual IInputDriver InputDriver
{ {
get get

View file

@ -74,6 +74,7 @@ namespace OpenTK.Platform
public abstract IJoystickDriver2 CreateJoystickDriver(); public abstract IJoystickDriver2 CreateJoystickDriver();
[Obsolete]
public virtual IJoystickDriver CreateLegacyJoystickDriver() public virtual IJoystickDriver CreateLegacyJoystickDriver()
{ {
return new LegacyJoystickDriver(); return new LegacyJoystickDriver();

View file

@ -444,7 +444,7 @@ namespace OpenTK.Platform.Windows
else else
{ {
// Exclude the current position. // Exclude the current position.
Point currentScreenPosition = new Point(InputDriver.Mouse[0].X, InputDriver.Mouse[0].Y); Point currentScreenPosition = new Point(MouseState.X, MouseState.Y);
Functions.ClientToScreen(handle, ref currentScreenPosition); Functions.ClientToScreen(handle, ref currentScreenPosition);
// Find the first move point we've already seen. // Find the first move point we've already seen.
@ -867,7 +867,7 @@ namespace OpenTK.Platform.Windows
wc.WndProc = WindowProcedureDelegate; wc.WndProc = WindowProcedureDelegate;
wc.ClassName = ClassName; wc.ClassName = ClassName;
wc.Icon = Icon != null ? Icon.Handle : IntPtr.Zero; wc.Icon = Icon != null ? Icon.Handle : IntPtr.Zero;
#warning "This seems to resize one of the 'large' icons, rather than using a small icon directly (multi-icon files). Investigate!" // Todo: the following line appears to resize one of the 'large' icons, rather than using a small icon directly (multi-icon files). Investigate!
wc.IconSm = Icon != null ? new Icon(Icon, 16, 16).Handle : IntPtr.Zero; wc.IconSm = Icon != null ? new Icon(Icon, 16, 16).Handle : IntPtr.Zero;
wc.Cursor = Functions.LoadCursor(CursorName.Arrow); wc.Cursor = Functions.LoadCursor(CursorName.Arrow);
ushort atom = Functions.RegisterClassEx(ref wc); ushort atom = Functions.RegisterClassEx(ref wc);

View file

@ -140,10 +140,8 @@ namespace OpenTK.Platform.X11
if (height <= 0) if (height <= 0)
throw new ArgumentOutOfRangeException("height", "Must be higher than zero."); throw new ArgumentOutOfRangeException("height", "Must be higher than zero.");
XVisualInfo info = new XVisualInfo();
Debug.Indent(); Debug.Indent();
using (new XLock(window.Display)) using (new XLock(window.Display))
{ {
IntPtr visual; IntPtr visual;