From 5624588e5d294b55bc79a5d7e5add87aa628f66e Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 24 Feb 2005 16:44:02 +0000 Subject: [PATCH] Fix #167259, reported by Christian Persch: 2005-02-24 Matthias Clasen Fix #167259, reported by Christian Persch: * gtk/gtkwidget.c (gtk_widget_unparent): Unmap the reparented widget, even if we avoid the unrealizing. (gtk_widget_reparent_subwindows): Make reparenting work for !NO_WINDOW widgets which have other windows which are siblings of widget->window (as e.g. GtkSpinButton). --- ChangeLog | 10 ++++++++++ ChangeLog.pre-2-10 | 10 ++++++++++ ChangeLog.pre-2-8 | 10 ++++++++++ gtk/gtkwidget.c | 27 ++++++++++++++++++++++++--- 4 files changed, 54 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 332368d5d0..4f03e84ac9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-02-24 Matthias Clasen + + Fix #167259, reported by Christian Persch: + + * gtk/gtkwidget.c (gtk_widget_unparent): Unmap the reparented + widget, even if we avoid the unrealizing. + (gtk_widget_reparent_subwindows): Make reparenting work for + !NO_WINDOW widgets which have other windows which are siblings + of widget->window (as e.g. GtkSpinButton). + 2005-02-24 Matthias Clasen * gtk/gtktreemodelfilter.c (gtk_tree_model_filter_row_changed): diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 332368d5d0..4f03e84ac9 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,13 @@ +2005-02-24 Matthias Clasen + + Fix #167259, reported by Christian Persch: + + * gtk/gtkwidget.c (gtk_widget_unparent): Unmap the reparented + widget, even if we avoid the unrealizing. + (gtk_widget_reparent_subwindows): Make reparenting work for + !NO_WINDOW widgets which have other windows which are siblings + of widget->window (as e.g. GtkSpinButton). + 2005-02-24 Matthias Clasen * gtk/gtktreemodelfilter.c (gtk_tree_model_filter_row_changed): diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 332368d5d0..4f03e84ac9 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,13 @@ +2005-02-24 Matthias Clasen + + Fix #167259, reported by Christian Persch: + + * gtk/gtkwidget.c (gtk_widget_unparent): Unmap the reparented + widget, even if we avoid the unrealizing. + (gtk_widget_reparent_subwindows): Make reparenting work for + !NO_WINDOW widgets which have other windows which are siblings + of widget->window (as e.g. GtkSpinButton). + 2005-02-24 Matthias Clasen * gtk/gtktreemodelfilter.c (gtk_tree_model_filter_row_changed): diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c index fbb2a5d9ab..3fc692d1d3 100644 --- a/gtk/gtkwidget.c +++ b/gtk/gtkwidget.c @@ -1898,8 +1898,13 @@ gtk_widget_unparent (GtkWidget *widget) widget->allocation.width = 1; widget->allocation.height = 1; - if (GTK_WIDGET_REALIZED (widget) && !GTK_WIDGET_IN_REPARENT (widget)) - gtk_widget_unrealize (widget); + if (GTK_WIDGET_REALIZED (widget)) + { + if (GTK_WIDGET_IN_REPARENT (widget)) + gtk_widget_unmap (widget); + else + gtk_widget_unrealize (widget); + } /* Removing a widget from a container restores the child visible * flag to the default state, so it doesn't affect the child @@ -3724,7 +3729,23 @@ gtk_widget_reparent_subwindows (GtkWidget *widget, g_list_free (children); } else - gdk_window_reparent (widget->window, new_window, 0, 0); + { + GdkWindow *parent = gdk_window_get_parent (widget->window); + + GList *children = gdk_window_get_children (parent); + GList *tmp_list; + for (tmp_list = children; tmp_list; tmp_list = tmp_list->next) + { + GtkWidget *child; + GdkWindow *window = tmp_list->data; + + gdk_window_get_user_data (window, (void **)&child); + if (child == widget) + gdk_window_reparent (window, new_window, 0, 0); + } + + g_list_free (children); + } } static void