diff options
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtktreeprivate.h | 4 | ||||
-rw-r--r-- | gtk/gtktreeview.c | 83 |
2 files changed, 46 insertions, 41 deletions
diff --git a/gtk/gtktreeprivate.h b/gtk/gtktreeprivate.h index 868d5cd4b..7f50f9fd2 100644 --- a/gtk/gtktreeprivate.h +++ b/gtk/gtktreeprivate.h @@ -101,8 +101,8 @@ struct _GtkTreeViewPrivate GdkWindow *drag_highlight_window; GtkTreeViewColumn *drag_column; - GtkTreeRowReference *last_single_clicked; - GtkTreeRowReference *last_single_clicked_2; + GtkTreeRowReference *last_button_press; + GtkTreeRowReference *last_button_press_2; /* bin_window offset */ GtkTreeRowReference *top_row; diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 730493a77..f748c78ed 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -1102,16 +1102,16 @@ gtk_tree_view_destroy (GtkObject *object) tree_view->priv->drag_dest_row = NULL; } - if (tree_view->priv->last_single_clicked != NULL) + if (tree_view->priv->last_button_press != NULL) { - gtk_tree_row_reference_free (tree_view->priv->last_single_clicked); - tree_view->priv->last_single_clicked = NULL; + gtk_tree_row_reference_free (tree_view->priv->last_button_press); + tree_view->priv->last_button_press = NULL; } - if (tree_view->priv->last_single_clicked_2 != NULL) + if (tree_view->priv->last_button_press_2 != NULL) { - gtk_tree_row_reference_free (tree_view->priv->last_single_clicked_2); - tree_view->priv->last_single_clicked_2 = NULL; + gtk_tree_row_reference_free (tree_view->priv->last_button_press_2); + tree_view->priv->last_button_press_2 = NULL; } if (tree_view->priv->top_row != NULL) @@ -1790,20 +1790,25 @@ gtk_tree_view_button_press (GtkWidget *widget, /* decide if we edit */ if (event->type == GDK_BUTTON_PRESS && - !(event->state & gtk_accelerator_get_default_mod_mask ()) && - tree_view->priv->cursor) + !(event->state & gtk_accelerator_get_default_mod_mask ())) { - GtkTreePath *cursor = gtk_tree_row_reference_get_path (tree_view->priv->cursor); + GtkTreePath *anchor; GtkTreeIter iter; - gtk_tree_model_get_iter (tree_view->priv->model, &iter, path); - gtk_tree_view_column_cell_set_cell_data (column, - tree_view->priv->model, - &iter, - GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_PARENT), - node->children?TRUE:FALSE); + if (tree_view->priv->anchor) + { + anchor = gtk_tree_row_reference_get_path (tree_view->priv->anchor); + gtk_tree_model_get_iter (tree_view->priv->model, &iter, path); + gtk_tree_view_column_cell_set_cell_data (column, + tree_view->priv->model, + &iter, + GTK_RBNODE_FLAG_SET (node, GTK_RBNODE_IS_PARENT), + node->children?TRUE:FALSE); + } + else + anchor = NULL; - if ((cursor && !gtk_tree_path_compare (cursor, path)) + if ((anchor && !gtk_tree_path_compare (anchor, path)) || !_gtk_tree_view_column_has_editable_cell (column)) { GtkCellEditable *cell_editable = NULL; @@ -1839,15 +1844,15 @@ gtk_tree_view_button_press (GtkWidget *widget, (GdkEvent *)event, flags); gtk_tree_path_free (path); - gtk_tree_path_free (cursor); + gtk_tree_path_free (anchor); return TRUE; } column_handled_click = TRUE; } g_free (path_string); } - if (cursor) - gtk_tree_path_free (cursor); + if (anchor) + gtk_tree_path_free (anchor); } /* select */ @@ -1890,18 +1895,18 @@ gtk_tree_view_button_press (GtkWidget *widget, } if (event->button == 1 && event->type == GDK_2BUTTON_PRESS && - tree_view->priv->last_single_clicked) + tree_view->priv->last_button_press) { GtkTreePath *lsc; - lsc = gtk_tree_row_reference_get_path (tree_view->priv->last_single_clicked); + lsc = gtk_tree_row_reference_get_path (tree_view->priv->last_button_press); - if (tree_view->priv->last_single_clicked) - gtk_tree_row_reference_free (tree_view->priv->last_single_clicked); - if (tree_view->priv->last_single_clicked_2) - gtk_tree_row_reference_free (tree_view->priv->last_single_clicked_2); - tree_view->priv->last_single_clicked = NULL; - tree_view->priv->last_single_clicked_2 = NULL; + if (tree_view->priv->last_button_press) + gtk_tree_row_reference_free (tree_view->priv->last_button_press); + if (tree_view->priv->last_button_press_2) + gtk_tree_row_reference_free (tree_view->priv->last_button_press_2); + tree_view->priv->last_button_press = NULL; + tree_view->priv->last_button_press_2 = NULL; if (lsc) { @@ -1912,10 +1917,10 @@ gtk_tree_view_button_press (GtkWidget *widget, } else if (event->button == 1 && event->type == GDK_BUTTON_PRESS) { - if (tree_view->priv->last_single_clicked) - gtk_tree_row_reference_free (tree_view->priv->last_single_clicked); - tree_view->priv->last_single_clicked = tree_view->priv->last_single_clicked_2; - tree_view->priv->last_single_clicked_2 = gtk_tree_row_reference_new_proxy (G_OBJECT (tree_view), tree_view->priv->model, path); + if (tree_view->priv->last_button_press) + gtk_tree_row_reference_free (tree_view->priv->last_button_press); + tree_view->priv->last_button_press = tree_view->priv->last_button_press_2; + tree_view->priv->last_button_press_2 = gtk_tree_row_reference_new_proxy (G_OBJECT (tree_view), tree_view->priv->model, path); } GTK_TREE_VIEW_UNSET_FLAG (tree_view, GTK_TREE_VIEW_DRAW_KEYFOCUS); @@ -8871,24 +8876,24 @@ gtk_tree_view_real_collapse_row (GtkTreeView *tree_view, gtk_tree_path_free (anchor_path); } - if (gtk_tree_row_reference_valid (tree_view->priv->last_single_clicked)) + if (gtk_tree_row_reference_valid (tree_view->priv->last_button_press)) { - GtkTreePath *lsc = gtk_tree_row_reference_get_path (tree_view->priv->last_single_clicked); + GtkTreePath *lsc = gtk_tree_row_reference_get_path (tree_view->priv->last_button_press); if (gtk_tree_path_is_ancestor (path, lsc)) { - gtk_tree_row_reference_free (tree_view->priv->last_single_clicked); - tree_view->priv->last_single_clicked = NULL; + gtk_tree_row_reference_free (tree_view->priv->last_button_press); + tree_view->priv->last_button_press = NULL; } gtk_tree_path_free (lsc); } - if (gtk_tree_row_reference_valid (tree_view->priv->last_single_clicked_2)) + if (gtk_tree_row_reference_valid (tree_view->priv->last_button_press_2)) { - GtkTreePath *lsc = gtk_tree_row_reference_get_path (tree_view->priv->last_single_clicked_2); + GtkTreePath *lsc = gtk_tree_row_reference_get_path (tree_view->priv->last_button_press_2); if (gtk_tree_path_is_ancestor (path, lsc)) { - gtk_tree_row_reference_free (tree_view->priv->last_single_clicked_2); - tree_view->priv->last_single_clicked_2 = NULL; + gtk_tree_row_reference_free (tree_view->priv->last_button_press_2); + tree_view->priv->last_button_press_2 = NULL; } gtk_tree_path_free (lsc); } |