diff -r 36f1581b43e2 -r 40dbf1a7526a ui/gtk/window.c --- a/ui/gtk/window.c Sun Jan 24 12:39:05 2016 +0100 +++ b/ui/gtk/window.c Sun Jan 24 18:47:39 2016 +0100 @@ -40,17 +40,23 @@ static int nwindows = 0; -static ui_callback wclose_fnc = NULL; -static void *wclose_udata = NULL; - static int window_default_width = 650; static int window_default_height = 550; void ui_exit_event(GtkWidget *widget, gpointer data) { - if(wclose_fnc) { - // TODO: use UiEvent - wclose_fnc(data, wclose_udata); + UiObject *obj = data; + UiEvent ev; + ev.window = obj->window; + ev.document = obj->ctx->document; + ev.obj = obj; + ev.eventdata = NULL; + ev.intval = 0; + + if(obj->ctx->close_callback) { + obj->ctx->close_callback(&ev, obj->ctx->close_data); } + // TODO: free UiObject + nwindows--; if(nwindows == 0) { gtk_main_quit(); @@ -85,7 +91,7 @@ obj->widget, "destroy", G_CALLBACK(ui_exit_event), - window_data); + obj); GtkWidget *vbox = ui_gtk_vbox_new(0); gtk_container_add(GTK_CONTAINER(obj->widget), vbox);