new function gimp_dialog_hide() that calls gdk_window_withdraw() after

gtk_widget_hide() so dialogs actually go away even if the user iconified
them before. Should fix bugs #2961, #5293, #6441 and #7849.


--Sven
This commit is contained in:
Sven Neumann 2000-03-28 23:02:05 +00:00
parent db7d885ee3
commit b7940e1ebf
40 changed files with 177 additions and 171 deletions

View File

@ -1,3 +1,22 @@
2000-03-29 Sven Neumann <sven@gimp.org>
* app/gimpui.[ch]: (gimp_dialog_hide) new function that calls
gdk_window_withdraw() after gtk_widget_hide() so dialogs actually
go away even if they have been iconified by the user before.
* brightness_contrast.c
* by_color_select.c
* color_balance.c
* curves.c
* fileops.c
* histogram_tool.c
* hue_saturation.c
* levels.c
* posterize.c
* text_tool.c
* threshold.c: use gimp_dialog_hide() on all(?) tool dialogs and
file_selectors. This should fix bugs #2961, #5293, #6441 and #7849.
2000-03-28 Sven Neumann <sven@gimp.org>
* plugins/script-fu/Makefile.am: don't install test-sphere.scm

View File

@ -569,8 +569,7 @@ color_balance_ok_callback (GtkWidget *widget,
cbd = (ColorBalanceDialog *) data;
if (GTK_WIDGET_VISIBLE (cbd->shell))
gtk_widget_hide (cbd->shell);
gimp_dialog_hide (cbd->shell);
active_tool->preserve = TRUE;
@ -596,8 +595,7 @@ color_balance_cancel_callback (GtkWidget *widget,
cbd = (ColorBalanceDialog *) data;
if (GTK_WIDGET_VISIBLE (cbd->shell))
gtk_widget_hide (cbd->shell);
gimp_dialog_hide (cbd->shell);
if (cbd->image_map)
{

View File

@ -1213,8 +1213,7 @@ curves_ok_callback (GtkWidget *widget,
cd = (CurvesDialog *) data;
if (GTK_WIDGET_VISIBLE (cd->shell))
gtk_widget_hide (cd->shell);
gimp_dialog_hide (cd->shell);
active_tool->preserve = TRUE; /* We're about to dirty... */
@ -1241,8 +1240,7 @@ curves_cancel_callback (GtkWidget *widget,
cd = (CurvesDialog *) data;
if (GTK_WIDGET_VISIBLE (cd->shell))
gtk_widget_hide (cd->shell);
gimp_dialog_hide (cd->shell);
if (cd->image_map)
{
@ -1637,14 +1635,14 @@ file_dialog_ok_callback (GtkWidget *widget,
fclose (f);
}
gtk_widget_hide (file_dlg);
file_dialog_cancel_callback (file_dlg, NULL);
}
static void
file_dialog_cancel_callback (GtkWidget *widget,
gpointer data)
{
gtk_widget_hide (file_dlg);
gimp_dialog_hide (file_dlg);
}
static gboolean

View File

@ -674,8 +674,7 @@ hue_saturation_ok_callback (GtkWidget *widget,
hsd = (HueSaturationDialog *) data;
if (GTK_WIDGET_VISIBLE (hsd->shell))
gtk_widget_hide (hsd->shell);
gimp_dialog_hide (hsd->shell);
active_tool->preserve = TRUE;
@ -701,8 +700,7 @@ hue_saturation_cancel_callback (GtkWidget *widget,
hsd = (HueSaturationDialog *) data;
if (GTK_WIDGET_VISIBLE (hsd->shell))
gtk_widget_hide (hsd->shell);
gimp_dialog_hide (hsd->shell);
if (hsd->image_map)
{

View File

@ -421,8 +421,7 @@ threshold_ok_callback (GtkWidget *widget,
td = (ThresholdDialog *) data;
if (GTK_WIDGET_VISIBLE (td->shell))
gtk_widget_hide (td->shell);
gimp_dialog_hide (td->shell);
active_tool->preserve = TRUE;
@ -448,8 +447,7 @@ threshold_cancel_callback (GtkWidget *widget,
td = (ThresholdDialog *) data;
if (GTK_WIDGET_VISIBLE (td->shell))
gtk_widget_hide (td->shell);
gimp_dialog_hide (td->shell);
if (td->image_map)
{

View File

@ -371,8 +371,7 @@ brightness_contrast_ok_callback (GtkWidget *widget,
bcd = (BrightnessContrastDialog *) data;
if (GTK_WIDGET_VISIBLE (bcd->shell))
gtk_widget_hide (bcd->shell);
gimp_dialog_hide (bcd->shell);
active_tool->preserve = TRUE;
@ -404,8 +403,7 @@ brightness_contrast_cancel_callback (GtkWidget *widget,
bcd = (BrightnessContrastDialog *) data;
if (GTK_WIDGET_VISIBLE (bcd->shell))
gtk_widget_hide (bcd->shell);
gimp_dialog_hide (bcd->shell);
if (bcd->image_map)
{

View File

@ -786,7 +786,7 @@ by_color_select_dialog_new (void)
gtk_widget_show (bcd->shell);
gtk_signal_connect_object (GTK_OBJECT (bcd->shell), "unmap_event",
GTK_SIGNAL_FUNC (gtk_widget_hide),
GTK_SIGNAL_FUNC (gimp_dialog_hide),
(gpointer) bcd->shell);
return bcd;
@ -978,8 +978,7 @@ by_color_select_close_callback (GtkWidget *widget,
bcd = (ByColorDialog *) data;
if (GTK_WIDGET_VISIBLE (bcd->shell))
gtk_widget_hide (bcd->shell);
gimp_dialog_hide (bcd->shell);
if (bcd->gimage && gimp_set_have (image_context, bcd->gimage))
{

View File

@ -569,8 +569,7 @@ color_balance_ok_callback (GtkWidget *widget,
cbd = (ColorBalanceDialog *) data;
if (GTK_WIDGET_VISIBLE (cbd->shell))
gtk_widget_hide (cbd->shell);
gimp_dialog_hide (cbd->shell);
active_tool->preserve = TRUE;
@ -596,8 +595,7 @@ color_balance_cancel_callback (GtkWidget *widget,
cbd = (ColorBalanceDialog *) data;
if (GTK_WIDGET_VISIBLE (cbd->shell))
gtk_widget_hide (cbd->shell);
gimp_dialog_hide (cbd->shell);
if (cbd->image_map)
{

View File

@ -1213,8 +1213,7 @@ curves_ok_callback (GtkWidget *widget,
cd = (CurvesDialog *) data;
if (GTK_WIDGET_VISIBLE (cd->shell))
gtk_widget_hide (cd->shell);
gimp_dialog_hide (cd->shell);
active_tool->preserve = TRUE; /* We're about to dirty... */
@ -1241,8 +1240,7 @@ curves_cancel_callback (GtkWidget *widget,
cd = (CurvesDialog *) data;
if (GTK_WIDGET_VISIBLE (cd->shell))
gtk_widget_hide (cd->shell);
gimp_dialog_hide (cd->shell);
if (cd->image_map)
{
@ -1637,14 +1635,14 @@ file_dialog_ok_callback (GtkWidget *widget,
fclose (f);
}
gtk_widget_hide (file_dlg);
file_dialog_cancel_callback (file_dlg, NULL);
}
static void
file_dialog_cancel_callback (GtkWidget *widget,
gpointer data)
{
gtk_widget_hide (file_dlg);
gimp_dialog_hide (file_dlg);
}
static gboolean

View File

@ -1648,7 +1648,7 @@ file_dialog_show (GtkWidget *filesel)
static int
file_dialog_hide (GtkWidget *filesel)
{
gtk_widget_hide (filesel);
gimp_dialog_hide (filesel);
menus_set_sensitive ("<Toolbox>/File/Open...", TRUE);
menus_set_sensitive ("<Image>/File/Open...", TRUE);

View File

@ -165,3 +165,27 @@ gimp_message_box_close_callback (GtkWidget *widget,
g_free (msg_box->message);
g_free (msg_box);
}
/*
* A workaround for what I think is a GTK+ bug:
* If a dialog is hidden using gtk_widget_hide(),
* and was iconified before, it is still present
* in the window_list and can be deiconified by
* the user later. All subsequent calls to
* gtk_widget_hide() will then fail since the state
* of the widget is still INVISIBLE.
* Calling gdk_window_withdraw() seems to solve this.
* --Sven
*/
void
gimp_dialog_hide (GtkWidget *dialog)
{
g_return_if_fail (dialog != NULL && !GTK_WIDGET_NO_WINDOW (dialog));
gtk_widget_hide (dialog);
gdk_window_withdraw (dialog->window);
}

View File

@ -40,4 +40,6 @@ void gimp_message_box (gchar *message,
GtkCallback callback,
gpointer data);
void gimp_dialog_hide (GtkWidget *dialog);
#endif /* __GIMP_UI_H__ */

View File

@ -386,8 +386,7 @@ histogram_tool_close_callback (GtkWidget *widget,
htd = (HistogramToolDialog *) data;
if (GTK_WIDGET_VISIBLE (htd->shell))
gtk_widget_hide (htd->shell);
gimp_dialog_hide (htd->shell);
active_tool->gdisp_ptr = NULL;
active_tool->drawable = NULL;

View File

@ -674,8 +674,7 @@ hue_saturation_ok_callback (GtkWidget *widget,
hsd = (HueSaturationDialog *) data;
if (GTK_WIDGET_VISIBLE (hsd->shell))
gtk_widget_hide (hsd->shell);
gimp_dialog_hide (hsd->shell);
active_tool->preserve = TRUE;
@ -701,8 +700,7 @@ hue_saturation_cancel_callback (GtkWidget *widget,
hsd = (HueSaturationDialog *) data;
if (GTK_WIDGET_VISIBLE (hsd->shell))
gtk_widget_hide (hsd->shell);
gimp_dialog_hide (hsd->shell);
if (hsd->image_map)
{

View File

@ -960,8 +960,7 @@ levels_ok_callback (GtkWidget *widget,
ld = (LevelsDialog *) data;
if (GTK_WIDGET_VISIBLE (ld->shell))
gtk_widget_hide (ld->shell);
gimp_dialog_hide (ld->shell);
active_tool->preserve = TRUE;
@ -993,8 +992,7 @@ levels_cancel_callback (GtkWidget *widget,
ld = (LevelsDialog *) data;
if (GTK_WIDGET_VISIBLE (ld->shell))
gtk_widget_hide (ld->shell);
gimp_dialog_hide (ld->shell);
if (ld->image_map)
{
@ -1455,15 +1453,14 @@ file_dialog_ok_callback (GtkWidget *widget,
fclose (f);
}
gtk_widget_hide (file_dlg);
file_dialog_cancel_callback (file_dlg, NULL);
}
static void
file_dialog_cancel_callback (GtkWidget *widget,
gpointer data)
{
gtk_widget_hide (file_dlg);
gimp_dialog_hide (file_dlg);
}
static gboolean

View File

@ -288,8 +288,7 @@ posterize_ok_callback (GtkWidget *widget,
pd = (PosterizeDialog *) data;
if (GTK_WIDGET_VISIBLE (pd->shell))
gtk_widget_hide (pd->shell);
gimp_dialog_hide (pd->shell);
active_tool->preserve = TRUE;
@ -320,8 +319,7 @@ posterize_cancel_callback (GtkWidget *widget,
pd = (PosterizeDialog *) data;
if (GTK_WIDGET_VISIBLE (pd->shell))
gtk_widget_hide (pd->shell);
gimp_dialog_hide (pd->shell);
if (pd->image_map)
{

View File

@ -256,8 +256,8 @@ tools_free_text (Tool *tool)
g_free (tool->private);
the_text_tool = NULL;
if (text_tool_shell && GTK_WIDGET_VISIBLE (text_tool_shell))
gtk_widget_hide (text_tool_shell);
if (text_tool_shell)
gimp_dialog_hide (text_tool_shell);
}
static void
@ -377,8 +377,8 @@ text_control (Tool *tool,
break;
case HALT:
if (text_tool_shell && GTK_WIDGET_VISIBLE (text_tool_shell))
gtk_widget_hide (text_tool_shell);
if (text_tool_shell)
gimp_dialog_hide (text_tool_shell);
break;
default:
@ -419,8 +419,7 @@ static void
text_dialog_ok_callback (GtkWidget *widget,
gpointer data)
{
if (GTK_WIDGET_VISIBLE (text_tool_shell))
gtk_widget_hide (text_tool_shell);
gimp_dialog_hide (text_tool_shell);
if (the_text_tool)
text_init_render (the_text_tool);
@ -440,8 +439,7 @@ static void
text_dialog_cancel_callback (GtkWidget *widget,
gpointer data)
{
if (GTK_WIDGET_VISIBLE (text_tool_shell))
gtk_widget_hide (text_tool_shell);
gimp_dialog_hide (text_tool_shell);
}
static void

View File

@ -421,8 +421,7 @@ threshold_ok_callback (GtkWidget *widget,
td = (ThresholdDialog *) data;
if (GTK_WIDGET_VISIBLE (td->shell))
gtk_widget_hide (td->shell);
gimp_dialog_hide (td->shell);
active_tool->preserve = TRUE;
@ -448,8 +447,7 @@ threshold_cancel_callback (GtkWidget *widget,
td = (ThresholdDialog *) data;
if (GTK_WIDGET_VISIBLE (td->shell))
gtk_widget_hide (td->shell);
gimp_dialog_hide (td->shell);
if (td->image_map)
{

View File

@ -371,8 +371,7 @@ brightness_contrast_ok_callback (GtkWidget *widget,
bcd = (BrightnessContrastDialog *) data;
if (GTK_WIDGET_VISIBLE (bcd->shell))
gtk_widget_hide (bcd->shell);
gimp_dialog_hide (bcd->shell);
active_tool->preserve = TRUE;
@ -404,8 +403,7 @@ brightness_contrast_cancel_callback (GtkWidget *widget,
bcd = (BrightnessContrastDialog *) data;
if (GTK_WIDGET_VISIBLE (bcd->shell))
gtk_widget_hide (bcd->shell);
gimp_dialog_hide (bcd->shell);
if (bcd->image_map)
{

View File

@ -786,7 +786,7 @@ by_color_select_dialog_new (void)
gtk_widget_show (bcd->shell);
gtk_signal_connect_object (GTK_OBJECT (bcd->shell), "unmap_event",
GTK_SIGNAL_FUNC (gtk_widget_hide),
GTK_SIGNAL_FUNC (gimp_dialog_hide),
(gpointer) bcd->shell);
return bcd;
@ -978,8 +978,7 @@ by_color_select_close_callback (GtkWidget *widget,
bcd = (ByColorDialog *) data;
if (GTK_WIDGET_VISIBLE (bcd->shell))
gtk_widget_hide (bcd->shell);
gimp_dialog_hide (bcd->shell);
if (bcd->gimage && gimp_set_have (image_context, bcd->gimage))
{

View File

@ -569,8 +569,7 @@ color_balance_ok_callback (GtkWidget *widget,
cbd = (ColorBalanceDialog *) data;
if (GTK_WIDGET_VISIBLE (cbd->shell))
gtk_widget_hide (cbd->shell);
gimp_dialog_hide (cbd->shell);
active_tool->preserve = TRUE;
@ -596,8 +595,7 @@ color_balance_cancel_callback (GtkWidget *widget,
cbd = (ColorBalanceDialog *) data;
if (GTK_WIDGET_VISIBLE (cbd->shell))
gtk_widget_hide (cbd->shell);
gimp_dialog_hide (cbd->shell);
if (cbd->image_map)
{

View File

@ -1213,8 +1213,7 @@ curves_ok_callback (GtkWidget *widget,
cd = (CurvesDialog *) data;
if (GTK_WIDGET_VISIBLE (cd->shell))
gtk_widget_hide (cd->shell);
gimp_dialog_hide (cd->shell);
active_tool->preserve = TRUE; /* We're about to dirty... */
@ -1241,8 +1240,7 @@ curves_cancel_callback (GtkWidget *widget,
cd = (CurvesDialog *) data;
if (GTK_WIDGET_VISIBLE (cd->shell))
gtk_widget_hide (cd->shell);
gimp_dialog_hide (cd->shell);
if (cd->image_map)
{
@ -1637,14 +1635,14 @@ file_dialog_ok_callback (GtkWidget *widget,
fclose (f);
}
gtk_widget_hide (file_dlg);
file_dialog_cancel_callback (file_dlg, NULL);
}
static void
file_dialog_cancel_callback (GtkWidget *widget,
gpointer data)
{
gtk_widget_hide (file_dlg);
gimp_dialog_hide (file_dlg);
}
static gboolean

View File

@ -371,8 +371,7 @@ brightness_contrast_ok_callback (GtkWidget *widget,
bcd = (BrightnessContrastDialog *) data;
if (GTK_WIDGET_VISIBLE (bcd->shell))
gtk_widget_hide (bcd->shell);
gimp_dialog_hide (bcd->shell);
active_tool->preserve = TRUE;
@ -404,8 +403,7 @@ brightness_contrast_cancel_callback (GtkWidget *widget,
bcd = (BrightnessContrastDialog *) data;
if (GTK_WIDGET_VISIBLE (bcd->shell))
gtk_widget_hide (bcd->shell);
gimp_dialog_hide (bcd->shell);
if (bcd->image_map)
{

View File

@ -786,7 +786,7 @@ by_color_select_dialog_new (void)
gtk_widget_show (bcd->shell);
gtk_signal_connect_object (GTK_OBJECT (bcd->shell), "unmap_event",
GTK_SIGNAL_FUNC (gtk_widget_hide),
GTK_SIGNAL_FUNC (gimp_dialog_hide),
(gpointer) bcd->shell);
return bcd;
@ -978,8 +978,7 @@ by_color_select_close_callback (GtkWidget *widget,
bcd = (ByColorDialog *) data;
if (GTK_WIDGET_VISIBLE (bcd->shell))
gtk_widget_hide (bcd->shell);
gimp_dialog_hide (bcd->shell);
if (bcd->gimage && gimp_set_have (image_context, bcd->gimage))
{

View File

@ -569,8 +569,7 @@ color_balance_ok_callback (GtkWidget *widget,
cbd = (ColorBalanceDialog *) data;
if (GTK_WIDGET_VISIBLE (cbd->shell))
gtk_widget_hide (cbd->shell);
gimp_dialog_hide (cbd->shell);
active_tool->preserve = TRUE;
@ -596,8 +595,7 @@ color_balance_cancel_callback (GtkWidget *widget,
cbd = (ColorBalanceDialog *) data;
if (GTK_WIDGET_VISIBLE (cbd->shell))
gtk_widget_hide (cbd->shell);
gimp_dialog_hide (cbd->shell);
if (cbd->image_map)
{

View File

@ -1213,8 +1213,7 @@ curves_ok_callback (GtkWidget *widget,
cd = (CurvesDialog *) data;
if (GTK_WIDGET_VISIBLE (cd->shell))
gtk_widget_hide (cd->shell);
gimp_dialog_hide (cd->shell);
active_tool->preserve = TRUE; /* We're about to dirty... */
@ -1241,8 +1240,7 @@ curves_cancel_callback (GtkWidget *widget,
cd = (CurvesDialog *) data;
if (GTK_WIDGET_VISIBLE (cd->shell))
gtk_widget_hide (cd->shell);
gimp_dialog_hide (cd->shell);
if (cd->image_map)
{
@ -1637,14 +1635,14 @@ file_dialog_ok_callback (GtkWidget *widget,
fclose (f);
}
gtk_widget_hide (file_dlg);
file_dialog_cancel_callback (file_dlg, NULL);
}
static void
file_dialog_cancel_callback (GtkWidget *widget,
gpointer data)
{
gtk_widget_hide (file_dlg);
gimp_dialog_hide (file_dlg);
}
static gboolean

View File

@ -386,8 +386,7 @@ histogram_tool_close_callback (GtkWidget *widget,
htd = (HistogramToolDialog *) data;
if (GTK_WIDGET_VISIBLE (htd->shell))
gtk_widget_hide (htd->shell);
gimp_dialog_hide (htd->shell);
active_tool->gdisp_ptr = NULL;
active_tool->drawable = NULL;

View File

@ -674,8 +674,7 @@ hue_saturation_ok_callback (GtkWidget *widget,
hsd = (HueSaturationDialog *) data;
if (GTK_WIDGET_VISIBLE (hsd->shell))
gtk_widget_hide (hsd->shell);
gimp_dialog_hide (hsd->shell);
active_tool->preserve = TRUE;
@ -701,8 +700,7 @@ hue_saturation_cancel_callback (GtkWidget *widget,
hsd = (HueSaturationDialog *) data;
if (GTK_WIDGET_VISIBLE (hsd->shell))
gtk_widget_hide (hsd->shell);
gimp_dialog_hide (hsd->shell);
if (hsd->image_map)
{

View File

@ -960,8 +960,7 @@ levels_ok_callback (GtkWidget *widget,
ld = (LevelsDialog *) data;
if (GTK_WIDGET_VISIBLE (ld->shell))
gtk_widget_hide (ld->shell);
gimp_dialog_hide (ld->shell);
active_tool->preserve = TRUE;
@ -993,8 +992,7 @@ levels_cancel_callback (GtkWidget *widget,
ld = (LevelsDialog *) data;
if (GTK_WIDGET_VISIBLE (ld->shell))
gtk_widget_hide (ld->shell);
gimp_dialog_hide (ld->shell);
if (ld->image_map)
{
@ -1455,15 +1453,14 @@ file_dialog_ok_callback (GtkWidget *widget,
fclose (f);
}
gtk_widget_hide (file_dlg);
file_dialog_cancel_callback (file_dlg, NULL);
}
static void
file_dialog_cancel_callback (GtkWidget *widget,
gpointer data)
{
gtk_widget_hide (file_dlg);
gimp_dialog_hide (file_dlg);
}
static gboolean

View File

@ -288,8 +288,7 @@ posterize_ok_callback (GtkWidget *widget,
pd = (PosterizeDialog *) data;
if (GTK_WIDGET_VISIBLE (pd->shell))
gtk_widget_hide (pd->shell);
gimp_dialog_hide (pd->shell);
active_tool->preserve = TRUE;
@ -320,8 +319,7 @@ posterize_cancel_callback (GtkWidget *widget,
pd = (PosterizeDialog *) data;
if (GTK_WIDGET_VISIBLE (pd->shell))
gtk_widget_hide (pd->shell);
gimp_dialog_hide (pd->shell);
if (pd->image_map)
{

View File

@ -256,8 +256,8 @@ tools_free_text (Tool *tool)
g_free (tool->private);
the_text_tool = NULL;
if (text_tool_shell && GTK_WIDGET_VISIBLE (text_tool_shell))
gtk_widget_hide (text_tool_shell);
if (text_tool_shell)
gimp_dialog_hide (text_tool_shell);
}
static void
@ -377,8 +377,8 @@ text_control (Tool *tool,
break;
case HALT:
if (text_tool_shell && GTK_WIDGET_VISIBLE (text_tool_shell))
gtk_widget_hide (text_tool_shell);
if (text_tool_shell)
gimp_dialog_hide (text_tool_shell);
break;
default:
@ -419,8 +419,7 @@ static void
text_dialog_ok_callback (GtkWidget *widget,
gpointer data)
{
if (GTK_WIDGET_VISIBLE (text_tool_shell))
gtk_widget_hide (text_tool_shell);
gimp_dialog_hide (text_tool_shell);
if (the_text_tool)
text_init_render (the_text_tool);
@ -440,8 +439,7 @@ static void
text_dialog_cancel_callback (GtkWidget *widget,
gpointer data)
{
if (GTK_WIDGET_VISIBLE (text_tool_shell))
gtk_widget_hide (text_tool_shell);
gimp_dialog_hide (text_tool_shell);
}
static void

View File

@ -421,8 +421,7 @@ threshold_ok_callback (GtkWidget *widget,
td = (ThresholdDialog *) data;
if (GTK_WIDGET_VISIBLE (td->shell))
gtk_widget_hide (td->shell);
gimp_dialog_hide (td->shell);
active_tool->preserve = TRUE;
@ -448,8 +447,7 @@ threshold_cancel_callback (GtkWidget *widget,
td = (ThresholdDialog *) data;
if (GTK_WIDGET_VISIBLE (td->shell))
gtk_widget_hide (td->shell);
gimp_dialog_hide (td->shell);
if (td->image_map)
{

View File

@ -386,8 +386,7 @@ histogram_tool_close_callback (GtkWidget *widget,
htd = (HistogramToolDialog *) data;
if (GTK_WIDGET_VISIBLE (htd->shell))
gtk_widget_hide (htd->shell);
gimp_dialog_hide (htd->shell);
active_tool->gdisp_ptr = NULL;
active_tool->drawable = NULL;

View File

@ -674,8 +674,7 @@ hue_saturation_ok_callback (GtkWidget *widget,
hsd = (HueSaturationDialog *) data;
if (GTK_WIDGET_VISIBLE (hsd->shell))
gtk_widget_hide (hsd->shell);
gimp_dialog_hide (hsd->shell);
active_tool->preserve = TRUE;
@ -701,8 +700,7 @@ hue_saturation_cancel_callback (GtkWidget *widget,
hsd = (HueSaturationDialog *) data;
if (GTK_WIDGET_VISIBLE (hsd->shell))
gtk_widget_hide (hsd->shell);
gimp_dialog_hide (hsd->shell);
if (hsd->image_map)
{

View File

@ -960,8 +960,7 @@ levels_ok_callback (GtkWidget *widget,
ld = (LevelsDialog *) data;
if (GTK_WIDGET_VISIBLE (ld->shell))
gtk_widget_hide (ld->shell);
gimp_dialog_hide (ld->shell);
active_tool->preserve = TRUE;
@ -993,8 +992,7 @@ levels_cancel_callback (GtkWidget *widget,
ld = (LevelsDialog *) data;
if (GTK_WIDGET_VISIBLE (ld->shell))
gtk_widget_hide (ld->shell);
gimp_dialog_hide (ld->shell);
if (ld->image_map)
{
@ -1455,15 +1453,14 @@ file_dialog_ok_callback (GtkWidget *widget,
fclose (f);
}
gtk_widget_hide (file_dlg);
file_dialog_cancel_callback (file_dlg, NULL);
}
static void
file_dialog_cancel_callback (GtkWidget *widget,
gpointer data)
{
gtk_widget_hide (file_dlg);
gimp_dialog_hide (file_dlg);
}
static gboolean

View File

@ -288,8 +288,7 @@ posterize_ok_callback (GtkWidget *widget,
pd = (PosterizeDialog *) data;
if (GTK_WIDGET_VISIBLE (pd->shell))
gtk_widget_hide (pd->shell);
gimp_dialog_hide (pd->shell);
active_tool->preserve = TRUE;
@ -320,8 +319,7 @@ posterize_cancel_callback (GtkWidget *widget,
pd = (PosterizeDialog *) data;
if (GTK_WIDGET_VISIBLE (pd->shell))
gtk_widget_hide (pd->shell);
gimp_dialog_hide (pd->shell);
if (pd->image_map)
{

View File

@ -256,8 +256,8 @@ tools_free_text (Tool *tool)
g_free (tool->private);
the_text_tool = NULL;
if (text_tool_shell && GTK_WIDGET_VISIBLE (text_tool_shell))
gtk_widget_hide (text_tool_shell);
if (text_tool_shell)
gimp_dialog_hide (text_tool_shell);
}
static void
@ -377,8 +377,8 @@ text_control (Tool *tool,
break;
case HALT:
if (text_tool_shell && GTK_WIDGET_VISIBLE (text_tool_shell))
gtk_widget_hide (text_tool_shell);
if (text_tool_shell)
gimp_dialog_hide (text_tool_shell);
break;
default:
@ -419,8 +419,7 @@ static void
text_dialog_ok_callback (GtkWidget *widget,
gpointer data)
{
if (GTK_WIDGET_VISIBLE (text_tool_shell))
gtk_widget_hide (text_tool_shell);
gimp_dialog_hide (text_tool_shell);
if (the_text_tool)
text_init_render (the_text_tool);
@ -440,8 +439,7 @@ static void
text_dialog_cancel_callback (GtkWidget *widget,
gpointer data)
{
if (GTK_WIDGET_VISIBLE (text_tool_shell))
gtk_widget_hide (text_tool_shell);
gimp_dialog_hide (text_tool_shell);
}
static void

View File

@ -421,8 +421,7 @@ threshold_ok_callback (GtkWidget *widget,
td = (ThresholdDialog *) data;
if (GTK_WIDGET_VISIBLE (td->shell))
gtk_widget_hide (td->shell);
gimp_dialog_hide (td->shell);
active_tool->preserve = TRUE;
@ -448,8 +447,7 @@ threshold_cancel_callback (GtkWidget *widget,
td = (ThresholdDialog *) data;
if (GTK_WIDGET_VISIBLE (td->shell))
gtk_widget_hide (td->shell);
gimp_dialog_hide (td->shell);
if (td->image_map)
{

View File

@ -165,3 +165,27 @@ gimp_message_box_close_callback (GtkWidget *widget,
g_free (msg_box->message);
g_free (msg_box);
}
/*
* A workaround for what I think is a GTK+ bug:
* If a dialog is hidden using gtk_widget_hide(),
* and was iconified before, it is still present
* in the window_list and can be deiconified by
* the user later. All subsequent calls to
* gtk_widget_hide() will then fail since the state
* of the widget is still INVISIBLE.
* Calling gdk_window_withdraw() seems to solve this.
* --Sven
*/
void
gimp_dialog_hide (GtkWidget *dialog)
{
g_return_if_fail (dialog != NULL && !GTK_WIDGET_NO_WINDOW (dialog));
gtk_widget_hide (dialog);
gdk_window_withdraw (dialog->window);
}

View File

@ -40,4 +40,6 @@ void gimp_message_box (gchar *message,
GtkCallback callback,
gpointer data);
void gimp_dialog_hide (GtkWidget *dialog);
#endif /* __GIMP_UI_H__ */