From 57bae555749aec7e0ff016a3db35af53d85ca844 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Mon, 2 Feb 1998 05:35:59 +0000 Subject: [PATCH] fixed a refresh bug with unrealization of no_window widgets. (dialog button in tesgtk) -timj --- glib/glibconfig.h.in | 6 +++--- gtk/gtkwidget.c | 7 ++++++- gtk/testgtk.c | 11 ++++++----- tests/testgtk.c | 11 ++++++----- 4 files changed, 21 insertions(+), 14 deletions(-) diff --git a/glib/glibconfig.h.in b/glib/glibconfig.h.in index f1b9eacfa4..3cf668fb3b 100644 --- a/glib/glibconfig.h.in +++ b/glib/glibconfig.h.in @@ -56,6 +56,9 @@ /* Define if you have the memmove function. */ #undef HAVE_MEMMOVE +/* Define if you have the strcasecmp function. */ +#undef HAVE_STRCASECMP + /* Define if you have the strerror function. */ #undef HAVE_STRERROR @@ -65,9 +68,6 @@ /* Define if you have the vsnprintf function. */ #undef HAVE_VSNPRINTF -/* Define if you have the strcasecmp function. */ -#undef HAVE_STRCASECMP - /* Define if you have the header file. */ #undef HAVE_FLOAT_H diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index eb3178bf61..d0b9c2dc88 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -3303,6 +3303,9 @@ gtk_widget_real_unrealize (GtkWidget *widget) g_return_if_fail (widget != NULL); g_return_if_fail (GTK_IS_WIDGET (widget)); + if (GTK_WIDGET_NO_WINDOW (widget) && GTK_WIDGET_MAPPED (widget)) + gtk_widget_real_unmap (widget); + GTK_WIDGET_UNSET_FLAGS (widget, GTK_REALIZED | GTK_MAPPED); /* printf ("unrealizing %s\n", gtk_type_name (GTK_OBJECT(widget)->klass->type)); @@ -3320,7 +3323,9 @@ gtk_widget_real_unrealize (GtkWidget *widget) gdk_window_destroy (widget->window); } else - gdk_window_unref (widget->window); + { + gdk_window_unref (widget->window); + } widget->window = NULL; } diff --git a/gtk/testgtk.c b/gtk/testgtk.c index e9f72751c6..6869f30965 100644 --- a/gtk/testgtk.c +++ b/gtk/testgtk.c @@ -2018,16 +2018,17 @@ label_toggle (GtkWidget *widget, if (!(*label)) { *label = gtk_label_new ("Dialog Test"); + gtk_signal_connect (GTK_OBJECT (*label), + "destroy", + GTK_SIGNAL_FUNC (gtk_widget_destroyed), + label); gtk_misc_set_padding (GTK_MISC (*label), 10, 10); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog_window)->vbox), *label, TRUE, TRUE, 0); gtk_widget_show (*label); } else - { - gtk_widget_destroy (*label); - *label = NULL; - } + gtk_widget_destroy (*label); } void @@ -2059,7 +2060,7 @@ create_dialog () button = gtk_button_new_with_label ("Toggle"); gtk_signal_connect (GTK_OBJECT (button), "clicked", - GTK_SIGNAL_FUNC(label_toggle), + GTK_SIGNAL_FUNC (label_toggle), &label); GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog_window)->action_area), diff --git a/tests/testgtk.c b/tests/testgtk.c index e9f72751c6..6869f30965 100644 --- a/tests/testgtk.c +++ b/tests/testgtk.c @@ -2018,16 +2018,17 @@ label_toggle (GtkWidget *widget, if (!(*label)) { *label = gtk_label_new ("Dialog Test"); + gtk_signal_connect (GTK_OBJECT (*label), + "destroy", + GTK_SIGNAL_FUNC (gtk_widget_destroyed), + label); gtk_misc_set_padding (GTK_MISC (*label), 10, 10); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog_window)->vbox), *label, TRUE, TRUE, 0); gtk_widget_show (*label); } else - { - gtk_widget_destroy (*label); - *label = NULL; - } + gtk_widget_destroy (*label); } void @@ -2059,7 +2060,7 @@ create_dialog () button = gtk_button_new_with_label ("Toggle"); gtk_signal_connect (GTK_OBJECT (button), "clicked", - GTK_SIGNAL_FUNC(label_toggle), + GTK_SIGNAL_FUNC (label_toggle), &label); GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT); gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog_window)->action_area),