[gtk+/places-sidebar: 539/539] treeview: Use equal areas in the computation of drag dest row positions



commit 2db8e25cdb2aab8de12e88b9532f322c2fb56416
Author: Federico Mena Quintero <federico gnome org>
Date:   Fri Apr 19 17:20:12 2013 -0500

    treeview: Use equal areas in the computation of drag dest row positions
    
    We used to divide the row in thirds vertically, and use the outer thirds for GTK_TREE_VIEW_DROP_BEFORE 
and AFTER, respectively.
    
    Now we use *fourths*.  This is so that we get equal areas for these:
    
      GTK_TREE_VIEW_DROP_BEFORE
      GTK_TREE_VIEW_DROP_INTO_OR_BEFORE
      GTK_TREE_VIEW_DROP_INTO_OR_AFTER
      GTK_TREE_VIEW_DROP_AFTER
    
    This makes hovering tree rows much more positive.
    
    Signed-off-by: Federico Mena Quintero <federico gnome org>

 gtk/gtktreeview.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index cb43c7f..3de5599 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -14420,7 +14420,7 @@ gtk_tree_view_get_dest_row_at_pos (GtkTreeView             *tree_view,
   gint cell_y;
   gint bin_x, bin_y;
   gdouble offset_into_row;
-  gdouble third;
+  gdouble fourth;
   GdkRectangle cell;
   GtkTreeViewColumn *column = NULL;
   GtkTreePath *tmp_path = NULL;
@@ -14442,8 +14442,8 @@ gtk_tree_view_get_dest_row_at_pos (GtkTreeView             *tree_view,
   if (tree_view->priv->tree == NULL)
     return FALSE;
 
-  /* If in the top third of a row, we drop before that row; if
-   * in the bottom third, drop after that row; if in the middle,
+  /* If in the top fourth of a row, we drop before that row; if
+   * in the bottom fourth, drop after that row; if in the middle,
    * and the row has children, drop into the row.
    */
   gtk_tree_view_convert_widget_to_bin_window_coords (tree_view, drag_x, drag_y,
@@ -14470,11 +14470,11 @@ gtk_tree_view_get_dest_row_at_pos (GtkTreeView             *tree_view,
 
   tmp_path = NULL;
 
-  third = cell.height / 3.0;
+  fourth = cell.height / 4.0;
 
   if (pos)
     {
-      if (offset_into_row < third)
+      if (offset_into_row < fourth)
         {
           *pos = GTK_TREE_VIEW_DROP_BEFORE;
         }
@@ -14482,7 +14482,7 @@ gtk_tree_view_get_dest_row_at_pos (GtkTreeView             *tree_view,
         {
           *pos = GTK_TREE_VIEW_DROP_INTO_OR_BEFORE;
         }
-      else if (offset_into_row < third * 2.0)
+      else if (offset_into_row < cell.height - fourth)
         {
           *pos = GTK_TREE_VIEW_DROP_INTO_OR_AFTER;
         }


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