Fix problem with selecting a new focus child.

Sun Aug  5 09:48:08 2001  Owen Taylor  <otaylor@redhat.com>

	* gtk/gtklist.c (gtk_list_clear_items): Fix
	problem with selecting a new focus child.

	* gtk/gtklist.c (gtk_list_clear_items): Clear
	list->undo/list_focus_child after unparenting
	child, since unparenting the child can result
	in list->last_focus_child being set. (#58024)

	* Makefile.am (SUBDIRS): Add target specific pc
	files to DISTCLEANFILES.

	* gtk/Makefile.am: add @GTK_DEBUG_FLAGS@
	(58327, Matthias Clasen)
This commit is contained in:
Owen Taylor 2001-08-05 14:29:12 +00:00 committed by Owen Taylor
parent 9166ba51a1
commit 42cf380d36
3 changed files with 20 additions and 6 deletions

View File

@ -137,6 +137,12 @@ gdk-$(GDKTARGET)-2.0-uninstalled.pc: gdk-2.0-uninstalled.pc
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA= gdk-pixbuf-2.0.pc gdk-$(GDKTARGET)-2.0.pc gtk+-$(GDKTARGET)-2.0.pc
DISTCLEANFILES = \
gtk+-$(GDKTARGET)-2.0.pc \
gdk-$(GDKTARGET)-2.0.pc \
gtk+-$(GDKTARGET)-2.0-uninstalled.pc \
gdk-$(GDKTARGET)-2.0-uninstalled.pc
## symlink gdk-2.0.pc and gtk+-2.0.pc to default target for the platform
DEFAULT_GDKTARGET=x11
install-data-local:

View File

@ -16,6 +16,7 @@ INCLUDES = @STRIP_BEGIN@ \
-I$(top_srcdir) -I../gdk \
-I$(top_srcdir)/gdk \
-I$(top_srcdir)/gdk-pixbuf -I../gdk-pixbuf \
@GTK_DEBUG_FLAGS@ \
@GTK_DEP_CFLAGS@ \
@STRIP_END@

View File

@ -1180,7 +1180,7 @@ gtk_list_clear_items (GtkList *list,
if (start_list->prev)
new_focus_child = start_list->prev->data;
else if (list->children)
new_focus_child = list->children->prev->data;
new_focus_child = list->children->data;
if (GTK_WIDGET_HAS_FOCUS (container->focus_child))
grab_focus = TRUE;
@ -1193,16 +1193,20 @@ gtk_list_clear_items (GtkList *list,
widget = tmp_list->data;
tmp_list = tmp_list->next;
gtk_widget_ref (widget);
if (widget->state == GTK_STATE_SELECTED)
gtk_list_unselect_child (list, widget);
gtk_signal_disconnect_by_data (GTK_OBJECT (widget), (gpointer) list);
gtk_widget_unparent (widget);
if (widget == list->undo_focus_child)
list->undo_focus_child = NULL;
if (widget == list->last_focus_child)
list->last_focus_child = NULL;
gtk_signal_disconnect_by_data (GTK_OBJECT (widget), (gpointer) list);
gtk_widget_unparent (widget);
gtk_widget_unref (widget);
}
g_list_free (start_list);
@ -1310,6 +1314,7 @@ gtk_list_remove_items_internal (GtkList *list,
widget = tmp_list->data;
tmp_list = tmp_list->next;
gtk_widget_ref (widget);
if (no_unref)
gtk_widget_ref (widget);
@ -1328,14 +1333,16 @@ gtk_list_remove_items_internal (GtkList *list,
}
}
gtk_signal_disconnect_by_data (GTK_OBJECT (widget), (gpointer) list);
list->children = g_list_remove (list->children, widget);
gtk_widget_unparent (widget);
if (widget == list->undo_focus_child)
list->undo_focus_child = NULL;
if (widget == list->last_focus_child)
list->last_focus_child = NULL;
gtk_signal_disconnect_by_data (GTK_OBJECT (widget), (gpointer) list);
list->children = g_list_remove (list->children, widget);
gtk_widget_unparent (widget);
gtk_widget_unref (widget);
}
if (new_focus_child && new_focus_child != old_focus_child)