Fixed compilation warnings on Mono 3.4.0
authorthefiddler <stapostol@gmail.com>
Mon, 21 Jul 2014 15:46:39 +0000 (17:46 +0200)
committerthefiddler <stapostol@gmail.com>
Mon, 21 Jul 2014 15:46:39 +0000 (17:46 +0200)
22 files changed:
Source/OpenTK/Graphics/ES20/Helper.cs
Source/OpenTK/Graphics/ES30/Helper.cs
Source/OpenTK/Graphics/GraphicsContext.cs
Source/OpenTK/Graphics/OpenGL/GLHelper.cs
Source/OpenTK/Graphics/OpenGL4/Helper.cs
Source/OpenTK/Input/MouseEventArgs.cs
Source/OpenTK/Math/Quaternion.cs
Source/OpenTK/Math/Quaterniond.cs
Source/OpenTK/Platform/MacOS/Cocoa/NSApplication.cs
Source/OpenTK/Platform/MacOS/HIDInput.cs
Source/OpenTK/Platform/SDL2/Sdl2.cs
Source/OpenTK/Platform/SDL2/Sdl2Keyboard.cs
Source/OpenTK/Platform/SDL2/Sdl2NativeWindow.cs
Source/OpenTK/Platform/Windows/WinDisplayDevice.cs
Source/OpenTK/Platform/Windows/WinGraphicsMode.cs
Source/OpenTK/Platform/Windows/WinMMJoystick.cs
Source/OpenTK/Platform/Windows/WinRawInput.cs
Source/OpenTK/Platform/X11/Bindings/Xkb.cs
Source/OpenTK/Platform/X11/Functions.cs
Source/OpenTK/Platform/X11/X11DisplayDevice.cs
Source/OpenTK/Platform/X11/X11GLNative.cs
Source/OpenTK/Platform/X11/X11GraphicsMode.cs

index 3f51e4b..cf0556b 100644 (file)
@@ -458,6 +458,8 @@ namespace OpenTK.Graphics.ES20
         #endregion
     }
 
+    #pragma warning disable 1574 // XML comment cref attribute could not be resolved, compiler bug in Mono 3.4.0
+
     /// <summary>
     /// Defines the signature of a debug callback for 
     /// <see cref="GL.DebugMessageCallback"/>.
@@ -491,4 +493,6 @@ namespace OpenTK.Graphics.ES20
         DebugSource source, DebugType type, int id,
         DebugSeverity severity, int length, IntPtr message,
         IntPtr userParam);
+
+    #pragma warning restore 1574 // XML comment cref attribute could not be resolved, compiler bug in Mono 3.4.0
 }
index 52fe33a..9a289b8 100644 (file)
@@ -449,6 +449,8 @@ namespace OpenTK.Graphics.ES30
         #endregion
     }
 
+    #pragma warning disable 1574 // XML comment cref attribute could not be resolved, compiler bug in Mono 3.4.0
+
     /// <summary>
     /// Defines the signature of a debug callback for 
     /// <see cref="GL.DebugMessageCallback"/>.
@@ -482,4 +484,6 @@ namespace OpenTK.Graphics.ES30
         DebugSource source, DebugType type, int id,
         DebugSeverity severity, int length, IntPtr message,
         IntPtr userParam);
+
+    #pragma warning restore 1574 // XML comment cref attribute could not be resolved, compiler bug in Mono 3.4.0
 }
index 348b795..1d6eb6b 100644 (file)
@@ -121,7 +121,7 @@ namespace OpenTK.Graphics
                     Debug.Print("GraphicsContextFlags: {0}", flags);
                     Debug.Print("Requested version: {0}.{1}", major, minor);
 
-                    IGraphicsContext shareContext = shareContext = FindSharedContext();
+                    IGraphicsContext shareContext = FindSharedContext();
                     
                     // Todo: Add a DummyFactory implementing IPlatformFactory.
                     if (designMode)
index 6d5bd87..db3815c 100644 (file)
@@ -1355,6 +1355,8 @@ namespace OpenTK.Graphics.OpenGL
         #endregion
     }
 
+    #pragma warning disable 1574 // XML comment cref attribute could not be resolved, compiler bug in Mono 3.4.0
+
     /// <summary>
     /// Defines the signature of a debug callback for 
     /// <see cref="GL.Amd.DebugMessageCallback"/>.
@@ -1420,4 +1422,6 @@ namespace OpenTK.Graphics.OpenGL
         DebugSource source, DebugType type, int id,
         DebugSeverity severity, int length, IntPtr message,
         IntPtr userParam);
+
+    #pragma warning restore 1574 // XML comment cref attribute could not be resolved, compiler bug in Mono 3.4.0
 }
index 55f23a3..bb2c254 100644 (file)
@@ -458,6 +458,8 @@ namespace OpenTK.Graphics.OpenGL4
         #endregion
     }
 
+    #pragma warning disable 1574 // XML comment cref attribute could not be resolved, compiler bug in Mono 3.4.0
+
     /// <summary>
     /// Defines the signature of a debug callback for 
     /// <see cref="GL.Arb.DebugMessageCallback"/>.
@@ -508,4 +510,6 @@ namespace OpenTK.Graphics.OpenGL4
         DebugSource source, DebugType type, int id,
         DebugSeverity severity, int length, IntPtr message,
         IntPtr userParam);
+
+    #pragma warning restore 1574 // XML comment cref attribute could not be resolved, compiler bug in Mono 3.4.0
 }
index f9c6feb..a5829e9 100644 (file)
@@ -231,7 +231,6 @@ namespace OpenTK.Input
         #region Fields
 
         MouseButton button;
-        bool pressed;
 
         #endregion
 
@@ -253,7 +252,6 @@ namespace OpenTK.Input
             : base(x, y)
         {
             this.button = button;
-            this.pressed = pressed;
         }
 
         /// <summary>
index 1334ea0..922a4f7 100644 (file)
@@ -73,6 +73,8 @@ namespace OpenTK
 
         #region Properties
 
+        #pragma warning disable 3005 // Identifier differing only in case is not CLS-compliant, compiler bug in Mono 3.4.0
+
         /// <summary>
         /// Gets or sets an OpenTK.Vector3 with the X, Y and Z components of this instance.
         /// </summary>
@@ -88,6 +90,8 @@ namespace OpenTK
         [CLSCompliant(false)]
         public Vector3 Xyz { get { return xyz; } set { xyz = value; } }
 
+        #pragma warning restore 3005
+
         /// <summary>
         /// Gets or sets the X component of this instance.
         /// </summary>
index 9806f69..792dddd 100644 (file)
@@ -73,6 +73,8 @@ namespace OpenTK
 
         #region Properties
 
+        #pragma warning disable 3005 // Identifier differing only in case is not CLS-compliant, compiler bug in Mono 3.4.0
+
         /// <summary>
         /// Gets or sets an OpenTK.Vector3d with the X, Y and Z components of this instance.
         /// </summary>
@@ -87,6 +89,8 @@ namespace OpenTK
         /// </summary>
         public Vector3d Xyz { get { return xyz; } set { xyz = value; } }
 
+        #pragma warning restore 3005
+
         /// <summary>
         /// Gets or sets the X component of this instance.
         /// </summary>
index 30e61ce..0670d43 100644 (file)
@@ -83,7 +83,7 @@ namespace OpenTK.Platform.MacOS
 
             // Disable momentum scrolling and long-press key pop-ups
             IntPtr settings = Cocoa.SendIntPtr(Class.NSDictionary, Selector.Alloc);
-            IntPtr momentum_scrolling = Cocoa.SendIntPtr(Class.NSNumber, Selector.Get("numberWithBool:"), false);
+            //IntPtr momentum_scrolling = Cocoa.SendIntPtr(Class.NSNumber, Selector.Get("numberWithBool:"), false);
             IntPtr press_and_hold = Cocoa.SendIntPtr(Class.NSNumber, Selector.Get("numberWithBool:"), false);
 
             // Initialize and register the settings dictionary
index 8f30304..5bde1be 100755 (executable)
@@ -561,7 +561,6 @@ namespace OpenTK.Platform.MacOS
                 for (int i = 0; i < element_array.Count; i++)
                 {
                     IOHIDElementRef element_ref = element_array[i];
-                    IOHIDElementType type = NativeMethods.IOHIDElementGetType(element_ref);
                     HIDPage page = NativeMethods.IOHIDElementGetUsagePage(element_ref);
                     int usage = NativeMethods.IOHIDElementGetUsage(element_ref);
 
index b1acdb7..2a9bba1 100644 (file)
@@ -31,6 +31,8 @@ using System.Diagnostics;
 using System.Security;
 using System.Runtime.InteropServices;
 
+#pragma warning disable 0169
+
 namespace OpenTK.Platform.SDL2
 {
     using Surface = IntPtr;
index bb84d4a..d5b05c1 100644 (file)
@@ -33,10 +33,9 @@ namespace OpenTK.Platform.SDL2
 {
     class Sdl2Keyboard : IKeyboardDriver2
     {
+        #pragma warning disable 649 // Field never assigned to, compiler bug in Mono 3.4.0
         KeyboardState state;
-
-        readonly List<KeyboardDevice> keyboards =
-            new List<KeyboardDevice>();
+        #pragma warning restore 649
 
         public Sdl2Keyboard()
         {
@@ -78,7 +77,6 @@ namespace OpenTK.Platform.SDL2
             bool pressed = e.State != 0;
             var scancode = e.Keysym.Scancode;
             Key key = Sdl2KeyMap.GetKey(scancode);
-            KeyModifiers mods = Sdl2KeyMap.GetModifiers(e.Keysym.Mod);
 
             if (key != Key.Unknown)
             {
index a49dea1..e024abd 100644 (file)
@@ -60,7 +60,6 @@ namespace OpenTK.Platform.SDL2
         Icon icon;
         MouseCursor cursor = MouseCursor.Default;
         IntPtr sdl_cursor = IntPtr.Zero;
-        string window_title;
 
         // Used in KeyPress event to decode SDL UTF8 text strings
         // to .Net UTF16 strings 
@@ -100,7 +99,6 @@ namespace OpenTK.Platform.SDL2
                 window = new Sdl2WindowInfo(handle, null);
                 window_id = SDL.GetWindowID(handle);
                 windows.Add(window_id, this);
-                window_title = title;
             }
         }
 
@@ -669,7 +667,6 @@ namespace OpenTK.Platform.SDL2
                     if (Exists)
                     {
                         SDL.SetWindowTitle(window.Handle, value);
-                        window_title = value;
                     }
                 }
             }
index 8ea67e0..ceb7cd4 100644 (file)
@@ -113,7 +113,7 @@ namespace OpenTK.Platform.Windows
                 int device_count = 0, mode_count = 0;
 
                 // Get available video adapters and enumerate all monitors
-                WindowsDisplayDevice dev1 = new WindowsDisplayDevice(), dev2 = new WindowsDisplayDevice();
+                WindowsDisplayDevice dev1 = new WindowsDisplayDevice();
                 while (Functions.EnumDisplayDevices(null, device_count++, dev1, 0))
                 {
                     if ((dev1.StateFlags & DisplayDeviceStateFlags.AttachedToDesktop) == DisplayDeviceStateFlags.None)
index 8550ddf..91ffd9a 100644 (file)
@@ -47,9 +47,7 @@ namespace OpenTK.Platform.Windows
             ICD,
         }
 
-        static readonly object SyncRoot = new object();
         readonly IntPtr Device;
-        readonly List<GraphicsMode> modes = new List<GraphicsMode>();
 
         #region Constructors
 
index b8bd79a..ff3e635 100644 (file)
@@ -43,7 +43,6 @@ namespace OpenTK.Platform.Windows
         readonly object sync = new object();
 
         List<JoystickDevice> sticks = new List<JoystickDevice>();
-        IList<JoystickDevice> sticks_readonly;
 
         // Matches a WinMM device index to a specific stick above
         readonly Dictionary<int, int> index_to_stick =
@@ -65,7 +64,6 @@ namespace OpenTK.Platform.Windows
 
         public WinMMJoystick()
         {
-            sticks_readonly = sticks.AsReadOnly();
             RefreshDevices();
         }
 
index 9f12099..0e99bc9 100644 (file)
@@ -39,7 +39,6 @@ namespace OpenTK.Platform.Windows
 
         // Input event data.
         static RawInput data = new RawInput();
-        static readonly int rawInputStructSize = API.RawInputSize;
 
         WinRawKeyboard keyboard_driver;
         WinRawMouse mouse_driver;
index 0be6971..74a3d83 100644 (file)
@@ -31,6 +31,8 @@ using System;
 using System.Diagnostics;
 using System.Runtime.InteropServices;
 
+#pragma warning disable 0169
+
 namespace OpenTK.Platform.X11
 {
     using Atom = IntPtr;
index b8e44ed..985e647 100644 (file)
@@ -575,7 +575,6 @@ namespace OpenTK.Platform.X11
         { 
             int width = image.Width;
             int height = image.Height;
-            int size = width * height; 
 
             BitmapData data = image.LockBits(new Rectangle(0, 0, width, height),
                 ImageLockMode.ReadOnly,
@@ -591,7 +590,7 @@ namespace OpenTK.Platform.X11
             
             XFreeGC(display, gc);
             image.UnlockBits(data);
-                                         
+
             return pixmap; 
         } 
         
index 7f9e1ea..3a794f1 100644 (file)
@@ -324,8 +324,6 @@ namespace OpenTK.Platform.X11
         {
             short rate = 0;
             IntPtr screen_config = Functions.XRRGetScreenInfo(API.DefaultDisplay, Functions.XRootWindow(API.DefaultDisplay, screen));
-            ushort rotation = 0;
-            int size = Functions.XRRConfigCurrentConfiguration(screen_config, out rotation);
             rate = Functions.XRRConfigCurrentRate(screen_config);
             Functions.XRRFreeScreenConfigInfo(screen_config);
             return (float)rate;
index 70bb62f..b10a5b5 100644 (file)
@@ -75,11 +75,13 @@ namespace OpenTK.Platform.X11
         IntPtr _atom_net_wm_state_fullscreen;
         IntPtr _atom_net_wm_state_maximized_horizontal;
         IntPtr _atom_net_wm_state_maximized_vertical;
-        
+
+        #pragma warning disable 414 // assigned but never used
         IntPtr _atom_net_wm_allowed_actions;
         IntPtr _atom_net_wm_action_resize;
         IntPtr _atom_net_wm_action_maximize_horizontally;
         IntPtr _atom_net_wm_action_maximize_vertically;
+        #pragma warning restore 414
 
         IntPtr _atom_net_wm_icon;
 
@@ -91,7 +93,9 @@ namespace OpenTK.Platform.X11
         static readonly IntPtr _atom_add = (IntPtr)1;
         static readonly IntPtr _atom_toggle = (IntPtr)2;
 
+        #pragma warning disable 649 // never assigned, compiler bug in Mono 3.4.0
         Rectangle bounds, client_rectangle;
+        #pragma warning restore 649
         int border_left, border_right, border_top, border_bottom;
         Icon icon;
         bool has_focus;
@@ -123,9 +127,11 @@ namespace OpenTK.Platform.X11
 
         readonly IntPtr EmptyCursor;
 
+        #pragma warning disable 414 // Field assigned but never used, we do that on purpose
         readonly bool xi2_supported;
         readonly int xi2_opcode;
         readonly int xi2_version;
+        #pragma warning restore 414
 
         #endregion
 
@@ -409,15 +415,7 @@ namespace OpenTK.Platform.X11
         bool IsWindowBorderHidden
         {
             get
-            {                
-                //IntPtr actual_atom;
-                //int actual_format;
-                //IntPtr nitems;
-                //IntPtr bytes_after;
-                IntPtr prop = IntPtr.Zero;
-                //IntPtr atom;
-                //XWindowAttributes attributes;
-
+            {
                 using (new XLock(window.Display))
                 {
                     // Test if decorations have been disabled through Motif.
index 9a76447..d82e616 100644 (file)
@@ -102,7 +102,6 @@ namespace OpenTK.Platform.X11
             Debug.Print("Selecting FB config for {0}", mode);
 
             List<int> visualAttributes = new List<int>();
-            IntPtr visual = IntPtr.Zero;
 
             if (mode.ColorFormat.BitsPerPixel > 0)
             {