[gtk+] treeview: Transform motion event coords to "bin window" coords



commit 0724fa7f61cde5c3934587cc6d04e8922f0b0cbc
Author: Carlos Garnacho <carlosg gnome org>
Date:   Fri Oct 6 16:50:29 2017 +0200

    treeview: Transform motion event coords to "bin window" coords
    
    The operations rely there on bin window relative coordinates, but we
    are receiving GtkTreeView relative coordinates there. Fixes clicking
    on treeview expanders, which was offset by visible headers.

 gtk/gtktreeview.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index cc974a1..315a5d7 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -4477,18 +4477,22 @@ gtk_tree_view_motion (GtkWidget      *widget,
 
   if (tree_view->priv->tree)
     {
+      gint bin_x, bin_y;
+
       /* If we are currently pressing down a button, we don't want to prelight anything else. */
       if (gtk_gesture_is_active (tree_view->priv->drag_gesture) ||
           gtk_gesture_is_active (tree_view->priv->multipress_gesture))
         node = NULL;
 
-      new_y = MAX (0, TREE_WINDOW_Y_TO_RBTREE_Y (tree_view, y));
+      gtk_tree_view_convert_widget_to_bin_window_coords (tree_view, x, y,
+                                                         &bin_x, &bin_y);
+      new_y = MAX (0, TREE_WINDOW_Y_TO_RBTREE_Y (tree_view, bin_y));
 
       _gtk_rbtree_find_offset (tree_view->priv->tree, new_y, &tree, &node);
 
-      tree_view->priv->event_last_x = x;
-      tree_view->priv->event_last_y = y;
-      prelight_or_select (tree_view, tree, node, x, y);
+      tree_view->priv->event_last_x = bin_x;
+      tree_view->priv->event_last_y = bin_y;
+      prelight_or_select (tree_view, tree, node, bin_x, bin_y);
     }
 
   for (list = tree_view->priv->columns; list; list = list->next)


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