diff --git a/ChangeLog b/ChangeLog index 8b0a4efffe..e2ee6040a8 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Wed Jan 14 18:01:52 2004 Jonathan Blandford + + * gtk/gtktreeview.c (gtk_tree_view_button_press): move grab_focus + to after handling the button presses in the TreeView to avoid + getting multiple selection_changes() + Wed Jan 14 21:16:20 2004 Matthias Clasen * gtk/gtkimcontext.c: Documentation fix. (#131335, Theppitak diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 8b0a4efffe..e2ee6040a8 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,9 @@ +Wed Jan 14 18:01:52 2004 Jonathan Blandford + + * gtk/gtktreeview.c (gtk_tree_view_button_press): move grab_focus + to after handling the button presses in the TreeView to avoid + getting multiple selection_changes() + Wed Jan 14 21:16:20 2004 Matthias Clasen * gtk/gtkimcontext.c: Documentation fix. (#131335, Theppitak diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index 8b0a4efffe..e2ee6040a8 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,9 @@ +Wed Jan 14 18:01:52 2004 Jonathan Blandford + + * gtk/gtktreeview.c (gtk_tree_view_button_press): move grab_focus + to after handling the button presses in the TreeView to avoid + getting multiple selection_changes() + Wed Jan 14 21:16:20 2004 Matthias Clasen * gtk/gtkimcontext.c: Documentation fix. (#131335, Theppitak diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 8b0a4efffe..e2ee6040a8 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,9 @@ +Wed Jan 14 18:01:52 2004 Jonathan Blandford + + * gtk/gtktreeview.c (gtk_tree_view_button_press): move grab_focus + to after handling the button presses in the TreeView to avoid + getting multiple selection_changes() + Wed Jan 14 21:16:20 2004 Matthias Clasen * gtk/gtkimcontext.c: Documentation fix. (#131335, Theppitak diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 8b0a4efffe..e2ee6040a8 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,9 @@ +Wed Jan 14 18:01:52 2004 Jonathan Blandford + + * gtk/gtktreeview.c (gtk_tree_view_button_press): move grab_focus + to after handling the button presses in the TreeView to avoid + getting multiple selection_changes() + Wed Jan 14 21:16:20 2004 Matthias Clasen * gtk/gtkimcontext.c: Documentation fix. (#131335, Theppitak diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 36bc851a55..07bfa0a039 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -2013,16 +2013,13 @@ gtk_tree_view_button_press (GtkWidget *widget, "horizontal_separator", &horizontal_separator, NULL); - /* put this separate, because the user might remove the latest - * treeview node in the focus-in-event callback. If so, the code - * flow won't enter the second if. + + /* Because grab_focus can cause reentrancy, we delay grab_focus until after + * we're done handling the button press. */ if (event->window == tree_view->priv->bin_window && tree_view->priv->tree != NULL) { - if (!GTK_WIDGET_HAS_FOCUS (widget)) - gtk_widget_grab_focus (widget); - GTK_TREE_VIEW_UNSET_FLAG (tree_view, GTK_TREE_VIEW_DRAW_KEYFOCUS); } if (event->window == tree_view->priv->bin_window && @@ -2059,6 +2056,9 @@ gtk_tree_view_button_press (GtkWidget *widget, event->x, event->y); } + if (!GTK_WIDGET_HAS_FOCUS (widget)) + gtk_widget_grab_focus (widget); + GTK_TREE_VIEW_UNSET_FLAG (tree_view, GTK_TREE_VIEW_DRAW_KEYFOCUS); return TRUE; } @@ -2069,8 +2069,13 @@ gtk_tree_view_button_press (GtkWidget *widget, y_offset = -_gtk_rbtree_find_offset (tree_view->priv->tree, new_y, &tree, &node); if (node == NULL) - /* We clicked in dead space */ - return TRUE; + { + /* We clicked in dead space */ + if (!GTK_WIDGET_HAS_FOCUS (widget)) + gtk_widget_grab_focus (widget); + GTK_TREE_VIEW_UNSET_FLAG (tree_view, GTK_TREE_VIEW_DRAW_KEYFOCUS); + return TRUE; + } /* Get the path and the node */ path = _gtk_tree_view_find_path (tree_view, tree, node); @@ -2117,7 +2122,9 @@ gtk_tree_view_button_press (GtkWidget *widget, if (column == NULL) { gtk_tree_path_free (path); - + if (!GTK_WIDGET_HAS_FOCUS (widget)) + gtk_widget_grab_focus (widget); + GTK_TREE_VIEW_UNSET_FLAG (tree_view, GTK_TREE_VIEW_DRAW_KEYFOCUS); return FALSE; } @@ -2287,8 +2294,6 @@ gtk_tree_view_button_press (GtkWidget *widget, } } - GTK_TREE_VIEW_UNSET_FLAG (tree_view, GTK_TREE_VIEW_DRAW_KEYFOCUS); - if (row_double_click) { gtk_grab_remove (widget); @@ -2300,6 +2305,10 @@ gtk_tree_view_button_press (GtkWidget *widget, gtk_tree_path_free (path); + if (!GTK_WIDGET_HAS_FOCUS (widget)) + gtk_widget_grab_focus (widget); + GTK_TREE_VIEW_UNSET_FLAG (tree_view, GTK_TREE_VIEW_DRAW_KEYFOCUS); + return TRUE; }