[gtk+] Make treeview expanders work reliably



commit 8448780a6c9fa2bcdd06af996bddb8bd720bd5e6
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Feb 1 01:28:45 2011 -0500

    Make treeview expanders work reliably
    
    It turns out that the gtk_grab_remove() can trigger a do_prelight()
    call, which may end up changing prelight_node, and then the state
    gets messed up. Moving the grab removal until after we're done with
    button_pressed_node and prlight_node makes expanders work reliably.
    
    One thing that is still not right is that the expander doesn't get
    prelight again after the animation is done, if you manage to release
    without any additional motion events.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=641039

 gtk/gtktreeview.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index df342e0..637cae8 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -2946,7 +2946,6 @@ gtk_tree_view_button_press (GtkWidget      *widget,
 			"horizontal-separator", &horizontal_separator,
 			NULL);
 
-
   /* Because grab_focus can cause reentrancy, we delay grab_focus until after
    * we're done handling the button press.
    */
@@ -3438,7 +3437,6 @@ gtk_tree_view_button_release (GtkWidget      *widget,
 
   if (event->button == 1)
     {
-      gtk_grab_remove (widget);
       if (tree_view->priv->button_pressed_node == tree_view->priv->prelight_node &&
           tree_view->priv->arrow_prelit)
 	{
@@ -3460,6 +3458,7 @@ gtk_tree_view_button_release (GtkWidget      *widget,
 	  gtk_tree_path_free (path);
 	}
 
+      gtk_grab_remove (widget);
       tree_view->priv->button_pressed_tree = NULL;
       tree_view->priv->button_pressed_node = NULL;
     }
@@ -12797,7 +12796,6 @@ gtk_tree_view_real_collapse_row (GtkTreeView *tree_view,
 
   if (node->children == NULL)
     return FALSE;
-
   gtk_tree_model_get_iter (tree_view->priv->model, &iter, path);
 
   g_signal_emit (tree_view, tree_view_signals[TEST_COLLAPSE_ROW], 0, &iter, path, &collapse);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]