From 9eec86b770c898b0a7ae8dc016d7b786a4973118 Mon Sep 17 00:00:00 2001 From: Owen Taylor Date: Wed, 28 Mar 2001 17:43:08 +0000 Subject: [PATCH] Fix problem where dropping into internal child widgets (such as GtkCList Wed Mar 28 12:33:20 2001 Owen Taylor * gtk/gtkdnd.c: Fix problem where dropping into internal child widgets (such as GtkCList tab labels) (#52457, reported by Daniel Erat). Can't use gtk_container_children(), so provide a substitute which uses gtk_container_forall(). --- ChangeLog | 8 ++++++++ ChangeLog.pre-2-0 | 8 ++++++++ ChangeLog.pre-2-10 | 8 ++++++++ ChangeLog.pre-2-2 | 8 ++++++++ ChangeLog.pre-2-4 | 8 ++++++++ ChangeLog.pre-2-6 | 8 ++++++++ ChangeLog.pre-2-8 | 8 ++++++++ gtk/gtkdnd.c | 32 +++++++++++++++++++++++++++++--- 8 files changed, 85 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index aaed3da486..86ea2d9d5b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Wed Mar 28 12:33:20 2001 Owen Taylor + + * gtk/gtkdnd.c: Fix problem where dropping into + internal child widgets (such as GtkCList tab labels) + (#52457, reported by Daniel Erat). Can't use + gtk_container_children(), so provide a substitute + which uses gtk_container_forall(). + 2001-03-22 Darin Adler * gtk/gtkobject.h: Fixed #if G_ENABLE_DEBUG that diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index aaed3da486..86ea2d9d5b 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,11 @@ +Wed Mar 28 12:33:20 2001 Owen Taylor + + * gtk/gtkdnd.c: Fix problem where dropping into + internal child widgets (such as GtkCList tab labels) + (#52457, reported by Daniel Erat). Can't use + gtk_container_children(), so provide a substitute + which uses gtk_container_forall(). + 2001-03-22 Darin Adler * gtk/gtkobject.h: Fixed #if G_ENABLE_DEBUG that diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index aaed3da486..86ea2d9d5b 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,11 @@ +Wed Mar 28 12:33:20 2001 Owen Taylor + + * gtk/gtkdnd.c: Fix problem where dropping into + internal child widgets (such as GtkCList tab labels) + (#52457, reported by Daniel Erat). Can't use + gtk_container_children(), so provide a substitute + which uses gtk_container_forall(). + 2001-03-22 Darin Adler * gtk/gtkobject.h: Fixed #if G_ENABLE_DEBUG that diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index aaed3da486..86ea2d9d5b 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,11 @@ +Wed Mar 28 12:33:20 2001 Owen Taylor + + * gtk/gtkdnd.c: Fix problem where dropping into + internal child widgets (such as GtkCList tab labels) + (#52457, reported by Daniel Erat). Can't use + gtk_container_children(), so provide a substitute + which uses gtk_container_forall(). + 2001-03-22 Darin Adler * gtk/gtkobject.h: Fixed #if G_ENABLE_DEBUG that diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index aaed3da486..86ea2d9d5b 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,11 @@ +Wed Mar 28 12:33:20 2001 Owen Taylor + + * gtk/gtkdnd.c: Fix problem where dropping into + internal child widgets (such as GtkCList tab labels) + (#52457, reported by Daniel Erat). Can't use + gtk_container_children(), so provide a substitute + which uses gtk_container_forall(). + 2001-03-22 Darin Adler * gtk/gtkobject.h: Fixed #if G_ENABLE_DEBUG that diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index aaed3da486..86ea2d9d5b 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,11 @@ +Wed Mar 28 12:33:20 2001 Owen Taylor + + * gtk/gtkdnd.c: Fix problem where dropping into + internal child widgets (such as GtkCList tab labels) + (#52457, reported by Daniel Erat). Can't use + gtk_container_children(), so provide a substitute + which uses gtk_container_forall(). + 2001-03-22 Darin Adler * gtk/gtkobject.h: Fixed #if G_ENABLE_DEBUG that diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index aaed3da486..86ea2d9d5b 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,11 @@ +Wed Mar 28 12:33:20 2001 Owen Taylor + + * gtk/gtkdnd.c: Fix problem where dropping into + internal child widgets (such as GtkCList tab labels) + (#52457, reported by Daniel Erat). Can't use + gtk_container_children(), so provide a substitute + which uses gtk_container_forall(). + 2001-03-22 Darin Adler * gtk/gtkobject.h: Fixed #if G_ENABLE_DEBUG that diff --git a/gtk/gtkdnd.c b/gtk/gtkdnd.c index e2114cc133..0e02a0648f 100644 --- a/gtk/gtkdnd.c +++ b/gtk/gtkdnd.c @@ -1194,6 +1194,34 @@ gtk_drag_selection_received (GtkWidget *widget, gtk_drag_release_ipc_widget (widget); } +static void +get_all_children_callback (GtkWidget *widget, + gpointer client_data) +{ + GList **children; + + children = (GList**) client_data; + gtk_widget_ref (widget); + + *children = g_list_prepend (*children, widget); +} + +static GList* +get_all_children (GtkContainer *container) +{ + GList *children; + + children = NULL; + + gtk_container_forall (container, + get_all_children_callback, + &children); + + return g_list_reverse (children); +} + + + /************************************************************* * gtk_drag_find_widget: * Recursive callback used to locate widgets for @@ -1272,7 +1300,7 @@ gtk_drag_find_widget (GtkWidget *widget, if (GTK_IS_CONTAINER (widget)) { GtkDragFindData new_data = *data; - GList *children = gtk_container_children (GTK_CONTAINER (widget)); + GList *children = get_all_children (GTK_CONTAINER (widget)); GList *tmp_list; new_data.x -= x_offset; @@ -1280,8 +1308,6 @@ gtk_drag_find_widget (GtkWidget *widget, new_data.found = FALSE; new_data.toplevel = FALSE; - g_list_foreach (children, (GFunc)gtk_widget_ref, NULL); - tmp_list = children; while (tmp_list) {