From 461fbce45fbc66e1f3952523aad883dedeaa21e8 Mon Sep 17 00:00:00 2001 From: thefiddler Date: Mon, 21 Jul 2014 16:39:58 +0200 Subject: [PATCH] Cleaned up a number of obsolete warnings --- Source/OpenTK/GameWindow.cs | 4 ++++ Source/OpenTK/Input/IInputDriver.cs | 1 + Source/OpenTK/Platform/Factory.cs | 1 + Source/OpenTK/Platform/IPlatformFactory.cs | 1 + Source/OpenTK/Platform/LegacyInputDriver.cs | 1 + Source/OpenTK/Platform/MacOS/CocoaNativeWindow.cs | 1 - Source/OpenTK/Platform/NativeWindowBase.cs | 5 +++++ Source/OpenTK/Platform/PlatformFactoryBase.cs | 1 + Source/OpenTK/Platform/Windows/WinGLNative.cs | 4 ++-- Source/OpenTK/Platform/X11/X11GLNative.cs | 4 +--- 10 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Source/OpenTK/GameWindow.cs b/Source/OpenTK/GameWindow.cs index 41029bc..f9a1562 100644 --- a/Source/OpenTK/GameWindow.cs +++ b/Source/OpenTK/GameWindow.cs @@ -78,8 +78,12 @@ namespace OpenTK const double MaxFrequency = 500.0; // Frequency cap for Update/RenderFrame events readonly Stopwatch watch = new Stopwatch(); + + #pragma warning disable 612,618 readonly IJoystickDriver LegacyJoystick = Factory.Default.CreateLegacyJoystickDriver(); + #pragma warning restore 612,618 + IGraphicsContext glContext; diff --git a/Source/OpenTK/Input/IInputDriver.cs b/Source/OpenTK/Input/IInputDriver.cs index 594c1b3..c5b320b 100644 --- a/Source/OpenTK/Input/IInputDriver.cs +++ b/Source/OpenTK/Input/IInputDriver.cs @@ -13,6 +13,7 @@ namespace OpenTK.Input /// /// Defines the interface for an input driver. /// + [Obsolete("This interface has been replaced by OpenTK.Input.Keyboard, Mouse, Joystick and GamePad.")] public interface IInputDriver : IKeyboardDriver, IMouseDriver, IJoystickDriver, IDisposable { /// diff --git a/Source/OpenTK/Platform/Factory.cs b/Source/OpenTK/Platform/Factory.cs index 2bcfada..031dcf8 100644 --- a/Source/OpenTK/Platform/Factory.cs +++ b/Source/OpenTK/Platform/Factory.cs @@ -152,6 +152,7 @@ namespace OpenTK.Platform return default_implementation.CreateJoystickDriver(); } + [Obsolete] public IJoystickDriver CreateLegacyJoystickDriver() { return default_implementation.CreateLegacyJoystickDriver(); diff --git a/Source/OpenTK/Platform/IPlatformFactory.cs b/Source/OpenTK/Platform/IPlatformFactory.cs index f9ec706..34effb7 100644 --- a/Source/OpenTK/Platform/IPlatformFactory.cs +++ b/Source/OpenTK/Platform/IPlatformFactory.cs @@ -53,6 +53,7 @@ namespace OpenTK.Platform Input.IJoystickDriver2 CreateJoystickDriver(); + [Obsolete] Input.IJoystickDriver CreateLegacyJoystickDriver(); } } diff --git a/Source/OpenTK/Platform/LegacyInputDriver.cs b/Source/OpenTK/Platform/LegacyInputDriver.cs index e2ee530..4d5bc4b 100644 --- a/Source/OpenTK/Platform/LegacyInputDriver.cs +++ b/Source/OpenTK/Platform/LegacyInputDriver.cs @@ -35,6 +35,7 @@ namespace OpenTK.Platform { // IInputDriver implementation to satisfy INativeWindow // while reducing code duplication. + [Obsolete] class LegacyInputDriver : IInputDriver { List dummy_keyboard_list = new List(1); diff --git a/Source/OpenTK/Platform/MacOS/CocoaNativeWindow.cs b/Source/OpenTK/Platform/MacOS/CocoaNativeWindow.cs index d187f1a..834e048 100644 --- a/Source/OpenTK/Platform/MacOS/CocoaNativeWindow.cs +++ b/Source/OpenTK/Platform/MacOS/CocoaNativeWindow.cs @@ -141,7 +141,6 @@ namespace OpenTK.Platform.MacOS private int normalLevel; private bool shouldClose; private int suppressResize; - private bool cursorInsideWindow = true; 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) diff --git a/Source/OpenTK/Platform/NativeWindowBase.cs b/Source/OpenTK/Platform/NativeWindowBase.cs index 90e53a8..a6ba2c2 100644 --- a/Source/OpenTK/Platform/NativeWindowBase.cs +++ b/Source/OpenTK/Platform/NativeWindowBase.cs @@ -38,7 +38,9 @@ namespace OpenTK.Platform // Common base class for all INativeWindow implementations abstract class NativeWindowBase : INativeWindow { + #pragma warning disable 612,618 readonly LegacyInputDriver LegacyInputDriver; + #pragma warning restore 612,618 readonly MouseButtonEventArgs MouseDownArgs = new MouseButtonEventArgs(); readonly MouseButtonEventArgs MouseUpArgs = new MouseButtonEventArgs(); @@ -58,7 +60,9 @@ namespace OpenTK.Platform internal NativeWindowBase() { + #pragma warning disable 612,618 LegacyInputDriver = new LegacyInputDriver(this); + #pragma warning restore 612,618 MouseState.SetIsConnected(true); KeyboardState.SetIsConnected(true); PreviousMouseState.SetIsConnected(true); @@ -445,6 +449,7 @@ namespace OpenTK.Platform public abstract Size ClientSize { get; set; } + [Obsolete] public virtual IInputDriver InputDriver { get diff --git a/Source/OpenTK/Platform/PlatformFactoryBase.cs b/Source/OpenTK/Platform/PlatformFactoryBase.cs index aa518e2..40dc0c1 100644 --- a/Source/OpenTK/Platform/PlatformFactoryBase.cs +++ b/Source/OpenTK/Platform/PlatformFactoryBase.cs @@ -74,6 +74,7 @@ namespace OpenTK.Platform public abstract IJoystickDriver2 CreateJoystickDriver(); + [Obsolete] public virtual IJoystickDriver CreateLegacyJoystickDriver() { return new LegacyJoystickDriver(); diff --git a/Source/OpenTK/Platform/Windows/WinGLNative.cs b/Source/OpenTK/Platform/Windows/WinGLNative.cs index fdcc14b..eb348c8 100644 --- a/Source/OpenTK/Platform/Windows/WinGLNative.cs +++ b/Source/OpenTK/Platform/Windows/WinGLNative.cs @@ -444,7 +444,7 @@ namespace OpenTK.Platform.Windows else { // 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); // Find the first move point we've already seen. @@ -867,7 +867,7 @@ namespace OpenTK.Platform.Windows wc.WndProc = WindowProcedureDelegate; wc.ClassName = ClassName; 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.Cursor = Functions.LoadCursor(CursorName.Arrow); ushort atom = Functions.RegisterClassEx(ref wc); diff --git a/Source/OpenTK/Platform/X11/X11GLNative.cs b/Source/OpenTK/Platform/X11/X11GLNative.cs index 2ee94bb..70bb62f 100644 --- a/Source/OpenTK/Platform/X11/X11GLNative.cs +++ b/Source/OpenTK/Platform/X11/X11GLNative.cs @@ -140,10 +140,8 @@ namespace OpenTK.Platform.X11 if (height <= 0) throw new ArgumentOutOfRangeException("height", "Must be higher than zero."); - XVisualInfo info = new XVisualInfo(); - Debug.Indent(); - + using (new XLock(window.Display)) { IntPtr visual; -- 2.7.4