--- sylpheed/src/inputdialog.c.alt-wm_race 2003-07-13 17:08:04 +0400 +++ sylpheed/src/inputdialog.c 2003-07-13 17:38:10 +0400 @@ -243,6 +243,23 @@ manage_window_focus_out(dialog, NULL, NULL); gtk_widget_hide(dialog); + /* + * If input_dialog_open() is called two times in a row without any + * delay, it triggers a bug in some window managers (observed in fvwm2, + * kwin, waimea): the second time the dialog window is not displayed + * but still grabs all input. Apparently there is a race between + * XWithdrawWindow() called by gtk_widget_hide() and XMapWindow() + * called by gtk_widget_show(). + * + * As a workaround we unrealize the toplevel dialog window - the next + * time we show it, the window will be realized again, and hopefully + * the WM won't confuse it with the old window. However, we must be + * careful to avoid triggering another GTK+ bug - this window contains + * GtkEntry, which has problems with selection handling when + * unrealized, so we must use the gtkut_widget_unrealize() wrapper. + */ + gtkut_widget_unrealize(dialog); + if (ack) { GtkEditable *editable; --- sylpheed/src/gtkutils.c.alt-wm_race 2003-04-11 20:06:42 +0400 +++ sylpheed/src/gtkutils.c 2003-07-13 17:38:10 +0400 @@ -382,6 +382,15 @@ gtk_container_remove(container, widget); } +/* + * The same workaround for gtk_widget_unrealize. + */ +void gtkut_widget_unrealize(GtkWidget *widget) +{ + gtkut_check_before_remove(widget, NULL); + gtk_widget_unrealize(widget); +} + gboolean gtkut_stext_match_string(GtkSText *text, gint pos, wchar_t *wcs, gint len, gboolean case_sens) { --- sylpheed/src/gtkutils.h.alt-wm_race 2003-04-11 20:06:42 +0400 +++ sylpheed/src/gtkutils.h 2003-07-13 17:38:10 +0400 @@ -115,6 +115,7 @@ void gtkut_container_remove (GtkContainer *container, GtkWidget *widget); +void gtkut_widget_unrealize (GtkWidget *widget); gboolean gtkut_stext_match_string (GtkSText *text, gint pos,