[nautilus] canvas-view: translate coordinates for compute_relative_for



commit 271f45a5d304a436f3d369e6b3b984aeb77ab1ba
Author: Carlos Soriano <csoriano gnome org>
Date:   Mon Aug 17 00:17:17 2015 +0200

    canvas-view: translate coordinates for compute_relative_for
    
    We have to use the relative coordinates wrt the view, not the ones
    of the item inside the scrolled widnow itself.

 src/nautilus-canvas-view.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/nautilus-canvas-view.c b/src/nautilus-canvas-view.c
index d77ca2a..d1f3ec3 100644
--- a/src/nautilus-canvas-view.c
+++ b/src/nautilus-canvas-view.c
@@ -1180,11 +1180,19 @@ nautilus_canvas_view_compute_rename_popover_relative_to (NautilusView *view)
         GArray *bounding_boxes;
         GdkRectangle *bounding_box;
         NautilusCanvasContainer *canvas_container;
+        GtkAdjustment *vadjustment, *hadjustment;
+        GtkWidget *parent_container;
 
         canvas_container = get_canvas_container (NAUTILUS_CANVAS_VIEW (view));
         bounding_boxes = nautilus_canvas_container_get_selected_icons_bounding_box (canvas_container);
         /* We only allow renaming one item at once */
         bounding_box = &g_array_index (bounding_boxes, GdkRectangle, 0);
+        parent_container = nautilus_view_get_content_widget (view);
+        vadjustment = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (parent_container));
+        hadjustment = gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (parent_container));
+
+        bounding_box->x -= gtk_adjustment_get_value (hadjustment);
+        bounding_box->y -= gtk_adjustment_get_value (vadjustment);
 
         g_array_free (bounding_boxes, FALSE);
 


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