[gtksourceview/gnome-3-22] GutterRendererPixbuf: convert buffer coord to gutter window coord



commit e996f1c73bf1bbc766ff920a67258f9ad2e31c16
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Sun Jan 22 12:53:16 2017 +0100

    GutterRendererPixbuf: convert buffer coord to gutter window coord
    
    See this comment:
    https://bugzilla.gnome.org/show_bug.cgi?id=777587#c2

 gtksourceview/gtksourcegutterrendererpixbuf.c |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)
---
diff --git a/gtksourceview/gtksourcegutterrendererpixbuf.c b/gtksourceview/gtksourcegutterrendererpixbuf.c
index d04d826..5ddfe44 100644
--- a/gtksourceview/gtksourcegutterrendererpixbuf.c
+++ b/gtksourceview/gtksourcegutterrendererpixbuf.c
@@ -64,15 +64,23 @@ center_on (GtkSourceGutterRenderer *renderer,
            gint                    *x,
            gint                    *y)
 {
-       GdkRectangle location;
        GtkTextView *view;
+       GtkTextWindowType window_type;
+       GdkRectangle buffer_location;
+       gint window_y;
 
        view = gtk_source_gutter_renderer_get_view (renderer);
+       window_type = gtk_source_gutter_renderer_get_window_type (renderer);
 
-       gtk_text_view_get_iter_location (view, iter, &location);
+       gtk_text_view_get_iter_location (view, iter, &buffer_location);
+
+       gtk_text_view_buffer_to_window_coords (view,
+                                              window_type,
+                                              0, buffer_location.y,
+                                              NULL, &window_y);
 
        *x = cell_area->x + (cell_area->width - width) * xalign;
-       *y = location.y + (location.height - height) * yalign;
+       *y = window_y + (buffer_location.height - height) * yalign;
 }
 
 static void


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