Fixed multiple GLControls under Mono/X11.

This commit is contained in:
the_fiddler 2008-03-10 13:23:09 +00:00
parent 41cba22df3
commit 28ed42406a
2 changed files with 23 additions and 20 deletions

View file

@ -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>

View file

@ -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",