diff --git a/GLWidget/GLWidget.cs b/GLWidget/GLWidget.cs
index 511c645..175b6e1 100644
--- a/GLWidget/GLWidget.cs
+++ b/GLWidget/GLWidget.cs
@@ -51,10 +51,12 @@ namespace OpenTK
[ToolboxItem(true)]
public class GLWidget : DrawingArea
{
- ///
- /// Get or set the OpenGL minimum color buffer bits.
- ///
- [Property("color-bits")]
+ private static bool xThreadInit;
+
+ ///
+ /// Get or set the OpenGL minimum color buffer bits.
+ ///
+ [Property("color-bits")]
public uint ColorBits
{
get { return (_ColorBits); }
@@ -194,7 +196,7 @@ namespace OpenTK
/// Constructs a new GLWidget
public GLWidget(Version apiVersion, bool forwardCompatible)
{
- GLVersionMajor = apiVersion.Major;
+ GLVersionMajor = apiVersion.Major;
GLVersionMinor = apiVersion.Minor;
ForwardCompatible = forwardCompatible;
}
diff --git a/GLWidget/GLWidget.csproj b/GLWidget/GLWidget.csproj
index fdba1f2..9225855 100644
--- a/GLWidget/GLWidget.csproj
+++ b/GLWidget/GLWidget.csproj
@@ -3,7 +3,7 @@
netcoreapp3.0
true
GLWigdet for GTKSharp, using Opentk.
- 1.0.3-pre1
+ 1.0.3.2
https://github.com/Ryujinx/GLWidget
diff --git a/GLWidget/GTKBindingHelper.cs b/GLWidget/GTKBindingHelper.cs
index 7e16306..2329753 100644
--- a/GLWidget/GTKBindingHelper.cs
+++ b/GLWidget/GTKBindingHelper.cs
@@ -30,7 +30,7 @@ namespace OpenTK
}
public static bool Loaded;
-
+ private static bool _threadsInitialized;
private const string GlxLibrary = "libGL.so.1";
private const string WglLibrary = "opengl32.dll";
private const string OSXLibrary = "libdl.dylib";
@@ -210,6 +210,21 @@ namespace OpenTK
return symbol;
}
+ public static void InitXThreads()
+ {
+ if (_threadsInitialized)
+ {
+ return;
+ }
+
+ if (CurrentPlatform == OSPlatform.Linux)
+ {
+ _threadsInitialized = true;
+
+ UnsafeNativeMethods.XInitThreads();
+ }
+ }
+
internal static class UnsafeNativeMethods
{
[DllImport("kernel32.dll", SetLastError = true)]
@@ -242,6 +257,9 @@ namespace OpenTK
[DllImport(OSXLibrary, EntryPoint = "NSAddressOfSymbol")]
public static extern IntPtr NSAddressOfSymbol(IntPtr symbol);
+ [DllImport("libX11.so.6")]
+ public extern static int XInitThreads();
+
[DllImport(OSXLibrary)]
public extern static int CGLSetCurrentContext(IntPtr ctx);
diff --git a/GLWidgetTestGTK3/Program.cs b/GLWidgetTestGTK3/Program.cs
index af8641a..f70e6bd 100644
--- a/GLWidgetTestGTK3/Program.cs
+++ b/GLWidgetTestGTK3/Program.cs
@@ -1,5 +1,6 @@
using System;
using System.Reflection;
+using System.Runtime.InteropServices;
using Gtk;
using OpenTK;
@@ -9,6 +10,7 @@ namespace GLWidgetTestGTK3
{
public static void Main(string[] args)
{
+ GTKBindingHelper.InitXThreads();
// GTK
Application.Init();
MainWindow win = MainWindow.Create();