[nautilus/wip/antoniof/gtk4-preparation-step-event-controllers: 6/22] list-view: Translate coordinates for underline on hover
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/gtk4-preparation-step-event-controllers: 6/22] list-view: Translate coordinates for underline on hover
- Date: Wed, 11 Aug 2021 00:21:35 +0000 (UTC)
commit 596c4b16b0c7433d5d8371bac5b5aa14e1d704c7
Author: António Fernandes <antoniof gnome org>
Date: Sat Aug 7 22:38:42 2021 +0100
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.
src/nautilus-list-view.c | 14 ++++++++++++--
1 file 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);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]