Fixed multiple GLControls under Mono/X11.
This commit is contained in:
parent
41cba22df3
commit
28ed42406a
2 changed files with 23 additions and 20 deletions
|
@ -84,19 +84,19 @@ namespace OpenTK
|
||||||
|
|
||||||
protected override void OnResize(EventArgs e)
|
protected override void OnResize(EventArgs e)
|
||||||
{
|
{
|
||||||
base.OnResize(e);
|
//// Workaround Mono 1.2.4 bug where the OnHandleCreated event isn't raised at the correct time.
|
||||||
// Workaround Mono 1.2.4 bug where the OnHandleCreated event isn't raised at the correct time.
|
//if (this.Context == null)
|
||||||
if (this.Context == null)
|
//{
|
||||||
{
|
// if (!DesignMode)
|
||||||
if (!DesignMode)
|
// this.Context = implementation.CreateContext();
|
||||||
this.Context = implementation.CreateContext();
|
// else
|
||||||
else
|
// this.Context = new DummyGLContext(null);
|
||||||
this.Context = new DummyGLContext(null);
|
|
||||||
|
|
||||||
this.window_info = implementation.WindowInfo;
|
// this.window_info = implementation.WindowInfo;
|
||||||
this.MakeCurrent();
|
// this.MakeCurrent();
|
||||||
((IGraphicsContextInternal)this.Context).LoadAll();
|
// ((IGraphicsContextInternal)this.Context).LoadAll();
|
||||||
}
|
//}
|
||||||
|
base.OnResize(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Raises the HandleCreated event.</summary>
|
/// <summary>Raises the HandleCreated event.</summary>
|
||||||
|
@ -105,14 +105,14 @@ namespace OpenTK
|
||||||
{
|
{
|
||||||
base.OnHandleCreated(e);
|
base.OnHandleCreated(e);
|
||||||
// On Mono 1.2.4 the Resize event is raised before this :/
|
// On Mono 1.2.4 the Resize event is raised before this :/
|
||||||
//if (!DesignMode)
|
if (!DesignMode)
|
||||||
// this.Context = implementation.CreateContext();
|
this.Context = implementation.CreateContext();
|
||||||
//else
|
else
|
||||||
// this.Context = new DummyGLContext(null);
|
this.Context = new DummyGLContext(null);
|
||||||
|
|
||||||
//this.window_info = implementation.WindowInfo;
|
this.window_info = implementation.WindowInfo;
|
||||||
//this.MakeCurrent();
|
this.MakeCurrent();
|
||||||
//((IGraphicsContextInternal)this.Context).LoadAll();
|
((IGraphicsContextInternal)this.Context).LoadAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>Raises the HandleDestroyed event.</summary>
|
/// <summary>Raises the HandleDestroyed event.</summary>
|
||||||
|
|
|
@ -62,7 +62,10 @@ namespace OpenTK.Platform.X11
|
||||||
if (xplatui == null) throw new PlatformNotSupportedException(
|
if (xplatui == null) throw new PlatformNotSupportedException(
|
||||||
"System.Windows.Forms.XplatUIX11 missing. Unsupported platform or Mono runtime version, aborting.");
|
"System.Windows.Forms.XplatUIX11 missing. Unsupported platform or Mono runtime version, aborting.");
|
||||||
|
|
||||||
X11WindowInfo window = new X11WindowInfo(control.Handle, null);
|
X11WindowInfo window = new X11WindowInfo();
|
||||||
|
|
||||||
|
if (control.IsHandleCreated)
|
||||||
|
window.WindowHandle = control.Handle;
|
||||||
|
|
||||||
display =
|
display =
|
||||||
window.Display = (IntPtr)xplatui.GetField("DisplayHandle",
|
window.Display = (IntPtr)xplatui.GetField("DisplayHandle",
|
||||||
|
|
Loading…
Reference in a new issue