public bool Load(IntPtr handle, int width, int height)
{
this.handle = handle;
this.width = width;
this.height = height;
System.Threading.ThreadStart start = delegate () {
lock (widgetLock) {
if (!GLib.Thread.Supported)
GLib.Thread.Init ();
Gdk.Threads.Init ();
Gtk.Application.Init ();
started = true;
}
Gtk.Application.Run ();
};
lock (initLock) {
if (!started) {
System.Threading.Thread t = new System.Threading.Thread (start);
t.Start ();
}
}
while (!initialized) {
lock (widgetLock) {
if (!started)
continue;
Gdk.Threads.Enter ();
InitializeWindow (null, null);
Gdk.Threads.Leave ();
widgetCount++;
}
}
// Gdk.Window.DebugUpdates = true;
return true;
}