In Gtk#, I can hook up a handler for the "destroy" event but it never gets called. This application never prints anything out. The Gtk docs say that the "destroy" event is only sent if a certain flag is set, and also says that this flag is automatically set by Gdk.
This is frustrating, since it's basically identical to plain Gtk+ code that works correctly. And how do I know when to call Application.Quit() except by listening to the "destroy" event?
using System;
using Gtk;
public class MainWindow {
public static void Main(string[] args)
{
Application.Init();
Window win = new Window("Test");
win.Resize(200, 200);
win.DestroyEvent += new DestroyEventHandler(OnDestroy);
win.ShowAll();
Application.Run();
}
private static void OnDestroy(object o, DestroyEventArgs args)
{
Console.WriteLine("OnDestroy");
}
}
P.S. I'm not interested in the "delete" event.