To: vim-dev@vim.org Subject: Patch 6.1a.002 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.1a.002 Problem: GTK: On some configurations, when closing a dialog from the window manager, Vim hangs. Solution: Catch the "destroy" signal. (Aric Blumer) Files: src/gui_gtk.c *** ../vim61a.001/src/gui_gtk.c Tue Feb 12 10:51:26 2002 --- src/gui_gtk.c Mon Feb 25 21:33:12 2002 *************** *** 1122,1127 **** --- 1122,1138 ---- return TRUE; } + /* + * Callback function for when the dialog was destroyed by a window manager. + */ + static void + dlg_destroy_cb(int *p) + { + *p = TRUE; /* set dialog_destroyed to break out of the loop */ + if (gtk_main_level() > 0) + gtk_main_quit(); + } + /* ARGSUSED */ int gui_mch_dialog( int type, /* type of dialog */ *************** *** 1136,1141 **** --- 1147,1153 ---- int i; int butcount; int dialog_status = -1; + int dialog_destroyed = FALSE; int vertical; GtkWidget *dialog; *************** *** 1188,1193 **** --- 1200,1210 ---- gtk_signal_connect_after(GTK_OBJECT(dialog), "key_press_event", GTK_SIGNAL_FUNC(dlg_key_press_event), (gpointer) &cancel_data); + /* Catch the destroy signal, otherwise we don't notice a window manager + * destroying the dialog window. */ + gtk_signal_connect_object(GTK_OBJECT(dialog), "destroy", + GTK_SIGNAL_FUNC(dlg_destroy_cb), + (gpointer)&dialog_destroyed); gtk_grab_add(dialog); *************** *** 1412,1418 **** gtk_widget_show(dialog); /* loop here until the dialog goes away */ ! while (dialog_status == -1 && GTK_WIDGET_DRAWABLE(dialog)) gtk_main_iteration_do(TRUE); if (dialog_status < 0) --- 1429,1436 ---- gtk_widget_show(dialog); /* loop here until the dialog goes away */ ! while (dialog_status == -1 && !dialog_destroyed ! && GTK_WIDGET_DRAWABLE(dialog)) gtk_main_iteration_do(TRUE); if (dialog_status < 0) *** ../vim61a.001/src/version.c Mon Feb 25 21:15:54 2002 --- src/version.c Mon Feb 25 21:29:29 2002 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 2, /**/ -- Tips for aliens in New York: Land anywhere. Central Park, anywhere. No one will care or indeed even notice. -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy" /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ /// Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim \\\ \\\ Project leader for A-A-P -- http://www.a-a-p.org /// \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///