From 55dfd7a3c9e2206716e8af5c83458d79861a723d Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Sun, 21 May 2017 01:36:51 +0200 Subject: [PATCH 01/45] Removed unneeded inheritance from IDisposable. --- src/OpenTK.GLWidget/GLWidget.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenTK.GLWidget/GLWidget.cs b/src/OpenTK.GLWidget/GLWidget.cs index 92274a30..90b11d44 100644 --- a/src/OpenTK.GLWidget/GLWidget.cs +++ b/src/OpenTK.GLWidget/GLWidget.cs @@ -41,7 +41,7 @@ using Gtk; namespace OpenTK { [ToolboxItem(true)] - public class GLWidget: DrawingArea, IDisposable + public class GLWidget: DrawingArea { #region Static attrs. From 80f8cdc63ff36e84dea5d6c61fb4509d0b1c6535 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Sun, 21 May 2017 01:45:12 +0200 Subject: [PATCH 02/45] Added preproccessor switching for Win32 GTK3. --- src/OpenTK.GLWidget/GLWidget.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/OpenTK.GLWidget/GLWidget.cs b/src/OpenTK.GLWidget/GLWidget.cs index 90b11d44..41c2b429 100644 --- a/src/OpenTK.GLWidget/GLWidget.cs +++ b/src/OpenTK.GLWidget/GLWidget.cs @@ -331,13 +331,21 @@ namespace OpenTK IWindowInfo InitializeWindows() { + #if GTK3 + IntPtr windowHandle = gdk_win32_window_get_handle(this.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)] + public static extern IntPtr gdk_win32_window_get_handle(IntPtr w); +#else [SuppressUnmanagedCodeSecurity, DllImport("libgdk-win32-2.0-0.dll")] public static extern IntPtr gdk_win32_drawable_get_handle(IntPtr d); - +#endif #endregion #region OSX Specific Initialization From a85dd49178583a3332fd6ea1cca44a96a01b1b6f Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Sun, 21 May 2017 01:48:00 +0200 Subject: [PATCH 03/45] Added preprocessor switching for Mac GTK3. --- src/OpenTK.GLWidget/GLWidget.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/OpenTK.GLWidget/GLWidget.cs b/src/OpenTK.GLWidget/GLWidget.cs index 41c2b429..ad374855 100644 --- a/src/OpenTK.GLWidget/GLWidget.cs +++ b/src/OpenTK.GLWidget/GLWidget.cs @@ -357,10 +357,16 @@ namespace OpenTK return Utilities.CreateMacOSWindowInfo(windowHandle, viewHandle); } - [SuppressUnmanagedCodeSecurity, DllImport("libgdk-quartz-2.0.0.dylib")] +#if GTK3 + const string MacLibGdkName = "libgtk-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("libgdk-quartz-2.0.0.dylib")] + [SuppressUnmanagedCodeSecurity, DllImport(MacLibGdkName)] static extern IntPtr gdk_quartz_window_get_nsview(IntPtr handle); #endregion From 66568d567e65ef6125a469400170d437b71bfc30 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Sun, 21 May 2017 02:30:50 +0200 Subject: [PATCH 04/45] Corrected style of this. qualifier. --- src/OpenTK.GLWidget/GLWidget.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenTK.GLWidget/GLWidget.cs b/src/OpenTK.GLWidget/GLWidget.cs index ad374855..d833198d 100644 --- a/src/OpenTK.GLWidget/GLWidget.cs +++ b/src/OpenTK.GLWidget/GLWidget.cs @@ -352,8 +352,8 @@ namespace OpenTK IWindowInfo InitializeOSX() { - IntPtr windowHandle = gdk_quartz_window_get_nswindow(this.GdkWindow.Handle); - IntPtr viewHandle = gdk_quartz_window_get_nsview(this.GdkWindow.Handle); + IntPtr windowHandle = gdk_quartz_window_get_nswindow(GdkWindow.Handle); + IntPtr viewHandle = gdk_quartz_window_get_nsview(GdkWindow.Handle); return Utilities.CreateMacOSWindowInfo(windowHandle, viewHandle); } From b95197e6ca4e024f51e3fe30f8cd6cde855e9ed5 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Sun, 21 May 2017 02:32:09 +0200 Subject: [PATCH 05/45] Tightened access restrictions to native functions. --- src/OpenTK.GLWidget/GLWidget.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenTK.GLWidget/GLWidget.cs b/src/OpenTK.GLWidget/GLWidget.cs index d833198d..f12091f3 100644 --- a/src/OpenTK.GLWidget/GLWidget.cs +++ b/src/OpenTK.GLWidget/GLWidget.cs @@ -341,10 +341,10 @@ namespace OpenTK #if GTK3 [SuppressUnmanagedCodeSecurity, DllImport("libgdk-3-0.dll", CallingConvention = CallingConvention.Cdecl)] - public static extern IntPtr gdk_win32_window_get_handle(IntPtr w); + static extern IntPtr gdk_win32_window_get_handle(IntPtr w); #else [SuppressUnmanagedCodeSecurity, DllImport("libgdk-win32-2.0-0.dll")] - public static extern IntPtr gdk_win32_drawable_get_handle(IntPtr d); + static extern IntPtr gdk_win32_drawable_get_handle(IntPtr d); #endif #endregion From a501a83acf7dfa7af329c1bd80cd8cc04422c7a1 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Sun, 21 May 2017 02:32:52 +0200 Subject: [PATCH 06/45] Removed unused using statement. --- src/OpenTK.GLWidget/GLWidget.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/OpenTK.GLWidget/GLWidget.cs b/src/OpenTK.GLWidget/GLWidget.cs index f12091f3..320f7d76 100644 --- a/src/OpenTK.GLWidget/GLWidget.cs +++ b/src/OpenTK.GLWidget/GLWidget.cs @@ -34,7 +34,6 @@ using System.ComponentModel; using OpenTK.Graphics; using OpenTK.Platform; -using OpenTK; using Gtk; From 7f04ea51343590c153b7a13f7c8ca0580d71822c Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Sun, 21 May 2017 22:27:24 +0200 Subject: [PATCH 07/45] Corrected indents. --- src/OpenTK.GLWidget/GLWidget.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OpenTK.GLWidget/GLWidget.cs b/src/OpenTK.GLWidget/GLWidget.cs index 320f7d76..c63eabc2 100644 --- a/src/OpenTK.GLWidget/GLWidget.cs +++ b/src/OpenTK.GLWidget/GLWidget.cs @@ -330,11 +330,11 @@ namespace OpenTK IWindowInfo InitializeWindows() { - #if GTK3 +#if GTK3 IntPtr windowHandle = gdk_win32_window_get_handle(this.Window.Handle); - #else +#else IntPtr windowHandle = gdk_win32_drawable_get_handle(GdkWindow.Handle); - #endif +#endif return Utilities.CreateWindowsWindowInfo(windowHandle); } From 5a5c85ab18dbfa0ae69c5aa0a1f4eac919f2107a Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Mon, 22 May 2017 13:19:43 +0200 Subject: [PATCH 08/45] Changed Mac library from libgtk to libgdk - both work, but it's the same as the others. --- src/OpenTK.GLWidget/GLWidget.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/OpenTK.GLWidget/GLWidget.cs b/src/OpenTK.GLWidget/GLWidget.cs index c63eabc2..0e717dc5 100644 --- a/src/OpenTK.GLWidget/GLWidget.cs +++ b/src/OpenTK.GLWidget/GLWidget.cs @@ -331,7 +331,7 @@ namespace OpenTK IWindowInfo InitializeWindows() { #if GTK3 - IntPtr windowHandle = gdk_win32_window_get_handle(this.Window.Handle); + IntPtr windowHandle = gdk_win32_window_get_handle(Window.Handle); #else IntPtr windowHandle = gdk_win32_drawable_get_handle(GdkWindow.Handle); #endif @@ -357,7 +357,7 @@ namespace OpenTK } #if GTK3 - const string MacLibGdkName = "libgtk-3.dylib"; + const string MacLibGdkName = "libgdk-3.dylib"; #else const string MacLibGdkName = "libgdk-quartz-2.0.0.dylib"; #endif @@ -451,7 +451,7 @@ namespace OpenTK IntPtr display = gdk_x11_display_get_xdisplay(Display.Handle); int screen = Screen.Number; #if GTK3 - IntPtr windowHandle = gdk_x11_window_get_xid(GdkWindow.Handle); + 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); From 07a37d2e92e7ff223d4bff4ecd26d446dd8102a0 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 19:51:14 +0200 Subject: [PATCH 09/45] Added constant switching between GTK#2 and GTK#3 references in the project file. --- src/OpenTK.GLWidget/OpenTK.GLWidget.csproj | 61 +++++++++++++++++----- 1 file changed, 48 insertions(+), 13 deletions(-) diff --git a/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj b/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj index 91e089ba..b4359702 100644 --- a/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj +++ b/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj @@ -1,5 +1,5 @@  - + Local 8.0.30703 @@ -41,13 +41,14 @@ true v4.5 + 7 True 285212672 - DEBUG;TRACE; + DEBUG;TRACE;GTK3; bin\Debug\OpenTK.GLWidget.xml True 4096 @@ -65,7 +66,7 @@ 285212672 - TRACE; + TRACE;GTK3; bin\Release\OpenTK.GLWidget.xml 4096 True @@ -81,19 +82,53 @@ True - ..\..\OpenTK.snk + $(SolutionDir)\OpenTK.snk System - - - - - - + + + + + $(SolutionDir)\packages\gtk-sharp3.3.22.0.0\lib\net40\atk-sharp.dll + + + $(SolutionDir)\packages\gtk-sharp3.3.22.0.0\lib\net40\cairo-sharp.dll + + + $(SolutionDir)\packages\gtk-sharp3.3.22.0.0\lib\net40\gdk-sharp.dll + + + $(SolutionDir)\packages\gtk-sharp3.3.22.0.0\lib\net40\gio-sharp.dll + + + $(SolutionDir)\packages\gtk-sharp3.3.22.0.0\lib\net40\glib-sharp.dll + + + $(SolutionDir)\packages\gtk-sharp3.3.22.0.0\lib\net40\gtk-dotnet.dll + + + $(SolutionDir)\packages\gtk-sharp3.3.22.0.0\lib\net40\gtk-sharp.dll + + + $(SolutionDir)\packages\gtk-sharp3.3.22.0.0\lib\net40\pango-sharp.dll + + + + + + + + + + + + + + OpenTK @@ -129,17 +164,17 @@ - ..\..\packages\GtkSharp\lib\net45\cairo-sharp.dll + $(SolutionDir)\packages\GtkSharp\lib\net45\cairo-sharp.dll True True - ..\..\packages\GtkSharp\lib\net45\gio-sharp.dll + $(SolutionDir)\packages\GtkSharp\lib\net45\gio-sharp.dll True True - + \ No newline at end of file From 7180293dbeadab1dae27f29679cd36a200cb16d0 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 19:51:52 +0200 Subject: [PATCH 10/45] Changed to a more recent GTK#3 NuGet package. --- paket.dependencies | 2 +- src/OpenTK.GLWidget/paket.references | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/paket.dependencies b/paket.dependencies index 04eab810..60e3514c 100644 --- a/paket.dependencies +++ b/paket.dependencies @@ -9,4 +9,4 @@ nuget xunit.runner.console nuget xunit.assert nuget FAKE nuget Mono.Cecil >= 0.10.0-beta1 -nuget GtkSharp +nuget gtk-sharp3 diff --git a/src/OpenTK.GLWidget/paket.references b/src/OpenTK.GLWidget/paket.references index 0a38793d..f1b428b5 100644 --- a/src/OpenTK.GLWidget/paket.references +++ b/src/OpenTK.GLWidget/paket.references @@ -1 +1 @@ -GtkSharp \ No newline at end of file +gtk-sharp3 From 4c059644bf45ae645cbd3a703c51e58c87ab2ec3 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 19:58:49 +0200 Subject: [PATCH 11/45] Updated with new reference to gtk-sharp3. --- paket.lock | 126 ++++++++++++++++++++++++++--------------------------- 1 file changed, 63 insertions(+), 63 deletions(-) diff --git a/paket.lock b/paket.lock index cf9d232f..785d4061 100644 --- a/paket.lock +++ b/paket.lock @@ -1,6 +1,6 @@ NUGET remote: https://www.nuget.org/api/v2 - FAKE (4.61.2) + FAKE (4.61.3) FsCheck (2.9) FSharp.Core (>= 4.1) - framework: >= net10, netstandard10, netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 FSharp.Core (>= 4.1.17) - framework: >= netstandard16 @@ -13,39 +13,39 @@ NUGET xunit.core (>= 2.2) - framework: >= netstandard16 xunit.extensibility.execution (>= 2.2 < 3.0) - framework: >= net10, netstandard10, netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 FSharp.Compiler.Service (2.0.0.6) - FSharp.Core (4.1.17) - framework: >= net10, >= netstandard10 - System.Collections (>= 4.0.11) - framework: >= netstandard16 - System.Console (>= 4.0) - framework: >= netstandard16 - System.Diagnostics.Debug (>= 4.0.11) - framework: >= netstandard16 - System.Diagnostics.Tools (>= 4.0.1) - framework: >= netstandard16 - System.Globalization (>= 4.0.11) - framework: >= netstandard16 - System.IO (>= 4.1) - framework: >= netstandard16 - System.Linq (>= 4.1) - framework: >= netstandard16 - System.Linq.Expressions (>= 4.1) - framework: >= netstandard16 - System.Linq.Queryable (>= 4.0.1) - framework: >= netstandard16 - System.Net.Requests (>= 4.0.11) - framework: >= netstandard16 - System.Reflection (>= 4.1) - framework: >= netstandard16 - System.Reflection.Extensions (>= 4.0.1) - framework: >= netstandard16 - System.Resources.ResourceManager (>= 4.0.1) - framework: >= netstandard16 - System.Runtime (>= 4.1) - framework: >= netstandard16 - System.Runtime.Extensions (>= 4.1) - framework: >= netstandard16 - System.Runtime.Numerics (>= 4.0.1) - framework: >= netstandard16 - System.Text.RegularExpressions (>= 4.1) - framework: >= netstandard16 - System.Threading (>= 4.0.11) - framework: >= netstandard16 - System.Threading.Tasks (>= 4.0.11) - framework: >= netstandard16 - System.Threading.Tasks.Parallel (>= 4.0.1) - framework: >= netstandard16 - System.Threading.Thread (>= 4.0) - framework: >= netstandard16 - System.Threading.ThreadPool (>= 4.0.10) - framework: >= netstandard16 - System.Threading.Timer (>= 4.0.1) - framework: >= netstandard16 + FSharp.Core (4.2.1) - framework: >= net10, >= netstandard10 + System.Collections (>= 4.0.11) - framework: >= net463, >= netstandard16 + System.Console (>= 4.0) - framework: >= net463, >= netstandard16 + System.Diagnostics.Debug (>= 4.0.11) - framework: >= net463, >= netstandard16 + System.Diagnostics.Tools (>= 4.0.1) - framework: >= net463, >= netstandard16 + System.Globalization (>= 4.0.11) - framework: >= net463, >= netstandard16 + System.IO (>= 4.1) - framework: >= net463, >= netstandard16 + System.Linq (>= 4.1) - framework: >= net463, >= netstandard16 + System.Linq.Expressions (>= 4.1) - framework: >= net463, >= netstandard16 + System.Linq.Queryable (>= 4.0.1) - framework: >= net463, >= netstandard16 + System.Net.Requests (>= 4.0.11) - framework: >= net463, >= netstandard16 + System.Reflection (>= 4.1) - framework: >= net463, >= netstandard16 + System.Reflection.Extensions (>= 4.0.1) - framework: >= net463, >= netstandard16 + System.Resources.ResourceManager (>= 4.0.1) - framework: >= net463, >= netstandard16 + System.Runtime (>= 4.1) - framework: >= net463, >= netstandard16 + System.Runtime.Extensions (>= 4.1) - framework: >= net463, >= netstandard16 + System.Runtime.Numerics (>= 4.0.1) - framework: >= net463, >= netstandard16 + System.Text.RegularExpressions (>= 4.1) - framework: >= net463, >= netstandard16 + System.Threading (>= 4.0.11) - framework: >= net463, >= netstandard16 + System.Threading.Tasks (>= 4.0.11) - framework: >= net463, >= netstandard16 + System.Threading.Tasks.Parallel (>= 4.0.1) - framework: >= net463, >= netstandard16 + System.Threading.Thread (>= 4.0) - framework: >= net463, >= netstandard16 + System.Threading.ThreadPool (>= 4.0.10) - framework: >= net463, >= netstandard16 + System.Threading.Timer (>= 4.0.1) - framework: >= net463, >= netstandard16 FSharp.Formatting (2.14.4) FSharp.Compiler.Service (2.0.0.6) FSharpVSPowerTools.Core (>= 2.3 < 2.4) FSharpVSPowerTools.Core (2.3) FSharp.Compiler.Service (>= 2.0.0.3) - GtkSharp (3.1.3) + gtk-sharp3 (3.22) Microsoft.NETCore.Platforms (1.1) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 Microsoft.NETCore.Targets (1.1) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 - Microsoft.Win32.Primitives (4.3) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + Microsoft.Win32.Primitives (4.3) - framework: >= net45, >= netstandard13, netstandard14, netstandard15 Microsoft.NETCore.Platforms (>= 1.1) - framework: >= netstandard13 Microsoft.NETCore.Targets (>= 1.1) - framework: >= netstandard13 System.Runtime (>= 4.3) - framework: >= netstandard13 @@ -103,21 +103,21 @@ NUGET System.Threading.Timer (>= 4.3) - framework: >= net451, >= netstandard12 System.Xml.ReaderWriter (>= 4.3) - framework: >= netstandard10 System.Xml.XDocument (>= 4.3) - framework: >= netstandard10 - runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 - runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 - runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 - runtime.native.System (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net45, >= netstandard13, netstandard14, netstandard15 + runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net45, >= netstandard13, netstandard14, netstandard15 + runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net45, >= netstandard13, netstandard14, netstandard15 + runtime.native.System (4.3) - framework: >= net45, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 Microsoft.NETCore.Platforms (>= 1.1) Microsoft.NETCore.Targets (>= 1.1) - runtime.native.System.IO.Compression (4.3) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + runtime.native.System.IO.Compression (4.3) - framework: >= net45, >= netstandard13, netstandard14, netstandard15 Microsoft.NETCore.Platforms (>= 1.1) Microsoft.NETCore.Targets (>= 1.1) - runtime.native.System.Net.Http (4.3) - framework: >= net10, >= netstandard16 + runtime.native.System.Net.Http (4.3) - framework: >= net45, >= netstandard16 Microsoft.NETCore.Platforms (>= 1.1) Microsoft.NETCore.Targets (>= 1.1) - runtime.native.System.Security.Cryptography.Apple (4.3) - framework: >= net10, >= netstandard16 + runtime.native.System.Security.Cryptography.Apple (4.3) - framework: >= net45, >= netstandard16 runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple (>= 4.3) - runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net45, >= netstandard13, netstandard14, netstandard15 runtime.debian.8-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1) runtime.fedora.23-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1) runtime.fedora.24-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1) @@ -128,17 +128,17 @@ NUGET runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1) runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1) runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3.1) - runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 - runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 - runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple (4.3) - framework: >= net10, >= netstandard16 - runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 - runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 - runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 - runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 - runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + runtime.opensuse.13.2-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net45, >= netstandard13, netstandard14, netstandard15 + runtime.opensuse.42.1-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net45, >= netstandard13, netstandard14, netstandard15 + runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.Apple (4.3) - framework: >= net45, >= netstandard16 + runtime.osx.10.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net45, >= netstandard13, netstandard14, netstandard15 + runtime.rhel.7-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net45, >= netstandard13, netstandard14, netstandard15 + runtime.ubuntu.14.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net45, >= netstandard13, netstandard14, netstandard15 + runtime.ubuntu.16.04-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net45, >= netstandard13, netstandard14, netstandard15 + runtime.ubuntu.16.10-x64.runtime.native.System.Security.Cryptography.OpenSsl (4.3.1) - framework: >= net45, >= netstandard13, netstandard14, netstandard15 System.AppContext (4.3) - framework: >= net46, >= netstandard13, netstandard14, netstandard15 System.Runtime (>= 4.3) - framework: dnxcore50, netstandard13, >= netstandard16 - System.Buffers (4.3) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + System.Buffers (4.3) - framework: >= net45, >= netstandard13, netstandard14, netstandard15 System.Diagnostics.Debug (>= 4.3) - framework: >= netstandard11 System.Diagnostics.Tracing (>= 4.3) - framework: >= netstandard11 System.Resources.ResourceManager (>= 4.3) - framework: >= netstandard11 @@ -148,7 +148,7 @@ NUGET Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, netstandard10, >= netstandard13 Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, netstandard10, >= netstandard13 System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard13 - System.Collections.Concurrent (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + System.Collections.Concurrent (4.3) - framework: >= net45, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 System.Collections (>= 4.3) - framework: dnxcore50, >= netstandard13 System.Diagnostics.Debug (>= 4.3) - framework: dnxcore50, >= netstandard13 System.Diagnostics.Tracing (>= 4.3) - framework: dnxcore50, >= netstandard13 @@ -159,7 +159,7 @@ NUGET System.Runtime.Extensions (>= 4.3) - framework: dnxcore50, >= netstandard13 System.Threading (>= 4.3) - framework: dnxcore50, >= netstandard13 System.Threading.Tasks (>= 4.3) - framework: dnxcore50, netstandard11, >= netstandard13 - System.Console (4.3) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + System.Console (4.3) - framework: >= net46, >= netstandard13, netstandard14, netstandard15 Microsoft.NETCore.Platforms (>= 1.1) - framework: >= netstandard13 Microsoft.NETCore.Targets (>= 1.1) - framework: >= netstandard13 System.IO (>= 4.3) - framework: >= netstandard13 @@ -169,7 +169,7 @@ NUGET Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, netstandard10, >= netstandard13 Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, netstandard10, >= netstandard13 System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard13 - System.Diagnostics.DiagnosticSource (4.3.1) - framework: >= net10, netstandard13, >= netstandard16 + System.Diagnostics.DiagnosticSource (4.3.1) - framework: >= net45, netstandard13, >= netstandard16 System.Collections (>= 4.3) - framework: netstandard11, >= netstandard13 System.Diagnostics.Tracing (>= 4.3) - framework: netstandard11, >= netstandard13 System.Reflection (>= 4.3) - framework: netstandard11, >= netstandard13 @@ -179,7 +179,7 @@ NUGET Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, >= netstandard10 Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, >= netstandard10 System.Runtime (>= 4.3) - framework: dnxcore50, >= netstandard10 - System.Diagnostics.Tracing (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + System.Diagnostics.Tracing (4.3) - framework: >= net45, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, netstandard11, netstandard12, netstandard13, >= netstandard15 Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, netstandard11, netstandard12, netstandard13, >= netstandard15 System.Runtime (>= 4.3) - framework: dnxcore50, netstandard11, netstandard12, netstandard13, >= netstandard15 @@ -192,7 +192,7 @@ NUGET Microsoft.NETCore.Targets (>= 1.1) - framework: >= netstandard13 System.Globalization (>= 4.3) - framework: >= netstandard13 System.Runtime (>= 4.3) - framework: >= netstandard13 - System.Globalization.Extensions (4.3) - framework: >= net10, >= netstandard16 + System.Globalization.Extensions (4.3) - framework: >= net45, >= netstandard16 Microsoft.NETCore.Platforms (>= 1.1) - framework: >= netstandard13 System.Globalization (>= 4.3) - framework: >= netstandard13 System.Resources.ResourceManager (>= 4.3) - framework: >= netstandard13 @@ -205,7 +205,7 @@ NUGET System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, netstandard13, >= netstandard15 System.Text.Encoding (>= 4.3) - framework: dnxcore50, netstandard10, netstandard13, >= netstandard15 System.Threading.Tasks (>= 4.3) - framework: dnxcore50, netstandard10, netstandard13, >= netstandard15 - System.IO.Compression (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + System.IO.Compression (4.3) - framework: >= net45, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 Microsoft.NETCore.Platforms (>= 1.1) - framework: >= netstandard13 runtime.native.System (>= 4.3) - framework: >= netstandard13 runtime.native.System.IO.Compression (>= 4.3) - framework: dnxcore50, >= netstandard13 @@ -266,7 +266,7 @@ NUGET System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, netstandard13, >= netstandard16 System.Runtime.Extensions (>= 4.3) - framework: dnxcore50, >= netstandard16 System.Threading (>= 4.3) - framework: dnxcore50, >= netstandard16 - System.Linq.Queryable (4.3) - framework: >= net10, >= netstandard16 + System.Linq.Queryable (4.3) - framework: >= net463, >= netstandard16 System.Collections (>= 4.3) - framework: dnxcore50, >= netstandard13 System.Diagnostics.Debug (>= 4.3) - framework: dnxcore50, >= netstandard13 System.Linq (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard13 @@ -275,7 +275,7 @@ NUGET System.Reflection.Extensions (>= 4.3) - framework: dnxcore50, >= netstandard13 System.Resources.ResourceManager (>= 4.3) - framework: dnxcore50, >= netstandard13 System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, >= netstandard13 - System.Net.Http (4.3.2) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + System.Net.Http (4.3.2) - framework: >= net45, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, netstandard13, >= netstandard16 Microsoft.Win32.Primitives (>= 4.3) - framework: netstandard13 runtime.native.System (>= 4.3) - framework: >= netstandard16 @@ -309,7 +309,7 @@ NUGET Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, netstandard10, netstandard11, >= netstandard13 System.Runtime (>= 4.3) - framework: dnxcore50, netstandard10, netstandard11, >= netstandard13 System.Runtime.Handles (>= 4.3) - framework: dnxcore50, >= netstandard13 - System.Net.Requests (4.3) - framework: >= net10, >= netstandard16 + System.Net.Requests (4.3) - framework: >= net463, >= netstandard16 Microsoft.NETCore.Platforms (>= 1.1) - framework: >= netstandard13 System.Collections (>= 4.3) - framework: dnxcore50, >= netstandard13 System.Diagnostics.Debug (>= 4.3) - framework: dnxcore50, >= netstandard13 @@ -330,7 +330,7 @@ NUGET System.Net.Primitives (>= 4.3) - framework: >= netstandard13 System.Runtime (>= 4.3) - framework: >= netstandard13 System.Threading.Tasks (>= 4.3) - framework: >= netstandard13 - System.Net.WebHeaderCollection (4.3) - framework: >= net10, >= netstandard16 + System.Net.WebHeaderCollection (4.3) - framework: >= net463, >= netstandard16 System.Collections (>= 4.3) - framework: >= netstandard13 System.Resources.ResourceManager (>= 4.3) - framework: >= netstandard13 System.Runtime (>= 4.3) - framework: >= netstandard13 @@ -406,12 +406,12 @@ NUGET System.Runtime (>= 4.3) - framework: dnxcore50, >= netstandard11 System.Runtime.InteropServices (>= 4.3) - framework: >= netstandard11 System.Threading (>= 4.3) - framework: dnxcore50, >= netstandard11 - System.Runtime.Numerics (4.3) - framework: >= net10, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 + System.Runtime.Numerics (4.3) - framework: >= net45, >= netstandard11, netstandard12, netstandard13, netstandard14, netstandard15 System.Globalization (>= 4.3) - framework: dnxcore50, >= netstandard13 System.Resources.ResourceManager (>= 4.3) - framework: dnxcore50, >= netstandard13 System.Runtime (>= 4.3) - framework: dnxcore50, netstandard11, >= netstandard13 System.Runtime.Extensions (>= 4.3) - framework: dnxcore50, >= netstandard13 - System.Security.Cryptography.Algorithms (4.3) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + System.Security.Cryptography.Algorithms (4.3) - framework: >= net45, >= netstandard13, netstandard14, netstandard15 Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, >= netstandard16 runtime.native.System.Security.Cryptography.Apple (>= 4.3) - framework: >= netstandard16 runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3) - framework: >= netstandard16 @@ -452,7 +452,7 @@ NUGET System.Security.Cryptography.Primitives (>= 4.3) - framework: >= net46, >= netstandard13 System.Text.Encoding (>= 4.3) - framework: >= netstandard13 System.Threading (>= 4.3) - framework: >= netstandard13 - System.Security.Cryptography.Encoding (4.3) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + System.Security.Cryptography.Encoding (4.3) - framework: >= net45, >= netstandard13, netstandard14, netstandard15 Microsoft.NETCore.Platforms (>= 1.1) - framework: >= netstandard13 runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3) - framework: >= netstandard13 System.Collections (>= 4.3) - framework: >= netstandard13 @@ -465,7 +465,7 @@ NUGET System.Runtime.InteropServices (>= 4.3) - framework: >= netstandard13 System.Security.Cryptography.Primitives (>= 4.3) - framework: >= netstandard13 System.Text.Encoding (>= 4.3) - framework: >= netstandard13 - System.Security.Cryptography.OpenSsl (4.3) - framework: >= net10, >= netstandard16 + System.Security.Cryptography.OpenSsl (4.3) - framework: >= net45, >= netstandard16 runtime.native.System.Security.Cryptography.OpenSsl (>= 4.3) - framework: >= net463, >= netstandard16, monoandroid, monotouch, xamarinios, xamarinmac System.Collections (>= 4.3) - framework: >= netstandard16 System.IO (>= 4.3) - framework: >= net463, >= netstandard16 @@ -479,7 +479,7 @@ NUGET System.Security.Cryptography.Encoding (>= 4.3) - framework: >= net463, >= netstandard16 System.Security.Cryptography.Primitives (>= 4.3) - framework: >= net463, >= netstandard16 System.Text.Encoding (>= 4.3) - framework: >= netstandard16 - System.Security.Cryptography.Primitives (4.3) - framework: >= net10, >= netstandard13, netstandard14, netstandard15 + System.Security.Cryptography.Primitives (4.3) - framework: >= net45, >= netstandard13, netstandard14, netstandard15 System.Diagnostics.Debug (>= 4.3) - framework: >= netstandard13 System.Globalization (>= 4.3) - framework: >= netstandard13 System.IO (>= 4.3) - framework: >= netstandard13 @@ -540,7 +540,7 @@ NUGET System.Collections (>= 4.3) - framework: >= netstandard10 System.Runtime (>= 4.3) - framework: >= netstandard10 System.Threading.Tasks (>= 4.3) - framework: >= netstandard10 - System.Threading.Tasks.Parallel (4.3) - framework: >= net10, >= netstandard16 + System.Threading.Tasks.Parallel (4.3) - framework: >= net463, >= netstandard16 System.Collections.Concurrent (>= 4.3) - framework: dnxcore50, netstandard11, >= netstandard13 System.Diagnostics.Debug (>= 4.3) - framework: dnxcore50, >= netstandard13 System.Diagnostics.Tracing (>= 4.3) - framework: dnxcore50, >= netstandard13 @@ -549,12 +549,12 @@ NUGET System.Runtime.Extensions (>= 4.3) - framework: dnxcore50, >= netstandard13 System.Threading (>= 4.3) - framework: dnxcore50, >= netstandard13 System.Threading.Tasks (>= 4.3) - framework: dnxcore50, netstandard11, >= netstandard13 - System.Threading.Thread (4.3) - framework: >= net10, >= netstandard16 + System.Threading.Thread (4.3) - framework: >= net463, >= netstandard16 System.Runtime (>= 4.3) - framework: >= netstandard13 - System.Threading.ThreadPool (4.3) - framework: >= net10, >= netstandard16 + System.Threading.ThreadPool (4.3) - framework: >= net463, >= netstandard16 System.Runtime (>= 4.3) - framework: >= netstandard13 System.Runtime.Handles (>= 4.3) - framework: >= netstandard13 - System.Threading.Timer (4.3) - framework: >= net10, >= netstandard12, netstandard13, netstandard14, netstandard15 + System.Threading.Timer (4.3) - framework: >= net451, >= netstandard12, netstandard13, netstandard14, netstandard15 Microsoft.NETCore.Platforms (>= 1.1) - framework: dnxcore50, >= netstandard12 Microsoft.NETCore.Targets (>= 1.1) - framework: dnxcore50, >= netstandard12 System.Runtime (>= 4.3) - framework: dnxcore50, >= netstandard12 From 1dab0a23cfebb1f7ea4d4dd285db2d14cbb4c844 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 19:59:04 +0200 Subject: [PATCH 12/45] Reenabled building of GLWidget project. --- build.fsx | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/build.fsx b/build.fsx index d6bec54e..639b13af 100644 --- a/build.fsx +++ b/build.fsx @@ -42,7 +42,7 @@ let tags = "OpenTK OpenGL OpenGLES GLES OpenAL C# F# VB .NET Mono Vector Math Ga let copyright = "Copyright (c) 2006 - 2016 Stefanos Apostolopoulos for the Open Toolkit library." -// File system information +// File system information let solutionFile = "OpenTK.sln" // Pattern specifying assemblies to be tested using NUnit @@ -50,7 +50,7 @@ let testAssemblies = "tests/**/bin/Release/*Tests*.dll" // Git configuration (used for publishing documentation in gh-pages branch) // The profile where the project is posted -let gitOwner = "opentk" +let gitOwner = "opentk" let gitHome = "https://github.com/" + gitOwner // The name of the project on GitHub @@ -70,7 +70,7 @@ let isXamarinPlatform = false //EnvironmentHelper.isMacOS || Environment.OSVersi // Helper active pattern for project types -let (|Fsproj|Csproj|Vbproj|) (projFileName:string) = +let (|Fsproj|Csproj|Vbproj|) (projFileName:string) = match projFileName with | f when f.EndsWith "fsproj" -> Fsproj | f when f.EndsWith "csproj" -> Csproj @@ -78,24 +78,23 @@ let (|Fsproj|Csproj|Vbproj|) (projFileName:string) = | _ -> failwith (sprintf "Project file %s not supported. Unknown project type." projFileName) -let activeProjects = - let xamarinFilter f = +let activeProjects = + let xamarinFilter f = if isXamarinPlatform then f else f -- "**/OpenTK.Android.csproj" -- "**/OpenTK.iOS.csproj" - + !! "src/**/*.??proj" ++ "tests/**/OpenTK.Tests.fsproj" - -- "**/OpenTK.GLWidget.csproj" |> xamarinFilter // Generate assembly info files with the right version & up-to-date information Target "AssemblyInfo" (fun _ -> let getAssemblyInfoAttributes (projectName:string) = - let projectName = + let projectName = if projectName.Contains(".iOS") || projectName.Contains(".Android") then projectName.Split('.').[0] else @@ -110,7 +109,7 @@ Target "AssemblyInfo" (fun _ -> let getProjectDetails projectPath = let projectName = System.IO.Path.GetFileNameWithoutExtension(projectPath) - ( projectPath, + ( projectPath, projectName, System.IO.Path.GetDirectoryName(projectPath), (getAssemblyInfoAttributes projectName) @@ -127,7 +126,7 @@ Target "AssemblyInfo" (fun _ -> ) // Copies binaries from default VS location to expected bin folder -// But keeps a subdirectory structure for each project in the +// But keeps a subdirectory structure for each project in the // src folder to support multiple project outputs Target "CopyBinaries" (fun _ -> activeProjects @@ -175,7 +174,7 @@ Target "NuGet" (fun _ -> "OpenTK.iOS" ] - Paket.Pack(fun p -> + Paket.Pack(fun p -> { p with OutputPath = "bin" ExcludedTemplates = "OpenTK.GLWidget" :: xamExcludes @@ -198,7 +197,7 @@ Target "All" DoNothing ==> "RunTests" ==> "All" -"All" +"All" ==> "NuGet" From 46dcea2a6160b5ead136cbb7fbac894b98ed8279 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 19:59:29 +0200 Subject: [PATCH 13/45] Fixed incorrect chooser. --- src/OpenTK.GLWidget/OpenTK.GLWidget.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj b/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj index b4359702..7147b321 100644 --- a/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj +++ b/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj @@ -82,7 +82,7 @@ True - $(SolutionDir)\OpenTK.snk + ..\..\OpenTK.snk From 0361cf9fcc5bd632dbeefe213bb02c293d8ba865 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 19:59:58 +0200 Subject: [PATCH 14/45] Updated FSharp.Core reference as a side effect. --- tests/OpenTK.Tests/OpenTK.Tests.fsproj | 40 ++------------------------ 1 file changed, 2 insertions(+), 38 deletions(-) diff --git a/tests/OpenTK.Tests/OpenTK.Tests.fsproj b/tests/OpenTK.Tests/OpenTK.Tests.fsproj index d269e1c3..37a2a330 100644 --- a/tests/OpenTK.Tests/OpenTK.Tests.fsproj +++ b/tests/OpenTK.Tests/OpenTK.Tests.fsproj @@ -147,24 +147,6 @@ - - - - ..\..\packages\FSharp.Core\lib\net20\FSharp.Core.dll - True - True - - - - - - - ..\..\packages\FSharp.Core\lib\net40\FSharp.Core.dll - True - True - - - @@ -183,24 +165,6 @@ - - - - ..\..\packages\FSharp.Core\lib\portable-net45+netcore45\FSharp.Core.dll - True - True - - - - - - - ..\..\packages\FSharp.Core\lib\portable-net45+netcore45+wp8\FSharp.Core.dll - True - True - - - @@ -1437,7 +1401,7 @@ - + ..\..\packages\System.Threading.Thread\lib\net46\System.Threading.Thread.dll @@ -1457,7 +1421,7 @@ - + ..\..\packages\System.Threading.ThreadPool\lib\net46\System.Threading.ThreadPool.dll From 1ea2975aab8aa7263c4654c17d5e4b3b953cf06d Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 20:12:09 +0200 Subject: [PATCH 15/45] Reverted use of SolutionDir. --- src/OpenTK.GLWidget/OpenTK.GLWidget.csproj | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj b/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj index 7147b321..3cdb4d19 100644 --- a/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj +++ b/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj @@ -93,28 +93,28 @@ - $(SolutionDir)\packages\gtk-sharp3.3.22.0.0\lib\net40\atk-sharp.dll + ..\..\packages\gtk-sharp3.3.22.0.0\lib\net40\atk-sharp.dll - $(SolutionDir)\packages\gtk-sharp3.3.22.0.0\lib\net40\cairo-sharp.dll + ..\..\packages\gtk-sharp3.3.22.0.0\lib\net40\cairo-sharp.dll - $(SolutionDir)\packages\gtk-sharp3.3.22.0.0\lib\net40\gdk-sharp.dll + ..\..\packages\gtk-sharp3.3.22.0.0\lib\net40\gdk-sharp.dll - $(SolutionDir)\packages\gtk-sharp3.3.22.0.0\lib\net40\gio-sharp.dll + ..\..\packages\gtk-sharp3.3.22.0.0\lib\net40\gio-sharp.dll - $(SolutionDir)\packages\gtk-sharp3.3.22.0.0\lib\net40\glib-sharp.dll + ..\..\packages\gtk-sharp3.3.22.0.0\lib\net40\glib-sharp.dll - $(SolutionDir)\packages\gtk-sharp3.3.22.0.0\lib\net40\gtk-dotnet.dll + ..\..\packages\gtk-sharp3.3.22.0.0\lib\net40\gtk-dotnet.dll - $(SolutionDir)\packages\gtk-sharp3.3.22.0.0\lib\net40\gtk-sharp.dll + ..\..\packages\gtk-sharp3.3.22.0.0\lib\net40\gtk-sharp.dll - $(SolutionDir)\packages\gtk-sharp3.3.22.0.0\lib\net40\pango-sharp.dll + ..\..\packages\gtk-sharp3.3.22.0.0\lib\net40\pango-sharp.dll @@ -164,17 +164,17 @@ - $(SolutionDir)\packages\GtkSharp\lib\net45\cairo-sharp.dll + ..\..\packages\GtkSharp\lib\net45\cairo-sharp.dll True True - $(SolutionDir)\packages\GtkSharp\lib\net45\gio-sharp.dll + ..\..\packages\GtkSharp\lib\net45\gio-sharp.dll True True - + \ No newline at end of file From d962586000f304b68c31edce9fecf6165f52b40a Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 20:22:08 +0200 Subject: [PATCH 16/45] Corrected use of versioned folder. --- src/OpenTK.GLWidget/OpenTK.GLWidget.csproj | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj b/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj index 3cdb4d19..bdf986a7 100644 --- a/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj +++ b/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj @@ -89,32 +89,32 @@ System - + - - ..\..\packages\gtk-sharp3.3.22.0.0\lib\net40\atk-sharp.dll + ..\..\packages\gtk-sharp3\lib\net40\atk-sharp.dll - ..\..\packages\gtk-sharp3.3.22.0.0\lib\net40\cairo-sharp.dll + ..\..\packages\gtk-sharp3\lib\net40\cairo-sharp.dll - ..\..\packages\gtk-sharp3.3.22.0.0\lib\net40\gdk-sharp.dll + ..\..\packages\gtk-sharp3\lib\net40\gdk-sharp.dll - ..\..\packages\gtk-sharp3.3.22.0.0\lib\net40\gio-sharp.dll + ..\..\packages\gtk-sharp3\lib\net40\gio-sharp.dll - ..\..\packages\gtk-sharp3.3.22.0.0\lib\net40\glib-sharp.dll + ..\..\packages\gtk-sharp3\lib\net40\glib-sharp.dll - ..\..\packages\gtk-sharp3.3.22.0.0\lib\net40\gtk-dotnet.dll + ..\..\packages\gtk-sharp3\lib\net40\gtk-dotnet.dll - ..\..\packages\gtk-sharp3.3.22.0.0\lib\net40\gtk-sharp.dll + ..\..\packages\gtk-sharp3\lib\net40\gtk-sharp.dll - ..\..\packages\gtk-sharp3.3.22.0.0\lib\net40\pango-sharp.dll + ..\..\packages\gtk-sharp3\lib\net40\pango-sharp.dll From fc954ef09b40c744302f24a88129c8c56c05e382 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 20:24:38 +0200 Subject: [PATCH 17/45] Removed invalid character. --- src/OpenTK.GLWidget/OpenTK.GLWidget.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj b/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj index bdf986a7..c3ac99c9 100644 --- a/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj +++ b/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj @@ -89,7 +89,7 @@ System - - + From 7f29705f0a19956f61f3d941d3d2ffedca05834c Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 20:43:44 +0200 Subject: [PATCH 18/45] Removed obsolete GtkSharp references. --- src/OpenTK.GLWidget/OpenTK.GLWidget.csproj | 30 ---------------------- 1 file changed, 30 deletions(-) diff --git a/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj b/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj index c3ac99c9..fa3ea640 100644 --- a/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj +++ b/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj @@ -147,34 +147,4 @@ - - - - <__paket__GtkSharp_targets>net45\GtkSharp - - - - - - - - - - - - - - ..\..\packages\GtkSharp\lib\net45\cairo-sharp.dll - True - True - - - ..\..\packages\GtkSharp\lib\net45\gio-sharp.dll - True - True - - - - - \ No newline at end of file From 2dc4c1b12ac6d7cc2e62dcf1e7f10749a3ac7b29 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 21:42:16 +0200 Subject: [PATCH 19/45] Dropped to C# 6.0 to maintain support for AppVeyor. --- src/OpenTK.GLWidget/OpenTK.GLWidget.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj b/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj index fa3ea640..5ed427a5 100644 --- a/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj +++ b/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj @@ -41,7 +41,7 @@ true v4.5 - 7 + 6 True From e05f34377b217944e1ebd097d234373d369c1f54 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 22:00:41 +0200 Subject: [PATCH 20/45] Broke out window info initialization into their own classes. --- .../OSX/OSXWindowInfoInitializer.cs | 57 ++++++ .../Win/WinWindowsInfoInitializer.cs | 61 ++++++ src/OpenTK.GLWidget/X11/GLXAttribute.cs | 54 +++++ src/OpenTK.GLWidget/X11/XVisualClass.cs | 39 ++++ src/OpenTK.GLWidget/X11/XVisualInfo.cs | 52 +++++ src/OpenTK.GLWidget/X11/XVisualInfoMask.cs | 47 +++++ .../X11/XWindowInfoInitializer.cs | 189 ++++++++++++++++++ 7 files changed, 499 insertions(+) create mode 100644 src/OpenTK.GLWidget/OSX/OSXWindowInfoInitializer.cs create mode 100644 src/OpenTK.GLWidget/Win/WinWindowsInfoInitializer.cs create mode 100644 src/OpenTK.GLWidget/X11/GLXAttribute.cs create mode 100644 src/OpenTK.GLWidget/X11/XVisualClass.cs create mode 100644 src/OpenTK.GLWidget/X11/XVisualInfo.cs create mode 100644 src/OpenTK.GLWidget/X11/XVisualInfoMask.cs create mode 100644 src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs diff --git a/src/OpenTK.GLWidget/OSX/OSXWindowInfoInitializer.cs b/src/OpenTK.GLWidget/OSX/OSXWindowInfoInitializer.cs new file mode 100644 index 00000000..fcf27bd7 --- /dev/null +++ b/src/OpenTK.GLWidget/OSX/OSXWindowInfoInitializer.cs @@ -0,0 +1,57 @@ +// +// OSXWindowsInfoInitializer.cs +// +// The Open Toolkit Library License +// +// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted. +// +// 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. +// + +using System; +using System.Runtime.InteropServices; +using System.Security; +using OpenTK.Platform; + +namespace OpenTK.OSX +{ + public static class OSXWindowInfoInitializer + { +#if GTK3 + const string OSXLibGdkName = "libgdk-3.dylib"; +#else + const string OSXLibGdkName = "libgdk-quartz-2.0.0.dylib"; +#endif + + public static IWindowInfo Initialize(IntPtr gdkWindowHandle) + { + IntPtr windowHandle = gdk_quartz_window_get_nswindow(gdkWindowHandle); + IntPtr viewHandle = gdk_quartz_window_get_nsview(gdkWindowHandle); + + return Utilities.CreateMacOSWindowInfo(windowHandle, viewHandle); + } + + [SuppressUnmanagedCodeSecurity, DllImport(OSXLibGdkName)] + private static extern IntPtr gdk_quartz_window_get_nswindow(IntPtr handle); + + [SuppressUnmanagedCodeSecurity, DllImport(OSXLibGdkName)] + private static extern IntPtr gdk_quartz_window_get_nsview(IntPtr handle); + } +} \ No newline at end of file diff --git a/src/OpenTK.GLWidget/Win/WinWindowsInfoInitializer.cs b/src/OpenTK.GLWidget/Win/WinWindowsInfoInitializer.cs new file mode 100644 index 00000000..d1da1cb3 --- /dev/null +++ b/src/OpenTK.GLWidget/Win/WinWindowsInfoInitializer.cs @@ -0,0 +1,61 @@ +// +// WinWindowsInfoInitializer.cs +// +// The Open Toolkit Library License +// +// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted. +// +// 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. +// + +using System; +using System.Runtime.InteropServices; +using System.Security; +using OpenTK.Platform; + +namespace OpenTK.Win +{ + public static class WinWindowsInfoInitializer + { +#if GTK3 + private const string WinLibGDKName = "libgdk-3-0.dll"; +#else + private const string WinLibGDKName = "libgdk-win32-2.0-0.dll"; +#endif + public static IWindowInfo Initialize(IntPtr gdkWindowHandle) + { +#if GTK3 + IntPtr windowHandle = gdk_win32_window_get_handle(gdkWindowHandle); +#else + IntPtr windowHandle = gdk_win32_drawable_get_handle(gdkWindowHandle); +#endif + return Utilities.CreateWindowsWindowInfo(windowHandle); + } + +#if GTK3 + [SuppressUnmanagedCodeSecurity, DllImport(WinLibGDKName, CallingConvention = CallingConvention.Cdecl)] + static extern IntPtr gdk_win32_window_get_handle(IntPtr w); +#else + [SuppressUnmanagedCodeSecurity, DllImport(WinLibGDKName, CallingConvention = CallingConvention.Cdecl)] + static extern IntPtr gdk_win32_drawable_get_handle(IntPtr d); +#endif + + } +} \ No newline at end of file diff --git a/src/OpenTK.GLWidget/X11/GLXAttribute.cs b/src/OpenTK.GLWidget/X11/GLXAttribute.cs new file mode 100644 index 00000000..30037c9c --- /dev/null +++ b/src/OpenTK.GLWidget/X11/GLXAttribute.cs @@ -0,0 +1,54 @@ +// +// GLXAttribute.cs +// +// The Open Toolkit Library License +// +// Author: +// Jarl Gullberg +// +// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted. +// +// 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. +// + +namespace OpenTK.X11 +{ + public enum GLXAttribute + { + None = 0, + UseGL = 1, + BufferSize = 2, + Level = 3, + RGBA = 4, + DoubleBuffer = 5, + Stereo = 6, + AuxBuffers = 7, + RedSize = 8, + GreenSize = 9, + BlueSize = 10, + AlphaSize = 11, + DepthSize = 12, + StencilSize = 13, + AccumRedSize = 14, + AccumGreenSize = 15, + AccumBlueSize = 16, + AccumAlphaSize = 17 + } +} \ No newline at end of file diff --git a/src/OpenTK.GLWidget/X11/XVisualClass.cs b/src/OpenTK.GLWidget/X11/XVisualClass.cs new file mode 100644 index 00000000..d22d973b --- /dev/null +++ b/src/OpenTK.GLWidget/X11/XVisualClass.cs @@ -0,0 +1,39 @@ +// +// XVisualClass.cs +// +// The Open Toolkit Library License +// +// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted. +// +// 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. +// + +namespace OpenTK.X11 +{ + public enum XVisualClass + { + StaticGray = 0, + GrayScale = 1, + StaticColor = 2, + PseudoColor = 3, + TrueColor = 4, + DirectColor = 5 + } +} \ No newline at end of file diff --git a/src/OpenTK.GLWidget/X11/XVisualInfo.cs b/src/OpenTK.GLWidget/X11/XVisualInfo.cs new file mode 100644 index 00000000..ad7544ab --- /dev/null +++ b/src/OpenTK.GLWidget/X11/XVisualInfo.cs @@ -0,0 +1,52 @@ +// +// XVisualInfo.cs +// +// The Open Toolkit Library License +// +// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted. +// +// 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. +// + +using System; +using System.Runtime.InteropServices; + +namespace OpenTK.X11 +{ + [StructLayout(LayoutKind.Sequential)] + public 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 $"id ({this.VisualID}), screen ({this.Screen}), depth ({this.Depth}), class ({this.Class})"; + } + } +} \ No newline at end of file diff --git a/src/OpenTK.GLWidget/X11/XVisualInfoMask.cs b/src/OpenTK.GLWidget/X11/XVisualInfoMask.cs new file mode 100644 index 00000000..80565589 --- /dev/null +++ b/src/OpenTK.GLWidget/X11/XVisualInfoMask.cs @@ -0,0 +1,47 @@ +// +// XVisualInfoMask.cs +// +// The Open Toolkit Library License +// +// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted. +// +// 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. +// + +using System; + +namespace OpenTK.X11 +{ + [Flags] + public enum XVisualInfoMask + { + No = 0x0, + ID = 0x1, + Screen = 0x2, + Depth = 0x4, + Class = 0x8, + Red = 0x10, + Green = 0x20, + Blue = 0x40, + ColormapSize = 0x80, + BitsPerRGB = 0x100, + All = 0x1FF + } +} \ No newline at end of file diff --git a/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs b/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs new file mode 100644 index 00000000..2f2511a3 --- /dev/null +++ b/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs @@ -0,0 +1,189 @@ +// +// XWindowsInfoInitializer.cs +// +// The Open Toolkit Library License +// +// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted. +// +// 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. +// + +using System; +using System.Collections.Generic; +using System.Runtime.InteropServices; +using System.Security; +using OpenTK.Graphics; +using OpenTK.Platform; + +namespace OpenTK.X11 +{ + public static class XWindowInfoInitializer + { + +#if GTK3 + const string UnixLibGdkName = "libgdk-3.so.0"; +#else + const string UnixLibGdkName = "libgdk-x11-2.0.so.0"; +#endif + private const string UnixLibX11Name = "libX11.so.6"; + private const string UnixLibGLName = "libGL.so.1"; + + public static IWindowInfo Initialize(GraphicsMode mode, IntPtr displayHandle, int screenNumber, IntPtr gdkWindowHandle, IntPtr gdkRootWindowHandle) + { + IntPtr display = gdk_x11_display_get_xdisplay(displayHandle); + +#if GTK3 + IntPtr windowXid = gdk_x11_window_get_xid(gdkWindowHandle); + IntPtr rootWindowXid = gdk_x11_window_get_xid(gdkRootWindowHandle); +#else + IntPtr windowHandle = gdk_x11_drawable_get_xid(gdkWindowHandle); + IntPtr rootWindow = gdk_x11_drawable_get_xid(gdkRootWindowHandle); +#endif + + IntPtr visualInfo; + if (mode.Index.HasValue) + { + XVisualInfo info = new XVisualInfo + { + VisualID = mode.Index.Value + }; + + int dummy; + visualInfo = XGetVisualInfo(display, XVisualInfoMask.ID, ref info, out dummy); + } + else + { + visualInfo = GetVisualInfo(mode, display, screenNumber); + } + + IWindowInfo retval = Utilities.CreateX11WindowInfo(display, screenNumber, windowXid, rootWindowXid, visualInfo); + XFree(visualInfo); + + return retval; + } + + private static IntPtr XGetVisualInfo(IntPtr display, XVisualInfoMask infoMask, ref XVisualInfo template, out int nitems) + { + return XGetVisualInfoInternal(display, (IntPtr)(int)infoMask, ref template, out nitems); + } + + private static IntPtr GetVisualInfo(GraphicsMode mode, IntPtr display, int screenNumber) + { + try + { + int[] attributes = CreateAttributeList(mode).ToArray(); + return glXChooseVisual(display, screenNumber, attributes); + } + catch (DllNotFoundException e) + { + throw new DllNotFoundException("OpenGL dll not found!", e); + } + catch (EntryPointNotFoundException enf) + { + throw new EntryPointNotFoundException("Glx entry point not found!", enf); + } + } + + private static List CreateAttributeList(GraphicsMode mode) + { + List attributeList = new List(24); + + attributeList.Add((int)GLXAttribute.RGBA); + + if (mode.Buffers > 1) + { + attributeList.Add((int)GLXAttribute.DoubleBuffer); + } + + if (mode.Stereo) + { + attributeList.Add((int)GLXAttribute.Stereo); + } + + attributeList.Add((int)GLXAttribute.RedSize); + attributeList.Add(mode.ColorFormat.Red / 4); // TODO support 16-bit + + attributeList.Add((int)GLXAttribute.GreenSize); + attributeList.Add(mode.ColorFormat.Green / 4); // TODO support 16-bit + + attributeList.Add((int)GLXAttribute.BlueSize); + attributeList.Add(mode.ColorFormat.Blue / 4); // TODO support 16-bit + + attributeList.Add((int)GLXAttribute.AlphaSize); + attributeList.Add(mode.ColorFormat.Alpha / 4); // TODO support 16-bit + + attributeList.Add((int)GLXAttribute.DepthSize); + attributeList.Add(mode.Depth); + + attributeList.Add((int)GLXAttribute.StencilSize); + attributeList.Add(mode.Stencil); + + //attributeList.Add(GLX_AUX_BUFFERS); + //attributeList.Add(Buffers); + + attributeList.Add((int)GLXAttribute.AccumRedSize); + attributeList.Add(mode.AccumulatorFormat.Red / 4);// TODO support 16-bit + + attributeList.Add((int)GLXAttribute.AccumGreenSize); + attributeList.Add(mode.AccumulatorFormat.Green / 4);// TODO support 16-bit + + attributeList.Add((int)GLXAttribute.AccumBlueSize); + attributeList.Add(mode.AccumulatorFormat.Blue / 4);// TODO support 16-bit + + attributeList.Add((int)GLXAttribute.AccumAlphaSize); + attributeList.Add(mode.AccumulatorFormat.Alpha / 4);// TODO support 16-bit + + attributeList.Add((int)GLXAttribute.None); + + return attributeList; + } + + [DllImport(UnixLibX11Name, EntryPoint = "XGetVisualInfo")] + private static extern IntPtr XGetVisualInfoInternal(IntPtr display, IntPtr infoMask, ref XVisualInfo template, out int nitems); + + [SuppressUnmanagedCodeSecurity, DllImport(UnixLibX11Name)] + private static extern void XFree(IntPtr handle); + +#if GTK3 + /// Returns the X resource (window or pixmap) belonging to a GdkWindow. + /// XID gdk_x11_window_get_xid(GdkWindow *drawable); + /// The GdkDrawable. + /// The ID of window's X resource. + [SuppressUnmanagedCodeSecurity, DllImport(UnixLibGdkName)] + private static extern IntPtr gdk_x11_window_get_xid(IntPtr gdkDisplay); +#else + /// Returns the X resource (window or pixmap) belonging to a GdkDrawable. + /// XID gdk_x11_drawable_get_xid(GdkDrawable *drawable); + /// The GdkDrawable. + /// The ID of drawable's X resource. + [SuppressUnmanagedCodeSecurity, DllImport(UnixLibGdkName)] + static extern IntPtr gdk_x11_drawable_get_xid(IntPtr gdkDisplay); +#endif + /// Returns the X display of a GdkDisplay. + /// Display* gdk_x11_display_get_xdisplay(GdkDisplay *display); + /// The GdkDrawable. + /// The X Display of the GdkDisplay. + [SuppressUnmanagedCodeSecurity, DllImport(UnixLibGdkName)] + private static extern IntPtr gdk_x11_display_get_xdisplay(IntPtr gdkDisplay); + + [SuppressUnmanagedCodeSecurity, DllImport(UnixLibGLName)] + private static extern IntPtr glXChooseVisual(IntPtr display, int screen, int[] attr); + } +} \ No newline at end of file From cf678dfc481d37a7125f27ae79d880783920a9c1 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 22:01:11 +0200 Subject: [PATCH 21/45] Replaced in-class initialization with calls to platform-specific classes. --- src/OpenTK.GLWidget/GLWidget.cs | 49 +++++++++++++++++---------------- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/src/OpenTK.GLWidget/GLWidget.cs b/src/OpenTK.GLWidget/GLWidget.cs index 0e717dc5..b9480d79 100644 --- a/src/OpenTK.GLWidget/GLWidget.cs +++ b/src/OpenTK.GLWidget/GLWidget.cs @@ -6,7 +6,7 @@ // // 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 +// 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: @@ -36,6 +36,9 @@ using OpenTK.Graphics; using OpenTK.Platform; using Gtk; +using OpenTK.OSX; +using OpenTK.Win; +using OpenTK.X11; namespace OpenTK { @@ -92,12 +95,12 @@ namespace OpenTK public GraphicsContextFlags GraphicsContextFlags { get - { - return _GraphicsContextFlags; + { + return _GraphicsContextFlags; } set - { - _GraphicsContextFlags = value; + { + _GraphicsContextFlags = value; } } @@ -108,13 +111,13 @@ namespace OpenTK /// Constructs a new GLWidget. public GLWidget() : this(GraphicsMode.Default) - { + { } /// Constructs a new GLWidget using a given GraphicsMode public GLWidget(GraphicsMode graphicsMode) : this(graphicsMode, 1, 0, GraphicsContextFlags.Default) - { + { } /// Constructs a new GLWidget @@ -136,8 +139,8 @@ namespace OpenTK } ~GLWidget() - { - Dispose(false); + { + Dispose(false); } #if GTK3 @@ -180,43 +183,43 @@ namespace OpenTK static void OnGraphicsContextInitialized() { if (GraphicsContextInitialized != null) - GraphicsContextInitialized(null, EventArgs.Empty); + GraphicsContextInitialized(null, EventArgs.Empty); } // Called when the first GraphicsContext is being destroyed in the case of GraphicsContext.ShareContexts == True; public static event EventHandler GraphicsContextShuttingDown; static void OnGraphicsContextShuttingDown() - { + { if (GraphicsContextShuttingDown != null) - GraphicsContextShuttingDown(null, EventArgs.Empty); + GraphicsContextShuttingDown(null, EventArgs.Empty); } // Called when this GLWidget has a valid GraphicsContext public event EventHandler Initialized; protected virtual void OnInitialized() - { + { if (Initialized != null) - Initialized(this, EventArgs.Empty); + Initialized(this, EventArgs.Empty); } // Called when this GLWidget needs to render a frame public event EventHandler RenderFrame; protected virtual void OnRenderFrame() - { + { if (RenderFrame != null) - RenderFrame(this, EventArgs.Empty); + RenderFrame(this, EventArgs.Empty); } // Called when this GLWidget is being Disposed public event EventHandler ShuttingDown; protected virtual void OnShuttingDown() - { + { if (ShuttingDown != null) - ShuttingDown(this, EventArgs.Empty); + ShuttingDown(this, EventArgs.Empty); } #endregion @@ -291,16 +294,16 @@ namespace OpenTK Console.WriteLine("OpenTK running on windows"); else if (Configuration.RunningOnMacOS) Console.WriteLine("OpenTK running on OSX"); - else + else Console.WriteLine("OpenTK running on X11"); // IWindowInfo if (Configuration.RunningOnWindows) - _WindowInfo = InitializeWindows(); + _WindowInfo = WinWindowsInfoInitializer.Initialize(this.Window.Handle); else if (Configuration.RunningOnMacOS) - _WindowInfo = InitializeOSX(); + _WindowInfo = OSXWindowInfoInitializer.Initialize(this.Window.Handle); else - _WindowInfo = InitializeX(graphicsMode); + _WindowInfo = XWindowInfoInitializer.Initialize(graphicsMode, this.Display.Handle, this.Screen.Number, this.Window.Handle, this.RootWindow.Handle); // GraphicsContext _GraphicsContext = new GraphicsContext(graphicsMode, _WindowInfo, GlVersionMajor, GlVersionMinor, _GraphicsContextFlags); @@ -361,7 +364,7 @@ namespace OpenTK #else const string MacLibGdkName = "libgdk-quartz-2.0.0.dylib"; #endif - + [SuppressUnmanagedCodeSecurity, DllImport(MacLibGdkName)] static extern IntPtr gdk_quartz_window_get_nswindow(IntPtr handle); From 57004cceb8198b0333d624b5be1153b1f29b1340 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 22:01:34 +0200 Subject: [PATCH 22/45] Added new files to project. --- src/OpenTK.GLWidget/OpenTK.GLWidget.csproj | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj b/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj index 5ed427a5..384726f1 100644 --- a/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj +++ b/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj @@ -137,10 +137,17 @@ + Code + + + + + + From 91eac27c99a786ef56119eef924dd280d24a59ca Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 22:02:21 +0200 Subject: [PATCH 23/45] Deleted now obsolete code. --- src/OpenTK.GLWidget/GLWidget.cs | 264 +------------------------------- 1 file changed, 1 insertion(+), 263 deletions(-) diff --git a/src/OpenTK.GLWidget/GLWidget.cs b/src/OpenTK.GLWidget/GLWidget.cs index b9480d79..a0f862fc 100644 --- a/src/OpenTK.GLWidget/GLWidget.cs +++ b/src/OpenTK.GLWidget/GLWidget.cs @@ -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 AttributeList - { - get - { - List attributeList = new List(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); - - /// Returns the X resource (window or pixmap) belonging to a GdkDrawable. - /// XID gdk_x11_drawable_get_xid(GdkDrawable *drawable); - /// The GdkDrawable. - /// The ID of drawable's X resource. - [SuppressUnmanagedCodeSecurity, DllImport(UnixLibGdkName)] - static extern IntPtr gdk_x11_drawable_get_xid(IntPtr gdkDisplay); - - /// Returns the X resource (window or pixmap) belonging to a GdkDrawable. - /// XID gdk_x11_drawable_get_xid(GdkDrawable *drawable); - /// The GdkDrawable. - /// The ID of drawable's X resource. - [SuppressUnmanagedCodeSecurity, DllImport(UnixLibGdkName)] - static extern IntPtr gdk_x11_window_get_xid(IntPtr gdkDisplay); - - /// Returns the X display of a GdkDisplay. - /// Display* gdk_x11_display_get_xdisplay(GdkDisplay *display); - /// The GdkDrawable. - /// The X Display of the GdkDisplay. - [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 From 8b32c9aa5ef87686fe282ab54881d179ad50c9f8 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 22:08:23 +0200 Subject: [PATCH 24/45] Improved comments. --- src/OpenTK.GLWidget/GLWidget.cs | 135 ++++++++++++++++++++++++++------ 1 file changed, 112 insertions(+), 23 deletions(-) diff --git a/src/OpenTK.GLWidget/GLWidget.cs b/src/OpenTK.GLWidget/GLWidget.cs index a0f862fc..d5f4a435 100644 --- a/src/OpenTK.GLWidget/GLWidget.cs +++ b/src/OpenTK.GLWidget/GLWidget.cs @@ -39,6 +39,9 @@ using OpenTK.X11; namespace OpenTK { + /// + /// The is a GTK widget for which an OpenGL context can be used to draw arbitrary graphics. + /// [ToolboxItem(true)] public class GLWidget: DrawingArea { @@ -61,34 +64,55 @@ namespace OpenTK #region Properties - /// Use a single buffer versus a double buffer. + /// + /// Use a single buffer versus a double buffer. + /// [Browsable(true)] public bool SingleBuffer { get; set; } - /// Color Buffer Bits-Per-Pixel + /// + /// Color Buffer Bits-Per-Pixel + /// public int ColorBPP { get; set; } - /// Accumulation Buffer Bits-Per-Pixel + /// + /// Accumulation Buffer Bits-Per-Pixel + /// public int AccumulatorBPP { get; set; } - /// Depth Buffer Bits-Per-Pixel + /// + /// Depth Buffer Bits-Per-Pixel + /// public int DepthBPP { get; set; } - /// Stencil Buffer Bits-Per-Pixel + /// + /// Stencil Buffer Bits-Per-Pixel + /// public int StencilBPP { get; set; } - /// Number of samples + /// + /// Number of samples + /// public int Samples { get; set; } - /// Indicates if steropic renderering is enabled + /// + /// Indicates if steropic renderering is enabled + /// public bool Stereo { get; set; } - /// The major version of OpenGL to use. + /// + /// The major version of OpenGL to use. + /// public int GlVersionMajor { get; set; } - /// The minor version of OpenGL to use. + /// + /// The minor version of OpenGL to use. + /// public int GlVersionMinor { get; set; } + /// + /// The set for this widget. + /// public GraphicsContextFlags GraphicsContextFlags { get @@ -105,7 +129,9 @@ namespace OpenTK #region Construction/Destruction - /// Constructs a new GLWidget. + /// + /// Initializes a new instance of the class. + /// public GLWidget() : this(GraphicsMode.Default) { @@ -117,7 +143,15 @@ namespace OpenTK { } - /// Constructs a new GLWidget + /// + /// Initializes a new instance of the class. + /// + /// The which the widget should be constructed with. + /// The major OpenGL version to attempt to initialize. + /// The minor OpenGL version to attempt to initialize. + /// + /// Any flags which should be used during initialization of the . + /// public GLWidget(GraphicsMode graphicsMode, int glVersionMajor, int glVersionMinor, GraphicsContextFlags graphicsContextFlags) { this.DoubleBuffered = false; @@ -135,17 +169,27 @@ namespace OpenTK GraphicsContextFlags = graphicsContextFlags; } + /// + /// Destructs this object. + /// ~GLWidget() { Dispose(false); } #if GTK3 - public override void Destroy() { + /// + /// Destroys this , disposing it and destroying it in the context of GTK. + /// + public override void Destroy() #else + /// + /// Disposes the current object, releasing any native resources it was using. + /// + /// public override void Dispose() - { #endif + { GC.SuppressFinalize(this); Dispose(true); #if GTK3 @@ -155,6 +199,10 @@ namespace OpenTK #endif } + /// + /// Disposes the current object, releasing any native resources it was using. + /// + /// public virtual void Dispose(bool disposing) { if (disposing) @@ -174,45 +222,73 @@ namespace OpenTK #region New Events - // Called when the first GraphicsContext is created in the case of GraphicsContext.ShareContexts == True; + /// + /// Called when the first is created in the case where + /// GraphicsContext.ShareContexts == true; + /// public static event EventHandler GraphicsContextInitialized; + /// + /// Invokes the event. + /// static void OnGraphicsContextInitialized() { if (GraphicsContextInitialized != null) GraphicsContextInitialized(null, EventArgs.Empty); } - // Called when the first GraphicsContext is being destroyed in the case of GraphicsContext.ShareContexts == True; + /// + /// Called when the first is being destroyed in the case where + /// GraphicsContext.ShareContext == true; + /// public static event EventHandler GraphicsContextShuttingDown; + /// + /// Invokes the event. + /// static void OnGraphicsContextShuttingDown() { if (GraphicsContextShuttingDown != null) GraphicsContextShuttingDown(null, EventArgs.Empty); } - // Called when this GLWidget has a valid GraphicsContext + /// + /// Called when this has finished initializing and has a valid + /// . + /// public event EventHandler Initialized; + /// + /// Invokes the event. + /// protected virtual void OnInitialized() { if (Initialized != null) Initialized(this, EventArgs.Empty); } - // Called when this GLWidget needs to render a frame + /// + /// Called when this needs to render a frame. + /// public event EventHandler RenderFrame; + /// + /// Invokes the event. + /// protected virtual void OnRenderFrame() { if (RenderFrame != null) RenderFrame(this, EventArgs.Empty); } - // Called when this GLWidget is being Disposed + /// + /// Called when this is being disposed. + /// public event EventHandler ShuttingDown; + /// + /// Invokes the event. + /// protected virtual void OnShuttingDown() { if (ShuttingDown != null) @@ -221,13 +297,19 @@ namespace OpenTK #endregion - // Called when a widget is realized. (window handles and such are valid) - // protected override void OnRealized() { base.OnRealized(); } - - // Called when the widget needs to be (fully or partially) redrawn. #if GTK3 + /// + /// Called when the widget needs to be (fully or partially) redrawn. + /// + /// + /// protected override bool OnDrawn(Cairo.Context cr) #else + /// + /// Called when the widget is exposed. + /// + /// + /// protected override bool OnExposeEvent(Gdk.EventExpose evnt) #endif { @@ -253,7 +335,11 @@ namespace OpenTK return result; } - // Called on Resize + /// + /// Called whenever the widget is resized. + /// + /// + /// protected override bool OnConfigureEvent(Gdk.EventConfigure evnt) { bool result = base.OnConfigureEvent(evnt); @@ -264,6 +350,9 @@ namespace OpenTK return result; } + /// + /// Initializes the with its given values and creates a . + /// void Initialize() { _Initialized = true; From f240a752087df25beab2c32aab7166aa37ef005e Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 22:08:58 +0200 Subject: [PATCH 25/45] Enforced use of explicit private modifiers for clarity. --- src/OpenTK.GLWidget/GLWidget.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/OpenTK.GLWidget/GLWidget.cs b/src/OpenTK.GLWidget/GLWidget.cs index d5f4a435..c1d3c5e4 100644 --- a/src/OpenTK.GLWidget/GLWidget.cs +++ b/src/OpenTK.GLWidget/GLWidget.cs @@ -48,17 +48,17 @@ namespace OpenTK #region Static attrs. - static int _GraphicsContextCount; - static bool _SharedContextInitialized = false; + private static int _GraphicsContextCount; + private static bool _SharedContextInitialized = false; #endregion #region Attributes - IGraphicsContext _GraphicsContext; - IWindowInfo _WindowInfo; - GraphicsContextFlags _GraphicsContextFlags; - bool _Initialized = false; + private IGraphicsContext _GraphicsContext; + private IWindowInfo _WindowInfo; + private GraphicsContextFlags _GraphicsContextFlags; + private bool _Initialized = false; #endregion @@ -231,7 +231,7 @@ namespace OpenTK /// /// Invokes the event. /// - static void OnGraphicsContextInitialized() + private static void OnGraphicsContextInitialized() { if (GraphicsContextInitialized != null) GraphicsContextInitialized(null, EventArgs.Empty); @@ -246,7 +246,7 @@ namespace OpenTK /// /// Invokes the event. /// - static void OnGraphicsContextShuttingDown() + private static void OnGraphicsContextShuttingDown() { if (GraphicsContextShuttingDown != null) GraphicsContextShuttingDown(null, EventArgs.Empty); @@ -353,7 +353,7 @@ namespace OpenTK /// /// Initializes the with its given values and creates a . /// - void Initialize() + private void Initialize() { _Initialized = true; From 5abcfedf1116ce1d465b9f438febee519e602e13 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 22:09:32 +0200 Subject: [PATCH 26/45] Removed redundant field initializers. --- src/OpenTK.GLWidget/GLWidget.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenTK.GLWidget/GLWidget.cs b/src/OpenTK.GLWidget/GLWidget.cs index c1d3c5e4..7d9d3a1e 100644 --- a/src/OpenTK.GLWidget/GLWidget.cs +++ b/src/OpenTK.GLWidget/GLWidget.cs @@ -49,7 +49,7 @@ namespace OpenTK #region Static attrs. private static int _GraphicsContextCount; - private static bool _SharedContextInitialized = false; + private static bool _SharedContextInitialized; #endregion @@ -58,7 +58,7 @@ namespace OpenTK private IGraphicsContext _GraphicsContext; private IWindowInfo _WindowInfo; private GraphicsContextFlags _GraphicsContextFlags; - private bool _Initialized = false; + private bool _Initialized; #endregion From 1634a652c2638669d1c725b13fdab782dcd96470 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 22:10:49 +0200 Subject: [PATCH 27/45] Introduced optional parameters for GLWidget constructor, removing a redundant constructor. --- src/OpenTK.GLWidget/GLWidget.cs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/src/OpenTK.GLWidget/GLWidget.cs b/src/OpenTK.GLWidget/GLWidget.cs index 7d9d3a1e..fd6f27f2 100644 --- a/src/OpenTK.GLWidget/GLWidget.cs +++ b/src/OpenTK.GLWidget/GLWidget.cs @@ -137,12 +137,6 @@ namespace OpenTK { } - /// Constructs a new GLWidget using a given GraphicsMode - public GLWidget(GraphicsMode graphicsMode) - : this(graphicsMode, 1, 0, GraphicsContextFlags.Default) - { - } - /// /// Initializes a new instance of the class. /// @@ -152,7 +146,7 @@ namespace OpenTK /// /// Any flags which should be used during initialization of the . /// - public GLWidget(GraphicsMode graphicsMode, int glVersionMajor, int glVersionMinor, GraphicsContextFlags graphicsContextFlags) + public GLWidget(GraphicsMode graphicsMode, int glVersionMajor = 1, int glVersionMinor = 0, GraphicsContextFlags graphicsContextFlags = GraphicsContextFlags.Default) { this.DoubleBuffered = false; From be037bbdb0b61bd434ed5a7ab85a5261486063fd Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 22:11:19 +0200 Subject: [PATCH 28/45] Converted GraphicsContextFlags into an auto-property. --- src/OpenTK.GLWidget/GLWidget.cs | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) diff --git a/src/OpenTK.GLWidget/GLWidget.cs b/src/OpenTK.GLWidget/GLWidget.cs index fd6f27f2..67e51da8 100644 --- a/src/OpenTK.GLWidget/GLWidget.cs +++ b/src/OpenTK.GLWidget/GLWidget.cs @@ -57,7 +57,6 @@ namespace OpenTK private IGraphicsContext _GraphicsContext; private IWindowInfo _WindowInfo; - private GraphicsContextFlags _GraphicsContextFlags; private bool _Initialized; #endregion @@ -113,17 +112,7 @@ namespace OpenTK /// /// The set for this widget. /// - public GraphicsContextFlags GraphicsContextFlags - { - get - { - return _GraphicsContextFlags; - } - set - { - _GraphicsContextFlags = value; - } - } + public GraphicsContextFlags GraphicsContextFlags { get; set; } #endregion @@ -386,7 +375,7 @@ namespace OpenTK _WindowInfo = XWindowInfoInitializer.Initialize(graphicsMode, this.Display.Handle, this.Screen.Number, this.Window.Handle, this.RootWindow.Handle); // GraphicsContext - _GraphicsContext = new GraphicsContext(graphicsMode, _WindowInfo, GlVersionMajor, GlVersionMinor, _GraphicsContextFlags); + _GraphicsContext = new GraphicsContext(graphicsMode, _WindowInfo, GlVersionMajor, GlVersionMinor, this.GraphicsContextFlags); _GraphicsContext.MakeCurrent(_WindowInfo); if (GraphicsContext.ShareContexts) From c98fbde35c77e3d2180f7ab3022a83643ff5340a Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 22:13:20 +0200 Subject: [PATCH 29/45] Added ReSharper warning suppressions. --- src/OpenTK.GLWidget/GLWidget.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/OpenTK.GLWidget/GLWidget.cs b/src/OpenTK.GLWidget/GLWidget.cs index 67e51da8..1a552590 100644 --- a/src/OpenTK.GLWidget/GLWidget.cs +++ b/src/OpenTK.GLWidget/GLWidget.cs @@ -37,13 +37,16 @@ using OpenTK.OSX; using OpenTK.Win; using OpenTK.X11; +// ReSharper disable ClassWithVirtualMembersNeverInherited.Global +// ReSharper disable EventNeverSubscribedTo.Global + namespace OpenTK { /// /// The is a GTK widget for which an OpenGL context can be used to draw arbitrary graphics. /// [ToolboxItem(true)] - public class GLWidget: DrawingArea + public class GLWidget : DrawingArea { #region Static attrs. From 12ed99e9eb2b6baa4acee59094560dadaa75c21b Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 22:34:14 +0200 Subject: [PATCH 30/45] Revert "Added ReSharper warning suppressions." This reverts commit c98fbde35c77e3d2180f7ab3022a83643ff5340a. --- src/OpenTK.GLWidget/GLWidget.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/OpenTK.GLWidget/GLWidget.cs b/src/OpenTK.GLWidget/GLWidget.cs index 1a552590..67e51da8 100644 --- a/src/OpenTK.GLWidget/GLWidget.cs +++ b/src/OpenTK.GLWidget/GLWidget.cs @@ -37,16 +37,13 @@ using OpenTK.OSX; using OpenTK.Win; using OpenTK.X11; -// ReSharper disable ClassWithVirtualMembersNeverInherited.Global -// ReSharper disable EventNeverSubscribedTo.Global - namespace OpenTK { /// /// The is a GTK widget for which an OpenGL context can be used to draw arbitrary graphics. /// [ToolboxItem(true)] - public class GLWidget : DrawingArea + public class GLWidget: DrawingArea { #region Static attrs. From 632c3f8722da93539986addfc5affabd8a6fcfbc Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 22:34:26 +0200 Subject: [PATCH 31/45] Revert "Converted GraphicsContextFlags into an auto-property." This reverts commit be037bbdb0b61bd434ed5a7ab85a5261486063fd. --- src/OpenTK.GLWidget/GLWidget.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/OpenTK.GLWidget/GLWidget.cs b/src/OpenTK.GLWidget/GLWidget.cs index 67e51da8..fd6f27f2 100644 --- a/src/OpenTK.GLWidget/GLWidget.cs +++ b/src/OpenTK.GLWidget/GLWidget.cs @@ -57,6 +57,7 @@ namespace OpenTK private IGraphicsContext _GraphicsContext; private IWindowInfo _WindowInfo; + private GraphicsContextFlags _GraphicsContextFlags; private bool _Initialized; #endregion @@ -112,7 +113,17 @@ namespace OpenTK /// /// The set for this widget. /// - public GraphicsContextFlags GraphicsContextFlags { get; set; } + public GraphicsContextFlags GraphicsContextFlags + { + get + { + return _GraphicsContextFlags; + } + set + { + _GraphicsContextFlags = value; + } + } #endregion @@ -375,7 +386,7 @@ namespace OpenTK _WindowInfo = XWindowInfoInitializer.Initialize(graphicsMode, this.Display.Handle, this.Screen.Number, this.Window.Handle, this.RootWindow.Handle); // GraphicsContext - _GraphicsContext = new GraphicsContext(graphicsMode, _WindowInfo, GlVersionMajor, GlVersionMinor, this.GraphicsContextFlags); + _GraphicsContext = new GraphicsContext(graphicsMode, _WindowInfo, GlVersionMajor, GlVersionMinor, _GraphicsContextFlags); _GraphicsContext.MakeCurrent(_WindowInfo); if (GraphicsContext.ShareContexts) From accdc55731f7f89306c0ad38d371f3286f31640d Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 22:34:29 +0200 Subject: [PATCH 32/45] Revert "Introduced optional parameters for GLWidget constructor, removing a redundant constructor." This reverts commit 1634a652c2638669d1c725b13fdab782dcd96470. --- src/OpenTK.GLWidget/GLWidget.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/OpenTK.GLWidget/GLWidget.cs b/src/OpenTK.GLWidget/GLWidget.cs index fd6f27f2..7d9d3a1e 100644 --- a/src/OpenTK.GLWidget/GLWidget.cs +++ b/src/OpenTK.GLWidget/GLWidget.cs @@ -137,6 +137,12 @@ namespace OpenTK { } + /// Constructs a new GLWidget using a given GraphicsMode + public GLWidget(GraphicsMode graphicsMode) + : this(graphicsMode, 1, 0, GraphicsContextFlags.Default) + { + } + /// /// Initializes a new instance of the class. /// @@ -146,7 +152,7 @@ namespace OpenTK /// /// Any flags which should be used during initialization of the . /// - public GLWidget(GraphicsMode graphicsMode, int glVersionMajor = 1, int glVersionMinor = 0, GraphicsContextFlags graphicsContextFlags = GraphicsContextFlags.Default) + public GLWidget(GraphicsMode graphicsMode, int glVersionMajor, int glVersionMinor, GraphicsContextFlags graphicsContextFlags) { this.DoubleBuffered = false; From af5be093a8dc463ac53d07b5bd4a0169ad96f6ab Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 22:34:32 +0200 Subject: [PATCH 33/45] Revert "Removed redundant field initializers." This reverts commit 5abcfedf1116ce1d465b9f438febee519e602e13. --- src/OpenTK.GLWidget/GLWidget.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenTK.GLWidget/GLWidget.cs b/src/OpenTK.GLWidget/GLWidget.cs index 7d9d3a1e..c1d3c5e4 100644 --- a/src/OpenTK.GLWidget/GLWidget.cs +++ b/src/OpenTK.GLWidget/GLWidget.cs @@ -49,7 +49,7 @@ namespace OpenTK #region Static attrs. private static int _GraphicsContextCount; - private static bool _SharedContextInitialized; + private static bool _SharedContextInitialized = false; #endregion @@ -58,7 +58,7 @@ namespace OpenTK private IGraphicsContext _GraphicsContext; private IWindowInfo _WindowInfo; private GraphicsContextFlags _GraphicsContextFlags; - private bool _Initialized; + private bool _Initialized = false; #endregion From 3d60cf2bf6b64d35bcf039eb52c48cc757a7ed66 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 22:42:52 +0200 Subject: [PATCH 34/45] Split the different Destroy and Dispose signatures. --- src/OpenTK.GLWidget/GLWidget.cs | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) diff --git a/src/OpenTK.GLWidget/GLWidget.cs b/src/OpenTK.GLWidget/GLWidget.cs index c1d3c5e4..e2c0efad 100644 --- a/src/OpenTK.GLWidget/GLWidget.cs +++ b/src/OpenTK.GLWidget/GLWidget.cs @@ -177,34 +177,47 @@ namespace OpenTK Dispose(false); } -#if GTK3 /// /// Destroys this , disposing it and destroying it in the context of GTK. /// public override void Destroy() -#else + { + GC.SuppressFinalize(this); + Dispose(true); + + base.Destroy(); + } + +#if !GTK3 /// /// Disposes the current object, releasing any native resources it was using. /// /// public override void Dispose() -#endif { GC.SuppressFinalize(this); Dispose(true); -#if GTK3 - base.Destroy(); -#else - base.Dispose(); -#endif - } + base.Dispose(); + } +#endif + +#if GTK3 + /// + /// Disposes the current object, releasing any native resources it was using. + /// + /// + protected override void Dispose(bool disposing) + { + base.Dispose(disposing); +#else /// /// Disposes the current object, releasing any native resources it was using. /// /// public virtual void Dispose(bool disposing) { +#endif if (disposing) { _GraphicsContext.MakeCurrent(_WindowInfo); From 0a95b20860ee5103eee23c78aaf6803b25c30340 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 22:45:10 +0200 Subject: [PATCH 35/45] GdkWindow is deprecated in GTK3. Splitting out into two accessors. --- src/OpenTK.GLWidget/GLWidget.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/OpenTK.GLWidget/GLWidget.cs b/src/OpenTK.GLWidget/GLWidget.cs index e2c0efad..63d133f6 100644 --- a/src/OpenTK.GLWidget/GLWidget.cs +++ b/src/OpenTK.GLWidget/GLWidget.cs @@ -396,13 +396,19 @@ namespace OpenTK else Console.WriteLine("OpenTK running on X11"); +#if GTK3 + IntPtr widgetWindowHandle = this.Window.Handle; +#else + IntPtr widgetWindowHandle = this.GdkWindow.Handle; +#endif + // IWindowInfo if (Configuration.RunningOnWindows) - _WindowInfo = WinWindowsInfoInitializer.Initialize(this.Window.Handle); + _WindowInfo = WinWindowsInfoInitializer.Initialize(widgetWindowHandle); else if (Configuration.RunningOnMacOS) - _WindowInfo = OSXWindowInfoInitializer.Initialize(this.Window.Handle); + _WindowInfo = OSXWindowInfoInitializer.Initialize(widgetWindowHandle); else - _WindowInfo = XWindowInfoInitializer.Initialize(graphicsMode, this.Display.Handle, this.Screen.Number, this.Window.Handle, this.RootWindow.Handle); + _WindowInfo = XWindowInfoInitializer.Initialize(graphicsMode, this.Display.Handle, this.Screen.Number, widgetWindowHandle, this.RootWindow.Handle); // GraphicsContext _GraphicsContext = new GraphicsContext(graphicsMode, _WindowInfo, GlVersionMajor, GlVersionMinor, _GraphicsContextFlags); From 5c69098f63e573b55091f2037265580f9f8c4af7 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 22:46:28 +0200 Subject: [PATCH 36/45] Correct usage of variable name under GTK2. --- src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs b/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs index 2f2511a3..c37bad18 100644 --- a/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs +++ b/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs @@ -53,8 +53,8 @@ namespace OpenTK.X11 IntPtr windowXid = gdk_x11_window_get_xid(gdkWindowHandle); IntPtr rootWindowXid = gdk_x11_window_get_xid(gdkRootWindowHandle); #else - IntPtr windowHandle = gdk_x11_drawable_get_xid(gdkWindowHandle); - IntPtr rootWindow = gdk_x11_drawable_get_xid(gdkRootWindowHandle); + IntPtr windowXid = gdk_x11_drawable_get_xid(gdkWindowHandle); + IntPtr rootWindowXid = gdk_x11_drawable_get_xid(gdkRootWindowHandle); #endif IntPtr visualInfo; From cb42feef20b3c8c5299f4b7b115fc156825ae9af Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 22:49:49 +0200 Subject: [PATCH 37/45] Added more method and class comments. --- src/OpenTK.GLWidget/OSX/OSXWindowInfoInitializer.cs | 8 ++++++++ src/OpenTK.GLWidget/Win/WinWindowsInfoInitializer.cs | 9 +++++++++ src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs | 12 ++++++++++++ 3 files changed, 29 insertions(+) diff --git a/src/OpenTK.GLWidget/OSX/OSXWindowInfoInitializer.cs b/src/OpenTK.GLWidget/OSX/OSXWindowInfoInitializer.cs index fcf27bd7..1eaec2df 100644 --- a/src/OpenTK.GLWidget/OSX/OSXWindowInfoInitializer.cs +++ b/src/OpenTK.GLWidget/OSX/OSXWindowInfoInitializer.cs @@ -32,6 +32,10 @@ using OpenTK.Platform; namespace OpenTK.OSX { + /// + /// Handler class for initializing objects under the OSX platform for both GTK2 and + /// GTK3. + /// public static class OSXWindowInfoInitializer { #if GTK3 @@ -40,6 +44,10 @@ namespace OpenTK.OSX const string OSXLibGdkName = "libgdk-quartz-2.0.0.dylib"; #endif + /// + /// Initializes an under the OSX platform. + /// + /// public static IWindowInfo Initialize(IntPtr gdkWindowHandle) { IntPtr windowHandle = gdk_quartz_window_get_nswindow(gdkWindowHandle); diff --git a/src/OpenTK.GLWidget/Win/WinWindowsInfoInitializer.cs b/src/OpenTK.GLWidget/Win/WinWindowsInfoInitializer.cs index d1da1cb3..1c80d799 100644 --- a/src/OpenTK.GLWidget/Win/WinWindowsInfoInitializer.cs +++ b/src/OpenTK.GLWidget/Win/WinWindowsInfoInitializer.cs @@ -32,6 +32,10 @@ using OpenTK.Platform; namespace OpenTK.Win { + /// + /// Handler class for initializing objects under the Windows platform for both GTK2 and + /// GTK3. + /// public static class WinWindowsInfoInitializer { #if GTK3 @@ -39,6 +43,11 @@ namespace OpenTK.Win #else private const string WinLibGDKName = "libgdk-win32-2.0-0.dll"; #endif + + /// + /// Initializes an under the Windows platform. + /// + /// public static IWindowInfo Initialize(IntPtr gdkWindowHandle) { #if GTK3 diff --git a/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs b/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs index c37bad18..21bd3951 100644 --- a/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs +++ b/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs @@ -34,6 +34,9 @@ using OpenTK.Platform; namespace OpenTK.X11 { + /// + /// Handler class for initializing objects under the X11 platform for both GTK2 and GTK3. + /// public static class XWindowInfoInitializer { @@ -45,6 +48,15 @@ namespace OpenTK.X11 private const string UnixLibX11Name = "libX11.so.6"; private const string UnixLibGLName = "libGL.so.1"; + /// + /// Initializes an under the X11 platform. + /// + /// + /// + /// + /// + /// + /// public static IWindowInfo Initialize(GraphicsMode mode, IntPtr displayHandle, int screenNumber, IntPtr gdkWindowHandle, IntPtr gdkRootWindowHandle) { IntPtr display = gdk_x11_display_get_xdisplay(displayHandle); From 5dce9161bdf7627aaaceed814d1ef0d9c35a5b9d Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Tue, 13 Jun 2017 23:06:39 +0200 Subject: [PATCH 38/45] RootWindow is now accessed through GDK.Screen instead. It is deprecated in GTK3. --- src/OpenTK.GLWidget/GLWidget.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/OpenTK.GLWidget/GLWidget.cs b/src/OpenTK.GLWidget/GLWidget.cs index 63d133f6..cbe42b6b 100644 --- a/src/OpenTK.GLWidget/GLWidget.cs +++ b/src/OpenTK.GLWidget/GLWidget.cs @@ -408,7 +408,7 @@ namespace OpenTK else if (Configuration.RunningOnMacOS) _WindowInfo = OSXWindowInfoInitializer.Initialize(widgetWindowHandle); else - _WindowInfo = XWindowInfoInitializer.Initialize(graphicsMode, this.Display.Handle, this.Screen.Number, widgetWindowHandle, this.RootWindow.Handle); + _WindowInfo = XWindowInfoInitializer.Initialize(graphicsMode, this.Display.Handle, this.Screen.Number, widgetWindowHandle, this.Screen.RootWindow.Handle); // GraphicsContext _GraphicsContext = new GraphicsContext(graphicsMode, _WindowInfo, GlVersionMajor, GlVersionMinor, _GraphicsContextFlags); From f5acd206d75b2744a2d7a3a068520f3937d0e31d Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Sun, 18 Jun 2017 21:16:21 +0200 Subject: [PATCH 39/45] Set XVisualInfo to public. --- src/OpenTK.GLWidget/X11/XVisualClass.cs | 39 ---------------- src/OpenTK.GLWidget/X11/XVisualInfo.cs | 52 ---------------------- src/OpenTK.GLWidget/X11/XVisualInfoMask.cs | 47 ------------------- src/OpenTK/Platform/X11/API.cs | 50 ++++++++++----------- 4 files changed, 25 insertions(+), 163 deletions(-) delete mode 100644 src/OpenTK.GLWidget/X11/XVisualClass.cs delete mode 100644 src/OpenTK.GLWidget/X11/XVisualInfo.cs delete mode 100644 src/OpenTK.GLWidget/X11/XVisualInfoMask.cs diff --git a/src/OpenTK.GLWidget/X11/XVisualClass.cs b/src/OpenTK.GLWidget/X11/XVisualClass.cs deleted file mode 100644 index d22d973b..00000000 --- a/src/OpenTK.GLWidget/X11/XVisualClass.cs +++ /dev/null @@ -1,39 +0,0 @@ -// -// XVisualClass.cs -// -// The Open Toolkit Library License -// -// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted. -// -// 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. -// - -namespace OpenTK.X11 -{ - public enum XVisualClass - { - StaticGray = 0, - GrayScale = 1, - StaticColor = 2, - PseudoColor = 3, - TrueColor = 4, - DirectColor = 5 - } -} \ No newline at end of file diff --git a/src/OpenTK.GLWidget/X11/XVisualInfo.cs b/src/OpenTK.GLWidget/X11/XVisualInfo.cs deleted file mode 100644 index ad7544ab..00000000 --- a/src/OpenTK.GLWidget/X11/XVisualInfo.cs +++ /dev/null @@ -1,52 +0,0 @@ -// -// XVisualInfo.cs -// -// The Open Toolkit Library License -// -// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted. -// -// 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. -// - -using System; -using System.Runtime.InteropServices; - -namespace OpenTK.X11 -{ - [StructLayout(LayoutKind.Sequential)] - public 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 $"id ({this.VisualID}), screen ({this.Screen}), depth ({this.Depth}), class ({this.Class})"; - } - } -} \ No newline at end of file diff --git a/src/OpenTK.GLWidget/X11/XVisualInfoMask.cs b/src/OpenTK.GLWidget/X11/XVisualInfoMask.cs deleted file mode 100644 index 80565589..00000000 --- a/src/OpenTK.GLWidget/X11/XVisualInfoMask.cs +++ /dev/null @@ -1,47 +0,0 @@ -// -// XVisualInfoMask.cs -// -// The Open Toolkit Library License -// -// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted. -// -// 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. -// - -using System; - -namespace OpenTK.X11 -{ - [Flags] - public enum XVisualInfoMask - { - No = 0x0, - ID = 0x1, - Screen = 0x2, - Depth = 0x4, - Class = 0x8, - Red = 0x10, - Green = 0x20, - Blue = 0x40, - ColormapSize = 0x80, - BitsPerRGB = 0x100, - All = 0x1FF - } -} \ No newline at end of file diff --git a/src/OpenTK/Platform/X11/API.cs b/src/OpenTK/Platform/X11/API.cs index 9626e617..952a80e3 100644 --- a/src/OpenTK/Platform/X11/API.cs +++ b/src/OpenTK/Platform/X11/API.cs @@ -70,7 +70,7 @@ namespace OpenTK.Platform.X11 static int DefaultScreen { get { return defaultScreen; } } //internal static Window RootWindow { get { return rootWindow; } } internal static int ScreenCount { get { return screenCount; } } - + internal static object Lock = new object(); #endregion @@ -79,9 +79,9 @@ namespace OpenTK.Platform.X11 { int has_threaded_x = Functions.XInitThreads(); Debug.Print("Initializing threaded X11: {0}.", has_threaded_x.ToString()); - + defaultDisplay = Functions.XOpenDisplay(IntPtr.Zero); - + if (defaultDisplay == IntPtr.Zero) throw new PlatformException("Could not establish connection to the X-Server."); @@ -202,7 +202,7 @@ namespace OpenTK.Platform.X11 /// If a window is not interested in a device event, /// it usually propagates to the closest ancestor that is interested, /// unless the do_not_propagate mask prohibits it. - /// Setting the event-mask attribute of a window overrides any previous call for the same window but not for other clients. Multiple clients can select for the same events on the same window with the following restrictions: + /// Setting the event-mask attribute of a window overrides any previous call for the same window but not for other clients. Multiple clients can select for the same events on the same window with the following restrictions: /// Multiple clients can select events on the same window because their event masks are disjoint. When the X server generates an event, it reports it to all interested clients. /// Only one client at a time can select CirculateRequest, ConfigureRequest, or MapRequest events, which are associated with the event mask SubstructureRedirectMask. /// Only one client at a time can select a ResizeRequest event, which is associated with the event mask ResizeRedirectMask. @@ -343,7 +343,7 @@ namespace OpenTK.Platform.X11 public short htotal; /// - /// + /// /// public short hskew; @@ -368,7 +368,7 @@ namespace OpenTK.Platform.X11 public short vtotal; /// - /// + /// /// public short vskew; @@ -580,26 +580,26 @@ XF86VidModeGetGammaRampSize( public XcursorUInt delay; public XcursorPixel* pixels; } - + [StructLayout(LayoutKind.Sequential)] - unsafe struct XcursorImages + unsafe struct XcursorImages { public int nimage; public XcursorImage **images; public char *name; } - + [StructLayout(LayoutKind.Sequential)] - unsafe struct XcursorCursors + unsafe struct XcursorCursors { public Display dpy; public int refcount; public int ncursor; public Cursor *cursors; } - + [StructLayout(LayoutKind.Sequential)] - unsafe struct XcursorAnimate + unsafe struct XcursorAnimate { public XcursorCursors *cursors; public int sequence; @@ -607,10 +607,10 @@ XF86VidModeGetGammaRampSize( #endregion - #region internal class XVisualInfo + #region public class XVisualInfo [StructLayout(LayoutKind.Sequential)] - struct XVisualInfo + public struct XVisualInfo { public IntPtr Visual; public VisualID VisualID; @@ -755,7 +755,7 @@ XF86VidModeGetGammaRampSize( UIntPtr black_pixel; /* White and Black pixel values */ // unsigned long int max_maps, min_maps; /* max and min color maps */ int backing_store; /* Never, WhenMapped, Always */ - Bool save_unders; + Bool save_unders; long root_input_mask; /* initial root input mask */ } @@ -773,9 +773,9 @@ XF86VidModeGetGammaRampSize( }; #endregion - + #region Motif - + [StructLayout(LayoutKind.Sequential)] internal struct MotifWmHints { @@ -790,7 +790,7 @@ XF86VidModeGetGammaRampSize( return string.Format("MotifWmHints Specifies the structure from which the values (as specified by the value mask) are to be taken. The value mask should have the appropriate bits set to indicate which attributes have been set in the structure. /// The window ID of the created window. /// - /// The coordinate system has the X axis horizontal and the Y axis vertical with the origin [0, 0] at the upper-left corner. Coordinates are integral, in terms of pixels, and coincide with pixel centers. Each window and pixmap has its own coordinate system. For a window, the origin is inside the border at the inside, upper-left corner. + /// The coordinate system has the X axis horizontal and the Y axis vertical with the origin [0, 0] at the upper-left corner. Coordinates are integral, in terms of pixels, and coincide with pixel centers. Each window and pixmap has its own coordinate system. For a window, the origin is inside the border at the inside, upper-left corner. /// The border_width for an InputOnly window must be zero, or a BadMatch error results. For class InputOutput, the visual type and depth must be a combination supported for the screen, or a BadMatch error results. The depth need not be the same as the parent, but the parent must not be a window of class InputOnly, or a BadMatch error results. For an InputOnly window, the depth must be zero, and the visual must be one supported by the screen. If either condition is not met, a BadMatch error results. The parent window, however, may have any depth and class. If you specify any invalid window attribute for a window, a BadMatch error results. /// The created window is not yet displayed (mapped) on the user's display. To display the window, call XMapWindow(). The new window initially uses the same cursor as its parent. A new cursor can be defined for the new window by calling XDefineCursor(). The window will not be visible on the screen unless it and all of its ancestors are mapped and it is not obscured by any of its ancestors. /// XCreateWindow can generate BadAlloc BadColor, BadCursor, BadMatch, BadPixmap, BadValue, and BadWindow errors. @@ -1488,7 +1488,7 @@ XF86VidModeGetGammaRampSize( internal static unsafe extern void XcursorImageDestroy(XcursorImage* image); [DllImport(XcursorLibrary)] - internal static unsafe extern Cursor XcursorImageLoadCursor(Display dpy, XcursorImage* image); + internal static unsafe extern Cursor XcursorImageLoadCursor(Display dpy, XcursorImage* image); #endregion @@ -1538,7 +1538,7 @@ XF86VidModeGetGammaRampSize( /// Specifies the event. [DllImport(X11Library, EntryPoint = "XPutBackEvent")] public static extern void XPutBackEvent(IntPtr display, ref XEvent @event); - + #endregion #region Xrandr From ed53933e4d5955a50bfb043674ce5e9f92bda461 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Sun, 18 Jun 2017 21:17:00 +0200 Subject: [PATCH 40/45] Removed duplicate structures, and set to use already existing ones. --- src/OpenTK.GLWidget/OpenTK.GLWidget.csproj | 3 --- src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj b/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj index 384726f1..245b9696 100644 --- a/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj +++ b/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj @@ -144,9 +144,6 @@ - - - diff --git a/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs b/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs index 21bd3951..0458d8af 100644 --- a/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs +++ b/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs @@ -31,6 +31,7 @@ using System.Runtime.InteropServices; using System.Security; using OpenTK.Graphics; using OpenTK.Platform; +using OpenTK.Platform.X11; namespace OpenTK.X11 { From 5c8e485dbb52cc04c2501038587b3dfb85669c5e Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Sun, 18 Jun 2017 22:09:20 +0200 Subject: [PATCH 41/45] Removed license headers. --- src/OpenTK.GLWidget/GLWidget.cs | 29 +---------------- .../OSX/OSXWindowInfoInitializer.cs | 27 ---------------- .../Win/WinWindowsInfoInitializer.cs | 27 ---------------- src/OpenTK.GLWidget/X11/GLXAttribute.cs | 32 +------------------ .../X11/XWindowInfoInitializer.cs | 27 ---------------- 5 files changed, 2 insertions(+), 140 deletions(-) diff --git a/src/OpenTK.GLWidget/GLWidget.cs b/src/OpenTK.GLWidget/GLWidget.cs index cbe42b6b..ccf48873 100644 --- a/src/OpenTK.GLWidget/GLWidget.cs +++ b/src/OpenTK.GLWidget/GLWidget.cs @@ -1,31 +1,4 @@ -#region License -// -// The Open Toolkit Library License -// -// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted. -// -// 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; using System.Threading; using System.ComponentModel; diff --git a/src/OpenTK.GLWidget/OSX/OSXWindowInfoInitializer.cs b/src/OpenTK.GLWidget/OSX/OSXWindowInfoInitializer.cs index 1eaec2df..6df6802b 100644 --- a/src/OpenTK.GLWidget/OSX/OSXWindowInfoInitializer.cs +++ b/src/OpenTK.GLWidget/OSX/OSXWindowInfoInitializer.cs @@ -1,30 +1,3 @@ -// -// OSXWindowsInfoInitializer.cs -// -// The Open Toolkit Library License -// -// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted. -// -// 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. -// - using System; using System.Runtime.InteropServices; using System.Security; diff --git a/src/OpenTK.GLWidget/Win/WinWindowsInfoInitializer.cs b/src/OpenTK.GLWidget/Win/WinWindowsInfoInitializer.cs index 1c80d799..9ce66699 100644 --- a/src/OpenTK.GLWidget/Win/WinWindowsInfoInitializer.cs +++ b/src/OpenTK.GLWidget/Win/WinWindowsInfoInitializer.cs @@ -1,30 +1,3 @@ -// -// WinWindowsInfoInitializer.cs -// -// The Open Toolkit Library License -// -// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted. -// -// 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. -// - using System; using System.Runtime.InteropServices; using System.Security; diff --git a/src/OpenTK.GLWidget/X11/GLXAttribute.cs b/src/OpenTK.GLWidget/X11/GLXAttribute.cs index 30037c9c..1846188e 100644 --- a/src/OpenTK.GLWidget/X11/GLXAttribute.cs +++ b/src/OpenTK.GLWidget/X11/GLXAttribute.cs @@ -1,34 +1,4 @@ -// -// GLXAttribute.cs -// -// The Open Toolkit Library License -// -// Author: -// Jarl Gullberg -// -// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted. -// -// 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. -// - -namespace OpenTK.X11 +namespace OpenTK.X11 { public enum GLXAttribute { diff --git a/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs b/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs index 0458d8af..3f06e392 100644 --- a/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs +++ b/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs @@ -1,30 +1,3 @@ -// -// XWindowsInfoInitializer.cs -// -// The Open Toolkit Library License -// -// Copyright (c) 2006 - 2009 the Open Toolkit library, except where noted. -// -// 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. -// - using System; using System.Collections.Generic; using System.Runtime.InteropServices; From 5605b1fac2994fdac74c1bf53f99aeb31cda5faf Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Wed, 21 Jun 2017 18:28:36 +0200 Subject: [PATCH 42/45] Reindented with spaces instead of tabs. --- src/OpenTK.GLWidget/X11/GLXAttribute.cs | 42 ++++++++++++------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/src/OpenTK.GLWidget/X11/GLXAttribute.cs b/src/OpenTK.GLWidget/X11/GLXAttribute.cs index 1846188e..29dbe943 100644 --- a/src/OpenTK.GLWidget/X11/GLXAttribute.cs +++ b/src/OpenTK.GLWidget/X11/GLXAttribute.cs @@ -1,24 +1,24 @@ namespace OpenTK.X11 { - public enum GLXAttribute - { - None = 0, - UseGL = 1, - BufferSize = 2, - Level = 3, - RGBA = 4, - DoubleBuffer = 5, - Stereo = 6, - AuxBuffers = 7, - RedSize = 8, - GreenSize = 9, - BlueSize = 10, - AlphaSize = 11, - DepthSize = 12, - StencilSize = 13, - AccumRedSize = 14, - AccumGreenSize = 15, - AccumBlueSize = 16, - AccumAlphaSize = 17 - } + public enum GLXAttribute + { + None = 0, + UseGL = 1, + BufferSize = 2, + Level = 3, + RGBA = 4, + DoubleBuffer = 5, + Stereo = 6, + AuxBuffers = 7, + RedSize = 8, + GreenSize = 9, + BlueSize = 10, + AlphaSize = 11, + DepthSize = 12, + StencilSize = 13, + AccumRedSize = 14, + AccumGreenSize = 15, + AccumBlueSize = 16, + AccumAlphaSize = 17 + } } \ No newline at end of file From 2f1e49c66707896861646f701017c8db849bc88a Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Sun, 25 Jun 2017 13:44:01 +0200 Subject: [PATCH 43/45] Set GLXAttribute access to public. --- src/OpenTK/Platform/X11/Bindings/Glx.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/OpenTK/Platform/X11/Bindings/Glx.cs b/src/OpenTK/Platform/X11/Bindings/Glx.cs index aa03e91d..4bc2e0aa 100644 --- a/src/OpenTK/Platform/X11/Bindings/Glx.cs +++ b/src/OpenTK/Platform/X11/Bindings/Glx.cs @@ -17,7 +17,7 @@ namespace OpenTK.Platform.X11 { #region Enums - enum GLXAttribute : int + public enum GLXAttribute : int { TRANSPARENT_BLUE_VALUE_EXT = 0x27, GRAY_SCALE = 0x8006, @@ -364,7 +364,7 @@ namespace OpenTK.Platform.X11 [DllImport(Library, EntryPoint = "glXCreateContext")] public static extern IntPtr CreateContext(IntPtr dpy, ref XVisualInfo vis, IntPtr shareList, bool direct); - + [DllImport(Library, EntryPoint = "glXDestroyContext")] public static extern void DestroyContext(IntPtr dpy, IntPtr context); From 2186ad22930578699435408a74bb0692f33f8773 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Sun, 25 Jun 2017 13:44:19 +0200 Subject: [PATCH 44/45] Removed bundled GLXAttribute enum. --- src/OpenTK.GLWidget/OpenTK.GLWidget.csproj | 1 - src/OpenTK.GLWidget/X11/GLXAttribute.cs | 24 ----------------- .../X11/XWindowInfoInitializer.cs | 26 +++++++++---------- 3 files changed, 13 insertions(+), 38 deletions(-) delete mode 100644 src/OpenTK.GLWidget/X11/GLXAttribute.cs diff --git a/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj b/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj index 245b9696..67028445 100644 --- a/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj +++ b/src/OpenTK.GLWidget/OpenTK.GLWidget.csproj @@ -143,7 +143,6 @@ - diff --git a/src/OpenTK.GLWidget/X11/GLXAttribute.cs b/src/OpenTK.GLWidget/X11/GLXAttribute.cs deleted file mode 100644 index 29dbe943..00000000 --- a/src/OpenTK.GLWidget/X11/GLXAttribute.cs +++ /dev/null @@ -1,24 +0,0 @@ -namespace OpenTK.X11 -{ - public enum GLXAttribute - { - None = 0, - UseGL = 1, - BufferSize = 2, - Level = 3, - RGBA = 4, - DoubleBuffer = 5, - Stereo = 6, - AuxBuffers = 7, - RedSize = 8, - GreenSize = 9, - BlueSize = 10, - AlphaSize = 11, - DepthSize = 12, - StencilSize = 13, - AccumRedSize = 14, - AccumGreenSize = 15, - AccumBlueSize = 16, - AccumAlphaSize = 17 - } -} \ No newline at end of file diff --git a/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs b/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs index 3f06e392..b2312b0d 100644 --- a/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs +++ b/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs @@ -95,48 +95,48 @@ namespace OpenTK.X11 if (mode.Buffers > 1) { - attributeList.Add((int)GLXAttribute.DoubleBuffer); + attributeList.Add((int)GLXAttribute.DOUBLEBUFFER); } if (mode.Stereo) { - attributeList.Add((int)GLXAttribute.Stereo); + attributeList.Add((int)GLXAttribute.STEREO); } - attributeList.Add((int)GLXAttribute.RedSize); + attributeList.Add((int)GLXAttribute.RED_SIZE); attributeList.Add(mode.ColorFormat.Red / 4); // TODO support 16-bit - attributeList.Add((int)GLXAttribute.GreenSize); + attributeList.Add((int)GLXAttribute.GREEN_SIZE); attributeList.Add(mode.ColorFormat.Green / 4); // TODO support 16-bit - attributeList.Add((int)GLXAttribute.BlueSize); + attributeList.Add((int)GLXAttribute.BLUE_SIZE); attributeList.Add(mode.ColorFormat.Blue / 4); // TODO support 16-bit - attributeList.Add((int)GLXAttribute.AlphaSize); + attributeList.Add((int)GLXAttribute.ALPHA_SIZE); attributeList.Add(mode.ColorFormat.Alpha / 4); // TODO support 16-bit - attributeList.Add((int)GLXAttribute.DepthSize); + attributeList.Add((int)GLXAttribute.DEPTH_SIZE); attributeList.Add(mode.Depth); - attributeList.Add((int)GLXAttribute.StencilSize); + attributeList.Add((int)GLXAttribute.STENCIL_SIZE); attributeList.Add(mode.Stencil); //attributeList.Add(GLX_AUX_BUFFERS); //attributeList.Add(Buffers); - attributeList.Add((int)GLXAttribute.AccumRedSize); + attributeList.Add((int)GLXAttribute.ACCUM_RED_SIZE); attributeList.Add(mode.AccumulatorFormat.Red / 4);// TODO support 16-bit - attributeList.Add((int)GLXAttribute.AccumGreenSize); + attributeList.Add((int)GLXAttribute.ACCUM_GREEN_SIZE); attributeList.Add(mode.AccumulatorFormat.Green / 4);// TODO support 16-bit - attributeList.Add((int)GLXAttribute.AccumBlueSize); + attributeList.Add((int)GLXAttribute.ACCUM_BLUE_SIZE); attributeList.Add(mode.AccumulatorFormat.Blue / 4);// TODO support 16-bit - attributeList.Add((int)GLXAttribute.AccumAlphaSize); + attributeList.Add((int)GLXAttribute.ACCUM_ALPHA_SIZE); attributeList.Add(mode.AccumulatorFormat.Alpha / 4);// TODO support 16-bit - attributeList.Add((int)GLXAttribute.None); + attributeList.Add((int)GLXAttribute.NONE); return attributeList; } From 9309889a1aa045e60e29c7182b938f26bbae14d5 Mon Sep 17 00:00:00 2001 From: Jarl Gullberg Date: Sun, 25 Jun 2017 13:49:04 +0200 Subject: [PATCH 45/45] Corrected usages of tabs instead of spaces. --- .../OSX/OSXWindowInfoInitializer.cs | 36 +-- .../Win/WinWindowsInfoInitializer.cs | 30 +-- .../X11/XWindowInfoInitializer.cs | 238 +++++++++--------- 3 files changed, 152 insertions(+), 152 deletions(-) diff --git a/src/OpenTK.GLWidget/OSX/OSXWindowInfoInitializer.cs b/src/OpenTK.GLWidget/OSX/OSXWindowInfoInitializer.cs index 6df6802b..fd1c27ba 100644 --- a/src/OpenTK.GLWidget/OSX/OSXWindowInfoInitializer.cs +++ b/src/OpenTK.GLWidget/OSX/OSXWindowInfoInitializer.cs @@ -9,30 +9,30 @@ namespace OpenTK.OSX /// Handler class for initializing objects under the OSX platform for both GTK2 and /// GTK3. /// - public static class OSXWindowInfoInitializer - { + public static class OSXWindowInfoInitializer + { #if GTK3 - const string OSXLibGdkName = "libgdk-3.dylib"; + const string OSXLibGdkName = "libgdk-3.dylib"; #else const string OSXLibGdkName = "libgdk-quartz-2.0.0.dylib"; #endif - /// - /// Initializes an under the OSX platform. - /// - /// - public static IWindowInfo Initialize(IntPtr gdkWindowHandle) - { - IntPtr windowHandle = gdk_quartz_window_get_nswindow(gdkWindowHandle); - IntPtr viewHandle = gdk_quartz_window_get_nsview(gdkWindowHandle); + /// + /// Initializes an under the OSX platform. + /// + /// + public static IWindowInfo Initialize(IntPtr gdkWindowHandle) + { + IntPtr windowHandle = gdk_quartz_window_get_nswindow(gdkWindowHandle); + IntPtr viewHandle = gdk_quartz_window_get_nsview(gdkWindowHandle); - return Utilities.CreateMacOSWindowInfo(windowHandle, viewHandle); - } + return Utilities.CreateMacOSWindowInfo(windowHandle, viewHandle); + } - [SuppressUnmanagedCodeSecurity, DllImport(OSXLibGdkName)] - private static extern IntPtr gdk_quartz_window_get_nswindow(IntPtr handle); + [SuppressUnmanagedCodeSecurity, DllImport(OSXLibGdkName)] + private static extern IntPtr gdk_quartz_window_get_nswindow(IntPtr handle); - [SuppressUnmanagedCodeSecurity, DllImport(OSXLibGdkName)] - private static extern IntPtr gdk_quartz_window_get_nsview(IntPtr handle); - } + [SuppressUnmanagedCodeSecurity, DllImport(OSXLibGdkName)] + private static extern IntPtr gdk_quartz_window_get_nsview(IntPtr handle); + } } \ No newline at end of file diff --git a/src/OpenTK.GLWidget/Win/WinWindowsInfoInitializer.cs b/src/OpenTK.GLWidget/Win/WinWindowsInfoInitializer.cs index 9ce66699..814267fa 100644 --- a/src/OpenTK.GLWidget/Win/WinWindowsInfoInitializer.cs +++ b/src/OpenTK.GLWidget/Win/WinWindowsInfoInitializer.cs @@ -9,35 +9,35 @@ namespace OpenTK.Win /// Handler class for initializing objects under the Windows platform for both GTK2 and /// GTK3. /// - public static class WinWindowsInfoInitializer - { + public static class WinWindowsInfoInitializer + { #if GTK3 - private const string WinLibGDKName = "libgdk-3-0.dll"; + private const string WinLibGDKName = "libgdk-3-0.dll"; #else private const string WinLibGDKName = "libgdk-win32-2.0-0.dll"; #endif - /// - /// Initializes an under the Windows platform. - /// - /// - public static IWindowInfo Initialize(IntPtr gdkWindowHandle) - { + /// + /// Initializes an under the Windows platform. + /// + /// + public static IWindowInfo Initialize(IntPtr gdkWindowHandle) + { #if GTK3 - IntPtr windowHandle = gdk_win32_window_get_handle(gdkWindowHandle); + IntPtr windowHandle = gdk_win32_window_get_handle(gdkWindowHandle); #else IntPtr windowHandle = gdk_win32_drawable_get_handle(gdkWindowHandle); #endif - return Utilities.CreateWindowsWindowInfo(windowHandle); - } + return Utilities.CreateWindowsWindowInfo(windowHandle); + } #if GTK3 - [SuppressUnmanagedCodeSecurity, DllImport(WinLibGDKName, CallingConvention = CallingConvention.Cdecl)] - static extern IntPtr gdk_win32_window_get_handle(IntPtr w); + [SuppressUnmanagedCodeSecurity, DllImport(WinLibGDKName, CallingConvention = CallingConvention.Cdecl)] + static extern IntPtr gdk_win32_window_get_handle(IntPtr w); #else [SuppressUnmanagedCodeSecurity, DllImport(WinLibGDKName, CallingConvention = CallingConvention.Cdecl)] static extern IntPtr gdk_win32_drawable_get_handle(IntPtr d); #endif - } + } } \ No newline at end of file diff --git a/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs b/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs index b2312b0d..f81c8ccc 100644 --- a/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs +++ b/src/OpenTK.GLWidget/X11/XWindowInfoInitializer.cs @@ -11,165 +11,165 @@ namespace OpenTK.X11 /// /// Handler class for initializing objects under the X11 platform for both GTK2 and GTK3. /// - public static class XWindowInfoInitializer - { + public static class XWindowInfoInitializer + { #if GTK3 - const string UnixLibGdkName = "libgdk-3.so.0"; + const string UnixLibGdkName = "libgdk-3.so.0"; #else const string UnixLibGdkName = "libgdk-x11-2.0.so.0"; #endif - private const string UnixLibX11Name = "libX11.so.6"; - private const string UnixLibGLName = "libGL.so.1"; + private const string UnixLibX11Name = "libX11.so.6"; + private const string UnixLibGLName = "libGL.so.1"; - /// - /// Initializes an under the X11 platform. - /// - /// - /// - /// - /// - /// - /// - public static IWindowInfo Initialize(GraphicsMode mode, IntPtr displayHandle, int screenNumber, IntPtr gdkWindowHandle, IntPtr gdkRootWindowHandle) - { - IntPtr display = gdk_x11_display_get_xdisplay(displayHandle); + /// + /// Initializes an under the X11 platform. + /// + /// + /// + /// + /// + /// + /// + public static IWindowInfo Initialize(GraphicsMode mode, IntPtr displayHandle, int screenNumber, IntPtr gdkWindowHandle, IntPtr gdkRootWindowHandle) + { + IntPtr display = gdk_x11_display_get_xdisplay(displayHandle); #if GTK3 - IntPtr windowXid = gdk_x11_window_get_xid(gdkWindowHandle); - IntPtr rootWindowXid = gdk_x11_window_get_xid(gdkRootWindowHandle); + IntPtr windowXid = gdk_x11_window_get_xid(gdkWindowHandle); + IntPtr rootWindowXid = gdk_x11_window_get_xid(gdkRootWindowHandle); #else IntPtr windowXid = gdk_x11_drawable_get_xid(gdkWindowHandle); IntPtr rootWindowXid = gdk_x11_drawable_get_xid(gdkRootWindowHandle); #endif - IntPtr visualInfo; - if (mode.Index.HasValue) - { - XVisualInfo info = new XVisualInfo - { - VisualID = mode.Index.Value - }; + IntPtr visualInfo; + if (mode.Index.HasValue) + { + XVisualInfo info = new XVisualInfo + { + VisualID = mode.Index.Value + }; - int dummy; - visualInfo = XGetVisualInfo(display, XVisualInfoMask.ID, ref info, out dummy); - } - else - { - visualInfo = GetVisualInfo(mode, display, screenNumber); - } + int dummy; + visualInfo = XGetVisualInfo(display, XVisualInfoMask.ID, ref info, out dummy); + } + else + { + visualInfo = GetVisualInfo(mode, display, screenNumber); + } - IWindowInfo retval = Utilities.CreateX11WindowInfo(display, screenNumber, windowXid, rootWindowXid, visualInfo); - XFree(visualInfo); + IWindowInfo retval = Utilities.CreateX11WindowInfo(display, screenNumber, windowXid, rootWindowXid, visualInfo); + XFree(visualInfo); - return retval; - } + return retval; + } - private static IntPtr XGetVisualInfo(IntPtr display, XVisualInfoMask infoMask, ref XVisualInfo template, out int nitems) - { - return XGetVisualInfoInternal(display, (IntPtr)(int)infoMask, ref template, out nitems); - } + private static IntPtr XGetVisualInfo(IntPtr display, XVisualInfoMask infoMask, ref XVisualInfo template, out int nitems) + { + return XGetVisualInfoInternal(display, (IntPtr)(int)infoMask, ref template, out nitems); + } - private static IntPtr GetVisualInfo(GraphicsMode mode, IntPtr display, int screenNumber) - { - try - { - int[] attributes = CreateAttributeList(mode).ToArray(); - return glXChooseVisual(display, screenNumber, attributes); - } - catch (DllNotFoundException e) - { - throw new DllNotFoundException("OpenGL dll not found!", e); - } - catch (EntryPointNotFoundException enf) - { - throw new EntryPointNotFoundException("Glx entry point not found!", enf); - } - } + private static IntPtr GetVisualInfo(GraphicsMode mode, IntPtr display, int screenNumber) + { + try + { + int[] attributes = CreateAttributeList(mode).ToArray(); + return glXChooseVisual(display, screenNumber, attributes); + } + catch (DllNotFoundException e) + { + throw new DllNotFoundException("OpenGL dll not found!", e); + } + catch (EntryPointNotFoundException enf) + { + throw new EntryPointNotFoundException("Glx entry point not found!", enf); + } + } - private static List CreateAttributeList(GraphicsMode mode) - { - List attributeList = new List(24); + private static List CreateAttributeList(GraphicsMode mode) + { + List attributeList = new List(24); - attributeList.Add((int)GLXAttribute.RGBA); + attributeList.Add((int)GLXAttribute.RGBA); - if (mode.Buffers > 1) - { - attributeList.Add((int)GLXAttribute.DOUBLEBUFFER); - } + if (mode.Buffers > 1) + { + attributeList.Add((int)GLXAttribute.DOUBLEBUFFER); + } - if (mode.Stereo) - { - attributeList.Add((int)GLXAttribute.STEREO); - } + if (mode.Stereo) + { + attributeList.Add((int)GLXAttribute.STEREO); + } - attributeList.Add((int)GLXAttribute.RED_SIZE); - attributeList.Add(mode.ColorFormat.Red / 4); // TODO support 16-bit + attributeList.Add((int)GLXAttribute.RED_SIZE); + attributeList.Add(mode.ColorFormat.Red / 4); // TODO support 16-bit - attributeList.Add((int)GLXAttribute.GREEN_SIZE); - attributeList.Add(mode.ColorFormat.Green / 4); // TODO support 16-bit + attributeList.Add((int)GLXAttribute.GREEN_SIZE); + attributeList.Add(mode.ColorFormat.Green / 4); // TODO support 16-bit - attributeList.Add((int)GLXAttribute.BLUE_SIZE); - attributeList.Add(mode.ColorFormat.Blue / 4); // TODO support 16-bit + attributeList.Add((int)GLXAttribute.BLUE_SIZE); + attributeList.Add(mode.ColorFormat.Blue / 4); // TODO support 16-bit - attributeList.Add((int)GLXAttribute.ALPHA_SIZE); - attributeList.Add(mode.ColorFormat.Alpha / 4); // TODO support 16-bit + attributeList.Add((int)GLXAttribute.ALPHA_SIZE); + attributeList.Add(mode.ColorFormat.Alpha / 4); // TODO support 16-bit - attributeList.Add((int)GLXAttribute.DEPTH_SIZE); - attributeList.Add(mode.Depth); + attributeList.Add((int)GLXAttribute.DEPTH_SIZE); + attributeList.Add(mode.Depth); - attributeList.Add((int)GLXAttribute.STENCIL_SIZE); - attributeList.Add(mode.Stencil); + attributeList.Add((int)GLXAttribute.STENCIL_SIZE); + attributeList.Add(mode.Stencil); - //attributeList.Add(GLX_AUX_BUFFERS); - //attributeList.Add(Buffers); + //attributeList.Add(GLX_AUX_BUFFERS); + //attributeList.Add(Buffers); - attributeList.Add((int)GLXAttribute.ACCUM_RED_SIZE); - attributeList.Add(mode.AccumulatorFormat.Red / 4);// TODO support 16-bit + attributeList.Add((int)GLXAttribute.ACCUM_RED_SIZE); + attributeList.Add(mode.AccumulatorFormat.Red / 4);// TODO support 16-bit - attributeList.Add((int)GLXAttribute.ACCUM_GREEN_SIZE); - attributeList.Add(mode.AccumulatorFormat.Green / 4);// TODO support 16-bit + attributeList.Add((int)GLXAttribute.ACCUM_GREEN_SIZE); + attributeList.Add(mode.AccumulatorFormat.Green / 4);// TODO support 16-bit - attributeList.Add((int)GLXAttribute.ACCUM_BLUE_SIZE); - attributeList.Add(mode.AccumulatorFormat.Blue / 4);// TODO support 16-bit + attributeList.Add((int)GLXAttribute.ACCUM_BLUE_SIZE); + attributeList.Add(mode.AccumulatorFormat.Blue / 4);// TODO support 16-bit - attributeList.Add((int)GLXAttribute.ACCUM_ALPHA_SIZE); - attributeList.Add(mode.AccumulatorFormat.Alpha / 4);// TODO support 16-bit + attributeList.Add((int)GLXAttribute.ACCUM_ALPHA_SIZE); + attributeList.Add(mode.AccumulatorFormat.Alpha / 4);// TODO support 16-bit - attributeList.Add((int)GLXAttribute.NONE); + attributeList.Add((int)GLXAttribute.NONE); - return attributeList; - } + return attributeList; + } - [DllImport(UnixLibX11Name, EntryPoint = "XGetVisualInfo")] - private static extern IntPtr XGetVisualInfoInternal(IntPtr display, IntPtr infoMask, ref XVisualInfo template, out int nitems); + [DllImport(UnixLibX11Name, EntryPoint = "XGetVisualInfo")] + private static extern IntPtr XGetVisualInfoInternal(IntPtr display, IntPtr infoMask, ref XVisualInfo template, out int nitems); - [SuppressUnmanagedCodeSecurity, DllImport(UnixLibX11Name)] - private static extern void XFree(IntPtr handle); + [SuppressUnmanagedCodeSecurity, DllImport(UnixLibX11Name)] + private static extern void XFree(IntPtr handle); #if GTK3 - /// Returns the X resource (window or pixmap) belonging to a GdkWindow. - /// XID gdk_x11_window_get_xid(GdkWindow *drawable); - /// The GdkDrawable. - /// The ID of window's X resource. - [SuppressUnmanagedCodeSecurity, DllImport(UnixLibGdkName)] - private static extern IntPtr gdk_x11_window_get_xid(IntPtr gdkDisplay); + /// Returns the X resource (window or pixmap) belonging to a GdkWindow. + /// XID gdk_x11_window_get_xid(GdkWindow *drawable); + /// The GdkDrawable. + /// The ID of window's X resource. + [SuppressUnmanagedCodeSecurity, DllImport(UnixLibGdkName)] + private static extern IntPtr gdk_x11_window_get_xid(IntPtr gdkDisplay); #else - /// Returns the X resource (window or pixmap) belonging to a GdkDrawable. - /// XID gdk_x11_drawable_get_xid(GdkDrawable *drawable); - /// The GdkDrawable. - /// The ID of drawable's X resource. - [SuppressUnmanagedCodeSecurity, DllImport(UnixLibGdkName)] - static extern IntPtr gdk_x11_drawable_get_xid(IntPtr gdkDisplay); + /// Returns the X resource (window or pixmap) belonging to a GdkDrawable. + /// XID gdk_x11_drawable_get_xid(GdkDrawable *drawable); + /// The GdkDrawable. + /// The ID of drawable's X resource. + [SuppressUnmanagedCodeSecurity, DllImport(UnixLibGdkName)] + static extern IntPtr gdk_x11_drawable_get_xid(IntPtr gdkDisplay); #endif - /// Returns the X display of a GdkDisplay. - /// Display* gdk_x11_display_get_xdisplay(GdkDisplay *display); - /// The GdkDrawable. - /// The X Display of the GdkDisplay. - [SuppressUnmanagedCodeSecurity, DllImport(UnixLibGdkName)] - private static extern IntPtr gdk_x11_display_get_xdisplay(IntPtr gdkDisplay); + /// Returns the X display of a GdkDisplay. + /// Display* gdk_x11_display_get_xdisplay(GdkDisplay *display); + /// The GdkDrawable. + /// The X Display of the GdkDisplay. + [SuppressUnmanagedCodeSecurity, DllImport(UnixLibGdkName)] + private static extern IntPtr gdk_x11_display_get_xdisplay(IntPtr gdkDisplay); - [SuppressUnmanagedCodeSecurity, DllImport(UnixLibGLName)] - private static extern IntPtr glXChooseVisual(IntPtr display, int screen, int[] attr); - } + [SuppressUnmanagedCodeSecurity, DllImport(UnixLibGLName)] + private static extern IntPtr glXChooseVisual(IntPtr display, int screen, int[] attr); + } } \ No newline at end of file