Deleted now obsolete code.
authorJarl Gullberg <jarl.gullberg@gmail.com>
Tue, 13 Jun 2017 20:02:21 +0000 (22:02 +0200)
committerJarl Gullberg <jarl.gullberg@gmail.com>
Tue, 13 Jun 2017 20:02:21 +0000 (22:02 +0200)
src/OpenTK.GLWidget/GLWidget.cs

index b9480d7..a0f862f 100644 (file)
@@ -26,9 +26,6 @@
 #endregion
 
 using System;
-using System.Collections.Generic;
-using System.Runtime.InteropServices;
-using System.Security;
 using System.Threading;
 using System.ComponentModel;
 
@@ -328,264 +325,5 @@ namespace OpenTK
 
             OnInitialized();
         }
-
-        #region Windows Specific initalization
-
-        IWindowInfo InitializeWindows()
-        {
-#if GTK3
-            IntPtr windowHandle = gdk_win32_window_get_handle(Window.Handle);
-#else
-            IntPtr windowHandle = gdk_win32_drawable_get_handle(GdkWindow.Handle);
-#endif
-            return Utilities.CreateWindowsWindowInfo(windowHandle);
-        }
-
-#if GTK3
-        [SuppressUnmanagedCodeSecurity, DllImport("libgdk-3-0.dll", CallingConvention = CallingConvention.Cdecl)]
-        static extern IntPtr gdk_win32_window_get_handle(IntPtr w);
-#else
-        [SuppressUnmanagedCodeSecurity, DllImport("libgdk-win32-2.0-0.dll")]
-        static extern IntPtr gdk_win32_drawable_get_handle(IntPtr d);
-#endif
-        #endregion
-
-        #region OSX Specific Initialization
-
-        IWindowInfo InitializeOSX()
-        {
-            IntPtr windowHandle = gdk_quartz_window_get_nswindow(GdkWindow.Handle);
-            IntPtr viewHandle = gdk_quartz_window_get_nsview(GdkWindow.Handle);
-            return Utilities.CreateMacOSWindowInfo(windowHandle, viewHandle);
-        }
-
-#if GTK3
-        const string MacLibGdkName = "libgdk-3.dylib";
-#else
-        const string MacLibGdkName = "libgdk-quartz-2.0.0.dylib";
-#endif
-
-        [SuppressUnmanagedCodeSecurity, DllImport(MacLibGdkName)]
-        static extern IntPtr gdk_quartz_window_get_nswindow(IntPtr handle);
-
-        [SuppressUnmanagedCodeSecurity, DllImport(MacLibGdkName)]
-        static extern IntPtr gdk_quartz_window_get_nsview(IntPtr handle);
-
-        #endregion
-
-        #region X Specific Initialization
-
-#if GTK3
-        const string UnixLibGdkName = "libgdk-3.so.0";
-#else
-        const string UnixLibGdkName = "libgdk-x11-2.0.so.0";
-#endif
-        const string UnixLibX11Name = "libX11.so.6";
-        const string UnixLibGLName = "libGL.so.1";
-
-        const int GLX_NONE = 0;
-        const int GLX_USE_GL = 1;
-        const int GLX_BUFFER_SIZE = 2;
-        const int GLX_LEVEL = 3;
-        const int GLX_RGBA = 4;
-        const int GLX_DOUBLEBUFFER = 5;
-        const int GLX_STEREO = 6;
-        const int GLX_AUX_BUFFERS = 7;
-        const int GLX_RED_SIZE = 8;
-        const int GLX_GREEN_SIZE = 9;
-        const int GLX_BLUE_SIZE = 10;
-        const int GLX_ALPHA_SIZE = 11;
-        const int GLX_DEPTH_SIZE = 12;
-        const int GLX_STENCIL_SIZE = 13;
-        const int GLX_ACCUM_RED_SIZE = 14;
-        const int GLX_ACCUM_GREEN_SIZE = 15;
-        const int GLX_ACCUM_BLUE_SIZE = 16;
-        const int GLX_ACCUM_ALPHA_SIZE = 17;
-
-        public enum XVisualClass
-        {
-            StaticGray = 0,
-            GrayScale = 1,
-            StaticColor = 2,
-            PseudoColor = 3,
-            TrueColor = 4,
-            DirectColor = 5,
-        }
-
-        [StructLayout(LayoutKind.Sequential)]
-        struct XVisualInfo
-        {
-            public IntPtr Visual;
-            public IntPtr VisualID;
-            public int Screen;
-            public int Depth;
-            public XVisualClass Class;
-            public long RedMask;
-            public long GreenMask;
-            public long blueMask;
-            public int ColormapSize;
-            public int BitsPerRgb;
-
-            public override string ToString()
-            {
-                return String.Format("id ({0}), screen ({1}), depth ({2}), class ({3})",
-                    VisualID, Screen, Depth, Class);
-            }
-        }
-
-        [Flags]
-        internal enum XVisualInfoMask
-        {
-            No = 0x0,
-            ID = 0x1,
-            Screen = 0x2,
-            Depth = 0x4,
-            Class = 0x8,
-            Red = 0x10,
-            Green = 0x20,
-            Blue = 0x40,
-            ColormapSize = 0x80,
-            BitsPerRGB = 0x100,
-            All = 0x1FF,
-        }
-
-        IWindowInfo InitializeX(GraphicsMode mode)
-        {
-            IntPtr display = gdk_x11_display_get_xdisplay(Display.Handle);
-            int screen = Screen.Number;
-#if GTK3
-            IntPtr windowHandle = gdk_x11_window_get_xid(Window.Handle);
-            IntPtr rootWindow = gdk_x11_window_get_xid(RootWindow.Handle);
-#else
-            IntPtr windowHandle = gdk_x11_drawable_get_xid(GdkWindow.Handle);
-            IntPtr rootWindow = gdk_x11_drawable_get_xid(RootWindow.Handle);
-#endif
-            IWindowInfo retval;
-
-            IntPtr visualInfo;
-            if (mode.Index.HasValue)
-            {
-                XVisualInfo info = new XVisualInfo();
-                info.VisualID = mode.Index.Value;
-                int dummy;
-                visualInfo = XGetVisualInfo(display, XVisualInfoMask.ID, ref info, out dummy);
-            }
-            else
-                visualInfo = GetVisualInfo(display);
-
-            retval = Utilities.CreateX11WindowInfo(display, screen, windowHandle, rootWindow, visualInfo);
-            XFree(visualInfo);
-
-            return retval;
-        }
-
-        static IntPtr XGetVisualInfo(IntPtr display, XVisualInfoMask vinfo_mask, ref XVisualInfo template, out int nitems)
-        {
-            return XGetVisualInfoInternal(display, (IntPtr)(int)vinfo_mask, ref template, out nitems);
-        }
-
-        IntPtr GetVisualInfo(IntPtr display)
-        {
-            try
-            {
-                int[] attributes = AttributeList.ToArray();
-                return glXChooseVisual(display, Screen.Number, attributes);
-            }
-            catch (DllNotFoundException e)
-            {
-                throw new DllNotFoundException("OpenGL dll not found!", e);
-            }
-            catch (EntryPointNotFoundException enf)
-            {
-                throw new EntryPointNotFoundException("Glx entry point not found!", enf);
-            }
-        }
-
-        List<int> AttributeList
-        {
-            get
-            {
-                List<int> attributeList = new List<int>(24);
-
-                attributeList.Add(GLX_RGBA);
-
-                if (!SingleBuffer)
-                    attributeList.Add(GLX_DOUBLEBUFFER);
-
-                if (Stereo)
-                    attributeList.Add(GLX_STEREO);
-
-                attributeList.Add(GLX_RED_SIZE);
-                attributeList.Add(ColorBPP / 4); // TODO support 16-bit
-
-                attributeList.Add(GLX_GREEN_SIZE);
-                attributeList.Add(ColorBPP / 4); // TODO support 16-bit
-
-                attributeList.Add(GLX_BLUE_SIZE);
-                attributeList.Add(ColorBPP / 4); // TODO support 16-bit
-
-                attributeList.Add(GLX_ALPHA_SIZE);
-                attributeList.Add(ColorBPP / 4); // TODO support 16-bit
-
-                attributeList.Add(GLX_DEPTH_SIZE);
-                attributeList.Add(DepthBPP);
-
-                attributeList.Add(GLX_STENCIL_SIZE);
-                attributeList.Add(StencilBPP);
-
-                //attributeList.Add(GLX_AUX_BUFFERS);
-                //attributeList.Add(Buffers);
-
-                attributeList.Add(GLX_ACCUM_RED_SIZE);
-                attributeList.Add(AccumulatorBPP / 4);// TODO support 16-bit
-
-                attributeList.Add(GLX_ACCUM_GREEN_SIZE);
-                attributeList.Add(AccumulatorBPP / 4);// TODO support 16-bit
-
-                attributeList.Add(GLX_ACCUM_BLUE_SIZE);
-                attributeList.Add(AccumulatorBPP / 4);// TODO support 16-bit
-
-                attributeList.Add(GLX_ACCUM_ALPHA_SIZE);
-                attributeList.Add(AccumulatorBPP / 4);// TODO support 16-bit
-
-                attributeList.Add(GLX_NONE);
-
-                return attributeList;
-            }
-        }
-
-        [DllImport(UnixLibX11Name, EntryPoint = "XGetVisualInfo")]
-        static extern IntPtr XGetVisualInfoInternal(IntPtr display, IntPtr vinfo_mask, ref XVisualInfo template, out int nitems);
-
-        [SuppressUnmanagedCodeSecurity, DllImport(UnixLibX11Name)]
-        static extern void XFree(IntPtr handle);
-
-        /// <summary> Returns the X resource (window or pixmap) belonging to a GdkDrawable. </summary>
-        /// <remarks> XID gdk_x11_drawable_get_xid(GdkDrawable *drawable); </remarks>
-        /// <param name="gdkDisplay"> The GdkDrawable. </param>
-        /// <returns> The ID of drawable's X resource. </returns>
-        [SuppressUnmanagedCodeSecurity, DllImport(UnixLibGdkName)]
-        static extern IntPtr gdk_x11_drawable_get_xid(IntPtr gdkDisplay);
-
-        /// <summary> Returns the X resource (window or pixmap) belonging to a GdkDrawable. </summary>
-        /// <remarks> XID gdk_x11_drawable_get_xid(GdkDrawable *drawable); </remarks>
-        /// <param name="gdkDisplay"> The GdkDrawable. </param>
-        /// <returns> The ID of drawable's X resource. </returns>
-        [SuppressUnmanagedCodeSecurity, DllImport(UnixLibGdkName)]
-        static extern IntPtr gdk_x11_window_get_xid(IntPtr gdkDisplay);
-
-        /// <summary> Returns the X display of a GdkDisplay. </summary>
-        /// <remarks> Display* gdk_x11_display_get_xdisplay(GdkDisplay *display); </remarks>
-        /// <param name="gdkDisplay"> The GdkDrawable. </param>
-        /// <returns> The X Display of the GdkDisplay. </returns>
-        [SuppressUnmanagedCodeSecurity, DllImport(UnixLibGdkName)]
-        static extern IntPtr gdk_x11_display_get_xdisplay(IntPtr gdkDisplay);
-
-        [SuppressUnmanagedCodeSecurity, DllImport(UnixLibGLName)]
-        static extern IntPtr glXChooseVisual(IntPtr display, int screen, int[] attr);
-
-        #endregion
-
     }
-
-}
+}
\ No newline at end of file