mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-26 04:05:36 +00:00
Updates to GameWindow shutdown and X11 locking behavior.
This commit is contained in:
parent
db29304aa8
commit
76825a36c7
|
@ -276,6 +276,7 @@ namespace OpenTK
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public virtual void Exit()
|
public virtual void Exit()
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
//glWindow.DestroyWindow();
|
//glWindow.DestroyWindow();
|
||||||
//while (glWindow.Exists)
|
//while (glWindow.Exists)
|
||||||
// glWindow.ProcessEvents();
|
// glWindow.ProcessEvents();
|
||||||
|
@ -302,6 +303,7 @@ namespace OpenTK
|
||||||
public virtual void ExitAsync()
|
public virtual void ExitAsync()
|
||||||
{
|
{
|
||||||
//isExiting = true;
|
//isExiting = true;
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
UpdateFrame += CallExitInternal;
|
UpdateFrame += CallExitInternal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,7 +317,7 @@ namespace OpenTK
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsIdle
|
public bool IsIdle
|
||||||
{
|
{
|
||||||
get { return glWindow.IsIdle; }
|
get { if (disposed) throw new ObjectDisposedException("GameWindow"); return glWindow.IsIdle; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -328,8 +330,8 @@ namespace OpenTK
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool Fullscreen
|
public bool Fullscreen
|
||||||
{
|
{
|
||||||
get { return glWindow.Fullscreen; }
|
get { if (disposed) throw new ObjectDisposedException("GameWindow"); return glWindow.Fullscreen; }
|
||||||
set { glWindow.Fullscreen = value; }
|
set { if (disposed) throw new ObjectDisposedException("GameWindow"); glWindow.Fullscreen = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -337,12 +339,15 @@ namespace OpenTK
|
||||||
#region public IGraphicsContext Context
|
#region public IGraphicsContext Context
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Returns the opengl IGLontext associated with the current GameWindow.
|
/// Returns the opengl IGraphicsContext associated with the current GameWindow.
|
||||||
/// Forces window creation.
|
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IGraphicsContext Context
|
public IGraphicsContext Context
|
||||||
{
|
{
|
||||||
get { return glContext; }
|
get
|
||||||
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
|
return glContext;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -368,10 +373,12 @@ namespace OpenTK
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
return glWindow.Title;
|
return glWindow.Title;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
glWindow.Title = value;
|
glWindow.Title = value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -404,7 +411,7 @@ namespace OpenTK
|
||||||
|
|
||||||
public IWindowInfo WindowInfo
|
public IWindowInfo WindowInfo
|
||||||
{
|
{
|
||||||
get { return glWindow.WindowInfo; }
|
get { if (disposed) throw new ObjectDisposedException("GameWindow"); return glWindow.WindowInfo; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -437,6 +444,7 @@ namespace OpenTK
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void DestroyWindow()
|
public void DestroyWindow()
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
if (Exists)
|
if (Exists)
|
||||||
glWindow.DestroyWindow();
|
glWindow.DestroyWindow();
|
||||||
else
|
else
|
||||||
|
@ -453,6 +461,7 @@ namespace OpenTK
|
||||||
/// <see cref="public virtual void Run(double update_frequency, double render_frequency)"/>
|
/// <see cref="public virtual void Run(double update_frequency, double render_frequency)"/>
|
||||||
public void Run()
|
public void Run()
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
Run(0.0, 0.0);
|
Run(0.0, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -463,6 +472,7 @@ namespace OpenTK
|
||||||
/// <see cref="public virtual void Run(double updateFrequency, double renderFrequency)"/>
|
/// <see cref="public virtual void Run(double updateFrequency, double renderFrequency)"/>
|
||||||
public void Run(double updateFrequency)
|
public void Run(double updateFrequency)
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
Run(updateFrequency, 0.0);
|
Run(updateFrequency, 0.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -473,6 +483,7 @@ namespace OpenTK
|
||||||
/// <param name="frames_per_second">The frequency of RenderFrame events.</param>
|
/// <param name="frames_per_second">The frequency of RenderFrame events.</param>
|
||||||
public void Run(double updates_per_second, double frames_per_second)
|
public void Run(double updates_per_second, double frames_per_second)
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (updates_per_second < 0.0 || updates_per_second > 200.0)
|
if (updates_per_second < 0.0 || updates_per_second > 200.0)
|
||||||
|
@ -618,6 +629,7 @@ namespace OpenTK
|
||||||
if (Exists)
|
if (Exists)
|
||||||
{
|
{
|
||||||
glContext.Dispose();
|
glContext.Dispose();
|
||||||
|
glContext = null;
|
||||||
glWindow.DestroyWindow();
|
glWindow.DestroyWindow();
|
||||||
}
|
}
|
||||||
while (this.Exists)
|
while (this.Exists)
|
||||||
|
@ -642,6 +654,7 @@ namespace OpenTK
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public void ProcessEvents()
|
public void ProcessEvents()
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
if (!isExiting)
|
if (!isExiting)
|
||||||
glWindow.InputDriver.Poll();
|
glWindow.InputDriver.Poll();
|
||||||
glWindow.ProcessEvents();
|
glWindow.ProcessEvents();
|
||||||
|
@ -680,6 +693,7 @@ namespace OpenTK
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public virtual void OnRenderFrame(RenderFrameEventArgs e)
|
public virtual void OnRenderFrame(RenderFrameEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -718,6 +732,7 @@ namespace OpenTK
|
||||||
/// </remarks>
|
/// </remarks>
|
||||||
public virtual void OnUpdateFrame(UpdateFrameEventArgs e)
|
public virtual void OnUpdateFrame(UpdateFrameEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -768,6 +783,7 @@ namespace OpenTK
|
||||||
/// <param name="e">Not used.</param>
|
/// <param name="e">Not used.</param>
|
||||||
public virtual void OnLoad(EventArgs e)
|
public virtual void OnLoad(EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -800,6 +816,7 @@ namespace OpenTK
|
||||||
/// <param name="e">Not used.</param>
|
/// <param name="e">Not used.</param>
|
||||||
public virtual void OnUnload(EventArgs e)
|
public virtual void OnUnload(EventArgs e)
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -814,7 +831,7 @@ namespace OpenTK
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsExiting
|
public bool IsExiting
|
||||||
{
|
{
|
||||||
get { return isExiting; }
|
get { if (disposed) throw new ObjectDisposedException("GameWindow"); return isExiting; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -828,6 +845,7 @@ namespace OpenTK
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
//if (input_driver.Keyboard.Count > 0)
|
//if (input_driver.Keyboard.Count > 0)
|
||||||
// return input_driver.Keyboard[0];
|
// return input_driver.Keyboard[0];
|
||||||
//else
|
//else
|
||||||
|
@ -851,6 +869,7 @@ namespace OpenTK
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
//if (input_driver.Mouse.Count > 0)
|
//if (input_driver.Mouse.Count > 0)
|
||||||
// return input_driver.Mouse[0];
|
// return input_driver.Mouse[0];
|
||||||
//else
|
//else
|
||||||
|
@ -874,10 +893,12 @@ namespace OpenTK
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
return vsync;
|
return vsync;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
if (value == VSyncMode.Off)
|
if (value == VSyncMode.Off)
|
||||||
Context.VSync = false;
|
Context.VSync = false;
|
||||||
else
|
else
|
||||||
|
@ -898,6 +919,7 @@ namespace OpenTK
|
||||||
/// <remarks>Calling this function is equivalent to calling Context.SwapBuffers()</remarks>
|
/// <remarks>Calling this function is equivalent to calling Context.SwapBuffers()</remarks>
|
||||||
public void SwapBuffers()
|
public void SwapBuffers()
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
this.Context.SwapBuffers();
|
this.Context.SwapBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -931,10 +953,12 @@ namespace OpenTK
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
return target_render_period;
|
return target_render_period;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
if (value <= 0.005)
|
if (value <= 0.005)
|
||||||
{
|
{
|
||||||
target_render_period = target_render_period_doubled = 0.0;
|
target_render_period = target_render_period_doubled = 0.0;
|
||||||
|
@ -963,12 +987,14 @@ namespace OpenTK
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
if (TargetRenderPeriod == 0.0)
|
if (TargetRenderPeriod == 0.0)
|
||||||
return 0.0;
|
return 0.0;
|
||||||
return 1.0 / TargetRenderPeriod;
|
return 1.0 / TargetRenderPeriod;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
if (value < 1.0)
|
if (value < 1.0)
|
||||||
{
|
{
|
||||||
TargetRenderPeriod = 0.0;
|
TargetRenderPeriod = 0.0;
|
||||||
|
@ -996,10 +1022,12 @@ namespace OpenTK
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
return target_update_period;
|
return target_update_period;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
if (value <= 0.005)
|
if (value <= 0.005)
|
||||||
{
|
{
|
||||||
target_update_period = 0.0;
|
target_update_period = 0.0;
|
||||||
|
@ -1027,12 +1055,14 @@ namespace OpenTK
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
if (TargetUpdatePeriod == 0.0)
|
if (TargetUpdatePeriod == 0.0)
|
||||||
return 0.0;
|
return 0.0;
|
||||||
return 1.0 / TargetUpdatePeriod;
|
return 1.0 / TargetUpdatePeriod;
|
||||||
}
|
}
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
if (value < 1.0)
|
if (value < 1.0)
|
||||||
{
|
{
|
||||||
TargetUpdatePeriod = 0.0;
|
TargetUpdatePeriod = 0.0;
|
||||||
|
@ -1056,6 +1086,7 @@ namespace OpenTK
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
if (render_period == 0.0)
|
if (render_period == 0.0)
|
||||||
return 1.0;
|
return 1.0;
|
||||||
return 1.0 / render_period;
|
return 1.0 / render_period;
|
||||||
|
@ -1073,6 +1104,7 @@ namespace OpenTK
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
return render_period;
|
return render_period;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1088,6 +1120,7 @@ namespace OpenTK
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
if (update_period == 0.0)
|
if (update_period == 0.0)
|
||||||
return 1.0;
|
return 1.0;
|
||||||
return 1.0 / update_period;
|
return 1.0 / update_period;
|
||||||
|
@ -1105,6 +1138,7 @@ namespace OpenTK
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
return update_period;
|
return update_period;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1118,8 +1152,8 @@ namespace OpenTK
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double RenderTime
|
public double RenderTime
|
||||||
{
|
{
|
||||||
get { return render_time; }
|
get { if (disposed) throw new ObjectDisposedException("GameWindow"); return render_time; }
|
||||||
protected set { render_time = value; }
|
protected set { if (disposed) throw new ObjectDisposedException("GameWindow"); render_time = value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -1131,7 +1165,7 @@ namespace OpenTK
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public double UpdateTime
|
public double UpdateTime
|
||||||
{
|
{
|
||||||
get { return update_time; }
|
get { if (disposed) throw new ObjectDisposedException("GameWindow"); return update_time; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -1147,9 +1181,10 @@ namespace OpenTK
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Width
|
public int Width
|
||||||
{
|
{
|
||||||
get { return width; }
|
get { if (disposed) throw new ObjectDisposedException("GameWindow"); return width; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
if (value == this.Width)
|
if (value == this.Width)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -1174,9 +1209,10 @@ namespace OpenTK
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int Height
|
public int Height
|
||||||
{
|
{
|
||||||
get { return height; }
|
get { if (disposed) throw new ObjectDisposedException("GameWindow"); return height; }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
if (value == this.Height)
|
if (value == this.Height)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -1205,8 +1241,8 @@ namespace OpenTK
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public event ResizeEvent Resize
|
public event ResizeEvent Resize
|
||||||
{
|
{
|
||||||
add { glWindow.Resize += value; }
|
add { if (disposed) throw new ObjectDisposedException("GameWindow"); glWindow.Resize += value; }
|
||||||
remove { glWindow.Resize -= value; }
|
remove { if (disposed) throw new ObjectDisposedException("GameWindow"); glWindow.Resize -= value; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1232,6 +1268,7 @@ namespace OpenTK
|
||||||
/// <param name="e">Contains information about the Resize event.</param>
|
/// <param name="e">Contains information about the Resize event.</param>
|
||||||
protected virtual void OnResize(ResizeEventArgs e)
|
protected virtual void OnResize(ResizeEventArgs e)
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -1303,21 +1340,14 @@ namespace OpenTK
|
||||||
#endif
|
#endif
|
||||||
#region --- IDisposable Members ---
|
#region --- IDisposable Members ---
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Not used yet.
|
|
||||||
/// </summary>
|
|
||||||
private void DisposeInternal()
|
|
||||||
{
|
|
||||||
Dispose(); // User overridable Dispose method.
|
|
||||||
Dispose(true);
|
|
||||||
GC.SuppressFinalize(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Disposes of the GameWindow, releasing all resources consumed by it.
|
/// Disposes of the GameWindow, releasing all resources consumed by it.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual void Dispose()
|
public virtual void Dispose()
|
||||||
{
|
{
|
||||||
|
if (disposed) throw new ObjectDisposedException("GameWindow");
|
||||||
|
Dispose(true);
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Dispose(bool manual)
|
private void Dispose(bool manual)
|
||||||
|
@ -1327,7 +1357,10 @@ namespace OpenTK
|
||||||
if (manual)
|
if (manual)
|
||||||
{
|
{
|
||||||
if (glContext != null)
|
if (glContext != null)
|
||||||
|
{
|
||||||
glContext.Dispose();
|
glContext.Dispose();
|
||||||
|
glContext = null;
|
||||||
|
}
|
||||||
|
|
||||||
if (glWindow != null)
|
if (glWindow != null)
|
||||||
{
|
{
|
||||||
|
@ -1340,10 +1373,10 @@ namespace OpenTK
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Finalizes unmanaged resources consumed by the GameWindow.</summary>
|
/// <summary>Finalizes unmanaged resources consumed by the GameWindow.</summary>
|
||||||
~GameWindow()
|
//~GameWindow()
|
||||||
{
|
//{
|
||||||
Dispose(false);
|
// Dispose(false);
|
||||||
}
|
//}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,7 +84,10 @@ namespace OpenTK.Graphics
|
||||||
else
|
else
|
||||||
throw new PlatformNotSupportedException("Please, refer to http://www.opentk.com for more information.");
|
throw new PlatformNotSupportedException("Please, refer to http://www.opentk.com for more information.");
|
||||||
|
|
||||||
available_contexts.Add((this as IGraphicsContextInternal).Context, new WeakReference(this));
|
lock (context_lock)
|
||||||
|
{
|
||||||
|
available_contexts.Add((this as IGraphicsContextInternal).Context, new WeakReference(this));
|
||||||
|
}
|
||||||
//(implementation as IGraphicsContextInternal).LoadAll();
|
//(implementation as IGraphicsContextInternal).LoadAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,13 +122,16 @@ namespace OpenTK.Graphics
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
if (available_contexts.Count > 0)
|
lock (context_lock)
|
||||||
{
|
{
|
||||||
ContextHandle handle = GetCurrentContext();
|
if (available_contexts.Count > 0)
|
||||||
if (handle.Handle != IntPtr.Zero)
|
{
|
||||||
return (GraphicsContext)available_contexts[handle].Target;
|
ContextHandle handle = GetCurrentContext();
|
||||||
|
if (handle.Handle != IntPtr.Zero)
|
||||||
|
return (GraphicsContext)available_contexts[handle].Target;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
//set
|
//set
|
||||||
//{
|
//{
|
||||||
|
@ -200,7 +206,10 @@ namespace OpenTK.Graphics
|
||||||
{
|
{
|
||||||
this.Destroy += ContextDestroyed;
|
this.Destroy += ContextDestroyed;
|
||||||
|
|
||||||
available_contexts.Add((this as IGraphicsContextInternal).Context, new WeakReference(this));
|
lock (context_lock)
|
||||||
|
{
|
||||||
|
available_contexts.Add((this as IGraphicsContextInternal).Context, new WeakReference(this));
|
||||||
|
}
|
||||||
|
|
||||||
//OpenTK.Graphics.OpenGL.GL.Clear(OpenTK.Graphics.OpenGL.ClearBufferMask.ColorBufferBit);
|
//OpenTK.Graphics.OpenGL.GL.Clear(OpenTK.Graphics.OpenGL.ClearBufferMask.ColorBufferBit);
|
||||||
//if (StaticGetCurrentContext == null)
|
//if (StaticGetCurrentContext == null)
|
||||||
|
@ -364,12 +373,14 @@ namespace OpenTK.Graphics
|
||||||
{
|
{
|
||||||
if (!disposed)
|
if (!disposed)
|
||||||
{
|
{
|
||||||
|
Debug.WriteLine("Disposing context {0}.", (this as IGraphicsContextInternal).Context.ToString());
|
||||||
|
lock (context_lock)
|
||||||
|
{
|
||||||
|
available_contexts.Remove((this as IGraphicsContextInternal).Context);
|
||||||
|
}
|
||||||
|
|
||||||
if (manual)
|
if (manual)
|
||||||
{
|
{
|
||||||
Debug.WriteLine("Disposing context.");
|
|
||||||
available_contexts.Remove((this as IGraphicsContextInternal).Context);
|
|
||||||
|
|
||||||
// TODO: Check if this is safe
|
|
||||||
if (implementation != null)
|
if (implementation != null)
|
||||||
implementation.Dispose();
|
implementation.Dispose();
|
||||||
}
|
}
|
||||||
|
@ -377,10 +388,10 @@ namespace OpenTK.Graphics
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
~GraphicsContext()
|
//~GraphicsContext()
|
||||||
{
|
//{
|
||||||
this.Dispose(false);
|
// this.Dispose(false);
|
||||||
}
|
//}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,8 @@ namespace OpenTK.Platform.X11
|
||||||
|
|
||||||
static API()
|
static API()
|
||||||
{
|
{
|
||||||
|
Debug.Print("Initializing threaded X11: {0}.", Functions.XInitThreads().ToString());
|
||||||
|
|
||||||
AppDomain.CurrentDomain.ProcessExit += new EventHandler(CurrentDomain_ProcessExit);
|
AppDomain.CurrentDomain.ProcessExit += new EventHandler(CurrentDomain_ProcessExit);
|
||||||
|
|
||||||
// Bad idea - Windows.Forms will steal our events!
|
// Bad idea - Windows.Forms will steal our events!
|
||||||
|
|
|
@ -42,6 +42,35 @@ namespace OpenTK.Platform.X11
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#region DisplayLock
|
||||||
|
|
||||||
|
/*
|
||||||
|
internal class DisplayLock : IDisposable
|
||||||
|
{
|
||||||
|
IntPtr display;
|
||||||
|
|
||||||
|
public DisplayLock(IntPtr display)
|
||||||
|
{
|
||||||
|
if (display == IntPtr.Zero) throw new ArgumentException("display", "Must be a valid X11 display connection.");
|
||||||
|
this.display = display;
|
||||||
|
Functions.XLockDisplay(display);
|
||||||
|
}
|
||||||
|
|
||||||
|
publc void Dispose()
|
||||||
|
{
|
||||||
|
Functions.XUnlockDisplay(display);
|
||||||
|
GC.SuppressFinalize(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
~DisplayLock()
|
||||||
|
{
|
||||||
|
Functions.XUnlockDisplay(display);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
internal static partial class Functions
|
internal static partial class Functions
|
||||||
{
|
{
|
||||||
public static readonly object Lock = new object();
|
public static readonly object Lock = new object();
|
||||||
|
@ -384,5 +413,10 @@ namespace OpenTK.Platform.X11
|
||||||
[DllImport("libX11")]
|
[DllImport("libX11")]
|
||||||
public static extern IntPtr XCreateColormap(Display display, Window window, IntPtr visual, int alloc);
|
public static extern IntPtr XCreateColormap(Display display, Window window, IntPtr visual, int alloc);
|
||||||
|
|
||||||
|
[DllImport("libX11")]
|
||||||
|
public static extern void XLockDisplay(Display display);
|
||||||
|
|
||||||
|
[DllImport("libX11")]
|
||||||
|
public static extern void XUnlockDisplay(Display display);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,12 +64,17 @@ namespace OpenTK.Platform.X11
|
||||||
info.visualid = (IntPtr)mode.Index;
|
info.visualid = (IntPtr)mode.Index;
|
||||||
info.screen = currentWindow.Screen;
|
info.screen = currentWindow.Screen;
|
||||||
int items;
|
int items;
|
||||||
IntPtr vs = Functions.XGetVisualInfo(currentWindow.Display, XVisualInfoMask.ID | XVisualInfoMask.Screen, ref info, out items);
|
|
||||||
if (items == 0)
|
|
||||||
throw new GraphicsModeException(String.Format("Invalid GraphicsMode specified ({0}).", mode));
|
|
||||||
|
|
||||||
info = (XVisualInfo)Marshal.PtrToStructure(vs, typeof(XVisualInfo));
|
lock (API.Lock)
|
||||||
Functions.XFree(vs);
|
{
|
||||||
|
IntPtr vs = Functions.XGetVisualInfo(currentWindow.Display, XVisualInfoMask.ID | XVisualInfoMask.Screen, ref info, out items);
|
||||||
|
if (items == 0)
|
||||||
|
throw new GraphicsModeException(String.Format("Invalid GraphicsMode specified ({0}).", mode));
|
||||||
|
|
||||||
|
info = (XVisualInfo)Marshal.PtrToStructure(vs, typeof(XVisualInfo));
|
||||||
|
Functions.XFree(vs);
|
||||||
|
}
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,24 +94,27 @@ namespace OpenTK.Platform.X11
|
||||||
Debug.Write(shareHandle.Handle == IntPtr.Zero ? "not shared... " :
|
Debug.Write(shareHandle.Handle == IntPtr.Zero ? "not shared... " :
|
||||||
String.Format("shared with ({0})... ", shareHandle));
|
String.Format("shared with ({0})... ", shareHandle));
|
||||||
|
|
||||||
XVisualInfo info = window.VisualInfo; // Cannot pass a Property by reference.
|
lock (API.Lock)
|
||||||
context = Glx.CreateContext(window.Display, ref info, shareHandle.Handle, direct);
|
|
||||||
|
|
||||||
// Context creation succeeded, return.
|
|
||||||
if (context != IntPtr.Zero)
|
|
||||||
{
|
{
|
||||||
Debug.Print("done! (id: {0})", context);
|
XVisualInfo info = window.VisualInfo; // Cannot pass a Property by reference.
|
||||||
return;
|
context = Glx.CreateContext(window.Display, ref info, shareHandle.Handle, direct);
|
||||||
}
|
|
||||||
|
|
||||||
// Context creation failed. Retry with a non-shared context with the direct/indirect bit flipped.
|
// Context creation succeeded, return.
|
||||||
Debug.Print("failed.");
|
if (context != IntPtr.Zero)
|
||||||
Debug.Write(String.Format("Creating OpenGL context: {0}, not shared... ", !direct ? "direct" : "indirect"));
|
{
|
||||||
context = Glx.CreateContext(window.Display, ref info, IntPtr.Zero, !direct);
|
Debug.Print("done! (id: {0})", context);
|
||||||
if (context != IntPtr.Zero)
|
return;
|
||||||
{
|
}
|
||||||
Debug.Print("done! (id: {0})", context);
|
|
||||||
return;
|
// Context creation failed. Retry with a non-shared context with the direct/indirect bit flipped.
|
||||||
|
Debug.Print("failed.");
|
||||||
|
Debug.Write(String.Format("Creating OpenGL context: {0}, not shared... ", !direct ? "direct" : "indirect"));
|
||||||
|
context = Glx.CreateContext(window.Display, ref info, IntPtr.Zero, !direct);
|
||||||
|
if (context != IntPtr.Zero)
|
||||||
|
{
|
||||||
|
Debug.Print("done! (id: {0})", context);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug.Print("failed.");
|
Debug.Print("failed.");
|
||||||
|
@ -307,14 +315,20 @@ namespace OpenTK.Platform.X11
|
||||||
if (!disposed)
|
if (!disposed)
|
||||||
{
|
{
|
||||||
// Clean unmanaged resources:
|
// Clean unmanaged resources:
|
||||||
|
try
|
||||||
Glx.MakeCurrent(currentWindow.Display, IntPtr.Zero, IntPtr.Zero);
|
{
|
||||||
Glx.DestroyContext(currentWindow.Display, context);
|
Functions.XLockDisplay(currentWindow.Display);
|
||||||
//API.Free(visual);
|
Glx.MakeCurrent(currentWindow.Display, IntPtr.Zero, IntPtr.Zero);
|
||||||
|
Glx.DestroyContext(currentWindow.Display, context);
|
||||||
|
//Functions.XFree(visual);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Functions.XUnlockDisplay(currentWindow.Display);
|
||||||
|
}
|
||||||
|
|
||||||
if (manuallyCalled)
|
if (manuallyCalled)
|
||||||
{
|
{
|
||||||
// Safe to clean managed resources, too
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
disposed = true;
|
disposed = true;
|
||||||
|
|
|
@ -98,8 +98,18 @@ namespace OpenTK.Platform.X11
|
||||||
window.Display = API.DefaultDisplay;//Functions.XOpenDisplay(IntPtr.Zero); // IntPtr.Zero == default display
|
window.Display = API.DefaultDisplay;//Functions.XOpenDisplay(IntPtr.Zero); // IntPtr.Zero == default display
|
||||||
if (window.Display == IntPtr.Zero)
|
if (window.Display == IntPtr.Zero)
|
||||||
throw new Exception("Could not open connection to X");
|
throw new Exception("Could not open connection to X");
|
||||||
window.Screen = Functions.XDefaultScreen(window.Display); //API.DefaultScreen;
|
|
||||||
window.RootWindow = Functions.XRootWindow(window.Display, window.Screen); // API.RootWindow;
|
try
|
||||||
|
{
|
||||||
|
Functions.XLockDisplay(window.Display);
|
||||||
|
window.Screen = Functions.XDefaultScreen(window.Display); //API.DefaultScreen;
|
||||||
|
window.RootWindow = Functions.XRootWindow(window.Display, window.Screen); // API.RootWindow;
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Functions.XUnlockDisplay(window.Display);
|
||||||
|
}
|
||||||
|
|
||||||
Debug.Print("Display: {0}, Screen {1}, Root window: {2}", window.Display, window.Screen, window.RootWindow);
|
Debug.Print("Display: {0}, Screen {1}, Root window: {2}", window.Display, window.Screen, window.RootWindow);
|
||||||
|
|
||||||
RegisterAtoms(window);
|
RegisterAtoms(window);
|
||||||
|
@ -145,40 +155,43 @@ namespace OpenTK.Platform.X11
|
||||||
if (height <= 0) throw new ArgumentOutOfRangeException("height", "Must be higher than zero.");
|
if (height <= 0) throw new ArgumentOutOfRangeException("height", "Must be higher than zero.");
|
||||||
if (exists) throw new InvalidOperationException("A render window already exists.");
|
if (exists) throw new InvalidOperationException("A render window already exists.");
|
||||||
|
|
||||||
|
XVisualInfo info = new XVisualInfo();
|
||||||
|
|
||||||
Debug.Indent();
|
Debug.Indent();
|
||||||
|
|
||||||
XVisualInfo info = new XVisualInfo();
|
lock (API.Lock)
|
||||||
info.visualid = mode.Index;
|
{
|
||||||
int dummy;
|
info.visualid = mode.Index;
|
||||||
window.VisualInfo = (XVisualInfo)Marshal.PtrToStructure(
|
int dummy;
|
||||||
Functions.XGetVisualInfo(window.Display, XVisualInfoMask.ID, ref info, out dummy), typeof(XVisualInfo));
|
window.VisualInfo = (XVisualInfo)Marshal.PtrToStructure(
|
||||||
|
Functions.XGetVisualInfo(window.Display, XVisualInfoMask.ID, ref info, out dummy), typeof(XVisualInfo));
|
||||||
|
|
||||||
// Create a window on this display using the visual above
|
// Create a window on this display using the visual above
|
||||||
Debug.Write("Opening render window... ");
|
Debug.Write("Opening render window... ");
|
||||||
|
|
||||||
XSetWindowAttributes attributes = new XSetWindowAttributes();
|
XSetWindowAttributes attributes = new XSetWindowAttributes();
|
||||||
attributes.background_pixel = IntPtr.Zero;
|
attributes.background_pixel = IntPtr.Zero;
|
||||||
attributes.border_pixel = IntPtr.Zero;
|
attributes.border_pixel = IntPtr.Zero;
|
||||||
attributes.colormap = Functions.XCreateColormap(window.Display, window.RootWindow, window.VisualInfo.visual, 0/*AllocNone*/);
|
attributes.colormap = Functions.XCreateColormap(window.Display, window.RootWindow, window.VisualInfo.visual, 0/*AllocNone*/);
|
||||||
window.EventMask = EventMask.StructureNotifyMask | EventMask.SubstructureNotifyMask | EventMask.ExposureMask |
|
window.EventMask = EventMask.StructureNotifyMask | EventMask.SubstructureNotifyMask | EventMask.ExposureMask |
|
||||||
EventMask.KeyReleaseMask | EventMask.KeyPressMask |
|
EventMask.KeyReleaseMask | EventMask.KeyPressMask |
|
||||||
EventMask.PointerMotionMask | // Bad! EventMask.PointerMotionHintMask |
|
EventMask.PointerMotionMask | // Bad! EventMask.PointerMotionHintMask |
|
||||||
EventMask.ButtonPressMask | EventMask.ButtonReleaseMask;
|
EventMask.ButtonPressMask | EventMask.ButtonReleaseMask;
|
||||||
attributes.event_mask = (IntPtr)window.EventMask;
|
attributes.event_mask = (IntPtr)window.EventMask;
|
||||||
|
|
||||||
uint mask = (uint)SetWindowValuemask.ColorMap | (uint)SetWindowValuemask.EventMask |
|
uint mask = (uint)SetWindowValuemask.ColorMap | (uint)SetWindowValuemask.EventMask |
|
||||||
(uint)SetWindowValuemask.BackPixel | (uint)SetWindowValuemask.BorderPixel;
|
(uint)SetWindowValuemask.BackPixel | (uint)SetWindowValuemask.BorderPixel;
|
||||||
|
|
||||||
window.WindowHandle = Functions.XCreateWindow(window.Display, window.RootWindow,
|
window.WindowHandle = Functions.XCreateWindow(window.Display, window.RootWindow,
|
||||||
0, 0, width, height, 0, window.VisualInfo.depth/*(int)CreateWindowArgs.CopyFromParent*/,
|
0, 0, width, height, 0, window.VisualInfo.depth/*(int)CreateWindowArgs.CopyFromParent*/,
|
||||||
(int)CreateWindowArgs.InputOutput, window.VisualInfo.visual, (UIntPtr)mask, ref attributes);
|
(int)CreateWindowArgs.InputOutput, window.VisualInfo.visual, (UIntPtr)mask, ref attributes);
|
||||||
|
|
||||||
if (window.WindowHandle == IntPtr.Zero)
|
if (window.WindowHandle == IntPtr.Zero)
|
||||||
throw new ApplicationException("XCreateWindow call failed (returned 0).");
|
throw new ApplicationException("XCreateWindow call failed (returned 0).");
|
||||||
|
|
||||||
//XVisualInfo vis = window.VisualInfo;
|
|
||||||
//Glx.CreateContext(window.Display, ref vis, IntPtr.Zero, true);
|
|
||||||
|
|
||||||
|
//XVisualInfo vis = window.VisualInfo;
|
||||||
|
//Glx.CreateContext(window.Display, ref vis, IntPtr.Zero, true);
|
||||||
|
}
|
||||||
context = new GraphicsContext(mode, window);
|
context = new GraphicsContext(mode, window);
|
||||||
|
|
||||||
// Set the window hints
|
// Set the window hints
|
||||||
|
@ -188,13 +201,14 @@ namespace OpenTK.Platform.X11
|
||||||
hints.width = width;
|
hints.width = width;
|
||||||
hints.height = height;
|
hints.height = height;
|
||||||
hints.flags = (IntPtr)(XSizeHintsFlags.USSize | XSizeHintsFlags.USPosition);
|
hints.flags = (IntPtr)(XSizeHintsFlags.USSize | XSizeHintsFlags.USPosition);
|
||||||
Functions.XSetWMNormalHints(window.Display, window.WindowHandle, ref hints);
|
lock (API.Lock)
|
||||||
|
{
|
||||||
// Register for window destroy notification
|
Functions.XSetWMNormalHints(window.Display, window.WindowHandle, ref hints);
|
||||||
IntPtr wm_destroy_atom = Functions.XInternAtom(window.Display, "WM_DELETE_WINDOW", true);
|
|
||||||
//XWMHints hint = new XWMHints();
|
|
||||||
Functions.XSetWMProtocols(window.Display, window.WindowHandle, new IntPtr[] { wm_destroy_atom }, 1);
|
|
||||||
|
|
||||||
|
// Register for window destroy notification
|
||||||
|
IntPtr wm_destroy_atom = Functions.XInternAtom(window.Display, "WM_DELETE_WINDOW", true);
|
||||||
|
Functions.XSetWMProtocols(window.Display, window.WindowHandle, new IntPtr[] { wm_destroy_atom }, 1);
|
||||||
|
}
|
||||||
Top = Left = 0;
|
Top = Left = 0;
|
||||||
Right = Width;
|
Right = Width;
|
||||||
Bottom = Height;
|
Bottom = Height;
|
||||||
|
@ -207,9 +221,10 @@ namespace OpenTK.Platform.X11
|
||||||
|
|
||||||
Debug.Print("done! (id: {0})", window.WindowHandle);
|
Debug.Print("done! (id: {0})", window.WindowHandle);
|
||||||
|
|
||||||
//(glContext as IGLContextCreationHack).SetWindowHandle(window.Handle);
|
lock (API.Lock)
|
||||||
|
{
|
||||||
API.MapRaised(window.Display, window.WindowHandle);
|
API.MapRaised(window.Display, window.WindowHandle);
|
||||||
|
}
|
||||||
mapped = true;
|
mapped = true;
|
||||||
|
|
||||||
//context.CreateContext(true, null);
|
//context.CreateContext(true, null);
|
||||||
|
@ -664,12 +679,18 @@ namespace OpenTK.Platform.X11
|
||||||
{
|
{
|
||||||
if (!disposed)
|
if (!disposed)
|
||||||
{
|
{
|
||||||
if (window != null)
|
if (window != null && window.WindowHandle != IntPtr.Zero)
|
||||||
{
|
{
|
||||||
if (window.WindowHandle != IntPtr.Zero)
|
try
|
||||||
|
{
|
||||||
|
Functions.XLockDisplay(window.Display);
|
||||||
Functions.XDestroyWindow(window.Display, window.WindowHandle);
|
Functions.XDestroyWindow(window.Display, window.WindowHandle);
|
||||||
//if (window.Display != IntPtr.Zero)
|
}
|
||||||
// Functions.XCloseDisplay(window.Display);
|
finally
|
||||||
|
{
|
||||||
|
Functions.XUnlockDisplay(window.Display);
|
||||||
|
}
|
||||||
|
|
||||||
window = null;
|
window = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,9 +80,12 @@ namespace OpenTK.Platform.X11
|
||||||
visualAttributes.Add((int)0);
|
visualAttributes.Add((int)0);
|
||||||
|
|
||||||
// Select a visual that matches the parameters set by the user.
|
// Select a visual that matches the parameters set by the user.
|
||||||
lock (API.Lock)
|
IntPtr display = API.DefaultDisplay; //Functions.XOpenDisplay(IntPtr.Zero);
|
||||||
|
|
||||||
|
try
|
||||||
{
|
{
|
||||||
IntPtr display = API.DefaultDisplay; //Functions.XOpenDisplay(IntPtr.Zero);
|
Functions.XLockDisplay(display);
|
||||||
|
|
||||||
int screen = Functions.XDefaultScreen(display);
|
int screen = Functions.XDefaultScreen(display);
|
||||||
IntPtr root = Functions.XRootWindow(display, screen);
|
IntPtr root = Functions.XRootWindow(display, screen);
|
||||||
Debug.Print("Display: {0}, Screen: {1}, RootWindow: {2}", display, screen, root);
|
Debug.Print("Display: {0}, Screen: {1}, RootWindow: {2}", display, screen, root);
|
||||||
|
@ -115,21 +118,23 @@ namespace OpenTK.Platform.X11
|
||||||
stereo = st != 0;
|
stereo = st != 0;
|
||||||
|
|
||||||
gfx = new GraphicsMode(info.visualid, new ColorFormat(r, g, b, a), depth, stencil, samples,
|
gfx = new GraphicsMode(info.visualid, new ColorFormat(r, g, b, a), depth, stencil, samples,
|
||||||
new ColorFormat(ar, ag, ab, aa), buffers, stereo);
|
new ColorFormat(ar, ag, ab, aa), buffers, stereo);
|
||||||
|
}
|
||||||
//Functions.XCloseDisplay(display);
|
finally
|
||||||
|
{
|
||||||
|
Functions.XUnlockDisplay(display);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare Windows.Forms for creating OpenGL drawables.
|
// Prepare Windows.Forms for creating OpenGL drawables.
|
||||||
lock (API.Lock)
|
//lock (API.Lock)
|
||||||
{
|
//{
|
||||||
Type xplatui = Type.GetType("System.Windows.Forms.XplatUIX11, System.Windows.Forms");
|
// Type xplatui = Type.GetType("System.Windows.Forms.XplatUIX11, System.Windows.Forms");
|
||||||
IntPtr display = (IntPtr)xplatui.GetField("DisplayHandle",
|
// IntPtr display = (IntPtr)xplatui.GetField("DisplayHandle",
|
||||||
System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).GetValue(null);
|
// System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).GetValue(null);
|
||||||
IntPtr root = (IntPtr)xplatui.GetField("RootWindow",
|
// IntPtr root = (IntPtr)xplatui.GetField("RootWindow",
|
||||||
System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).GetValue(null);
|
// System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).GetValue(null);
|
||||||
int screen = (int)xplatui.GetField("ScreenNo",
|
// int screen = (int)xplatui.GetField("ScreenNo",
|
||||||
System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).GetValue(null);
|
// System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic).GetValue(null);
|
||||||
|
|
||||||
|
|
||||||
//xplatui.GetField("CustomVisual", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic)
|
//xplatui.GetField("CustomVisual", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic)
|
||||||
|
@ -137,9 +142,17 @@ namespace OpenTK.Platform.X11
|
||||||
//xplatui.GetField("CustomColormap", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic)
|
//xplatui.GetField("CustomColormap", System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic)
|
||||||
// .SetValue(null, Functions.XCreateColormap(display, root, visual, 0));
|
// .SetValue(null, Functions.XCreateColormap(display, root, visual, 0));
|
||||||
|
|
||||||
}
|
//}
|
||||||
|
|
||||||
Functions.XFree(visual);
|
try
|
||||||
|
{
|
||||||
|
Functions.XLockDisplay(display);
|
||||||
|
Functions.XFree(visual);
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Functions.XUnlockDisplay(display);
|
||||||
|
}
|
||||||
|
|
||||||
return gfx;
|
return gfx;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue