Fixed shutdown sequence in Windows, so that GameWindow.Exit() and pressing the 'close' button behave the same.

This commit is contained in:
the_fiddler 2007-11-11 20:23:25 +00:00
parent 6c43d97cf4
commit a1fb128a70
2 changed files with 15 additions and 9 deletions

View file

@ -550,9 +550,7 @@ namespace OpenTK
if (Exists) if (Exists)
glWindow.DestroyWindow(); glWindow.DestroyWindow();
while (this.Exists) while (this.Exists)
{
this.ProcessEvents(); this.ProcessEvents();
}
} }
} }
} }
@ -1327,6 +1325,13 @@ namespace OpenTK
class GameWindowExitException : ApplicationException class GameWindowExitException : ApplicationException
{ {
public override string Message
{
get
{
return "GameWindow exit event. If this is caught in Visual Studio, don't worry - this is perfectly normal.";
}
}
} }
#endregion #endregion

View file

@ -110,11 +110,14 @@ namespace OpenTK.Platform.Windows
return; return;
case WindowMessage.CLOSE: case WindowMessage.CLOSE:
this.DestroyWindow(); //this.DestroyWindow();
this.OnDestroy(EventArgs.Empty);
return; return;
case WindowMessage.DESTROY: case WindowMessage.DESTROY:
this.OnDestroy(EventArgs.Empty); //this.OnDestroy(EventArgs.Empty);
exists = false;
isExiting = true;
break; break;
case WindowMessage.QUIT: case WindowMessage.QUIT:
@ -368,9 +371,7 @@ namespace OpenTK.Platform.Windows
} }
if (this.Create != null) if (this.Create != null)
{
this.Create(this, e); this.Create(this, e);
}
} }
#endregion #endregion
@ -392,11 +393,10 @@ namespace OpenTK.Platform.Windows
public void OnDestroy(EventArgs e) public void OnDestroy(EventArgs e)
{ {
Debug.Print("Destroy event fired from window: {0}", window.ToString());
if (this.Destroy != null) if (this.Destroy != null)
{
this.Destroy(this, e); this.Destroy(this, e);
} /*
if (this.Handle != IntPtr.Zero) if (this.Handle != IntPtr.Zero)
{ {
Debug.Print("Window handle {0} destroyed.", this.Handle); Debug.Print("Window handle {0} destroyed.", this.Handle);
@ -404,6 +404,7 @@ namespace OpenTK.Platform.Windows
//this.Dispose(); //this.Dispose();
exists = false; exists = false;
} }
*/
//API.PostQuitMessage(0); //API.PostQuitMessage(0);
} }