diff --git a/Source/OpenTK/GLControl.cs b/Source/OpenTK/GLControl.cs index a0dc10b4..3f342efc 100644 --- a/Source/OpenTK/GLControl.cs +++ b/Source/OpenTK/GLControl.cs @@ -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); } /// Raises the HandleCreated event. @@ -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(); } /// Raises the HandleDestroyed event. diff --git a/Source/OpenTK/Platform/X11/X11GLControl.cs b/Source/OpenTK/Platform/X11/X11GLControl.cs index c0317db3..dfab285e 100644 --- a/Source/OpenTK/Platform/X11/X11GLControl.cs +++ b/Source/OpenTK/Platform/X11/X11GLControl.cs @@ -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",