Fixed multiple GLControls under Mono/X11.

This commit is contained in:
the_fiddler 2008-03-10 13:23:09 +00:00
parent 73914709ba
commit b2b9cd1353
2 changed files with 23 additions and 20 deletions

View file

@ -84,19 +84,19 @@ namespace OpenTK
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.
if (this.Context == null)
{
if (!DesignMode)
this.Context = implementation.CreateContext();
else
this.Context = new DummyGLContext(null);
//// Workaround Mono 1.2.4 bug where the OnHandleCreated event isn't raised at the correct time.
//if (this.Context == null)
//{
// if (!DesignMode)
// this.Context = implementation.CreateContext();
// else
// this.Context = new DummyGLContext(null);
this.window_info = implementation.WindowInfo;
this.MakeCurrent();
((IGraphicsContextInternal)this.Context).LoadAll();
}
// this.window_info = implementation.WindowInfo;
// this.MakeCurrent();
// ((IGraphicsContextInternal)this.Context).LoadAll();
//}
base.OnResize(e);
}
/// <summary>Raises the HandleCreated event.</summary>
@ -105,14 +105,14 @@ namespace OpenTK
{
base.OnHandleCreated(e);
// On Mono 1.2.4 the Resize event is raised before this :/
//if (!DesignMode)
// this.Context = implementation.CreateContext();
//else
// this.Context = new DummyGLContext(null);
if (!DesignMode)
this.Context = implementation.CreateContext();
else
this.Context = new DummyGLContext(null);
//this.window_info = implementation.WindowInfo;
//this.MakeCurrent();
//((IGraphicsContextInternal)this.Context).LoadAll();
this.window_info = implementation.WindowInfo;
this.MakeCurrent();
((IGraphicsContextInternal)this.Context).LoadAll();
}
/// <summary>Raises the HandleDestroyed event.</summary>

View file

@ -62,7 +62,10 @@ namespace OpenTK.Platform.X11
if (xplatui == null) throw new PlatformNotSupportedException(
"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 =
window.Display = (IntPtr)xplatui.GetField("DisplayHandle",