diff options
author | António Fernandes <antoniof@gnome.org> | 2021-08-07 22:38:42 +0100 |
---|---|---|
committer | António Fernandes <antoniof@gnome.org> | 2021-08-16 10:14:02 +0100 |
commit | b1b518c791fd9e00de66e782ab3a2e1651f404c7 (patch) | |
tree | 192960c8f32875f94cc2c5f51346a9d324b5fc23 | |
parent | 28e87beb35c5c2abdfc84d7708c3584c90c5af33 (diff) | |
download | nautilus-b1b518c791fd9e00de66e782ab3a2e1651f404c7.tar.gz |
list-view: Translate coordinates for underline on hover
gtk_tree_view_get_path_at_pos() requires bin_window coordinates, which
happened to be what the ::event coordinates were (because bin_window
was the event's GdkWindow).
However, with GtkEventControllerMotion we get widget coordinates. This
causes glytches with the underline.
Translating the coordinates fixes the regression.
-rw-r--r-- | src/nautilus-list-view.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/nautilus-list-view.c b/src/nautilus-list-view.c index 939365b48..cd5235225 100644 --- a/src/nautilus-list-view.c +++ b/src/nautilus-list-view.c @@ -326,6 +326,8 @@ on_event_controller_motion_motion (GtkEventControllerMotion *controller, NautilusListView *view; GtkWidget *widget; GtkTreePath *old_hover_path; + int x_in_bin; + int y_in_bin; if (get_click_policy () != NAUTILUS_CLICK_POLICY_SINGLE) { @@ -336,8 +338,11 @@ on_event_controller_motion_motion (GtkEventControllerMotion *controller, widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (controller)); old_hover_path = view->details->hover_path; + gtk_tree_view_convert_widget_to_bin_window_coords (GTK_TREE_VIEW (widget), + x, y, + &x_in_bin, &y_in_bin); gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget), - x, y, + x_in_bin, y_in_bin, &view->details->hover_path, NULL, NULL, NULL); @@ -385,6 +390,8 @@ on_event_controller_motion_enter (GtkEventControllerMotion *controller, { NautilusListView *view; GtkWidget *widget; + int x_in_bin; + int y_in_bin; if (get_click_policy () != NAUTILUS_CLICK_POLICY_SINGLE) { @@ -398,8 +405,11 @@ on_event_controller_motion_enter (GtkEventControllerMotion *controller, } widget = gtk_event_controller_get_widget (GTK_EVENT_CONTROLLER (controller)); + gtk_tree_view_convert_widget_to_bin_window_coords (GTK_TREE_VIEW (widget), + x, y, + &x_in_bin, &y_in_bin); gtk_tree_view_get_path_at_pos (GTK_TREE_VIEW (widget), - x, y, + x_in_bin, y_in_bin, &view->details->hover_path, NULL, NULL, NULL); |