[nautilus/wip/antoniof/flowbox-to-gridview: 1/14] view-icon-controller: Propperly translate coordinates
- From: António Fernandes <antoniof src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/wip/antoniof/flowbox-to-gridview: 1/14] view-icon-controller: Propperly translate coordinates
- Date: Wed, 2 Feb 2022 18:00:33 +0000 (UTC)
commit 01a156d116569c37021a27cf9ebdef61c22f030f
Author: António Fernandes <antoniof gnome org>
Date: Tue Feb 1 00:53:23 2022 +0000
view-icon-controller: Propperly translate coordinates
Adding/subtracting adjustment values is error-prone and ignore
padding/margins.
Fixes https://gitlab.gnome.org/GNOME/nautilus/-/issues/2095
src/nautilus-view-icon-controller.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/src/nautilus-view-icon-controller.c b/src/nautilus-view-icon-controller.c
index f46044034..51ff19df6 100644
--- a/src/nautilus-view-icon-controller.c
+++ b/src/nautilus-view-icon-controller.c
@@ -676,18 +676,18 @@ get_rectangle_for_item_ui (NautilusViewIconController *self,
{
GdkRectangle *rectangle;
GtkWidget *content_widget;
- GtkAdjustment *vadjustment;
- GtkAdjustment *hadjustment;
+ gdouble view_x;
+ gdouble view_y;
rectangle = g_new0 (GdkRectangle, 1);
gtk_widget_get_allocation (item_ui, rectangle);
content_widget = nautilus_files_view_get_content_widget (NAUTILUS_FILES_VIEW (self));
- vadjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (content_widget));
- hadjustment = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (content_widget));
-
- rectangle->x -= gtk_adjustment_get_value (hadjustment);
- rectangle->y -= gtk_adjustment_get_value (vadjustment);
+ gtk_widget_translate_coordinates (GTK_WIDGET (self->view_ui), content_widget,
+ rectangle->x, rectangle->y,
+ &view_x, &view_y);
+ rectangle->x = view_x;
+ rectangle->y = view_y;
return rectangle;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]