[gtksourceview] Move marks and current line drawing to LAYER_BELOW_TEXT



commit 473b09a590e20333e30c4fd86b54016de9580dd8
Author: Paolo Borelli <pborelli gnome org>
Date:   Sat Jan 30 11:47:56 2016 +0100

    Move marks and current line drawing to LAYER_BELOW_TEXT
    
    They have to be moved at the same time since they use the same function
    to paint the line background

 gtksourceview/gtksourceview.c |   44 +++-------------------------------------
 1 files changed, 4 insertions(+), 40 deletions(-)
---
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index d0c0507..765950c 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -2162,32 +2162,13 @@ gtk_source_view_paint_line_background (GtkTextView    *text_view,
                                       int             height,
                                       const GdkRGBA  *color)
 {
-       GdkRectangle visible_rect;
-       GdkRectangle line_rect;
-       gint win_y;
-       gdouble clip_x1, clip_y1, clip_x2, clip_y2;
-
-       gtk_text_view_get_visible_rect (text_view, &visible_rect);
-
-       gtk_text_view_buffer_to_window_coords (text_view,
-                                              GTK_TEXT_WINDOW_TEXT,
-                                              visible_rect.x,
-                                              y,
-                                              &line_rect.x,
-                                              &win_y);
-       cairo_clip_extents (cr,
-                           &clip_x1, &clip_y1,
-                           &clip_x2, &clip_y2);
+       gdouble x1, y1, x2, y2;
 
-       line_rect.x = clip_x1;
-       line_rect.width = clip_x2 - clip_x1;
-       line_rect.y = win_y;
-       line_rect.height = height;
+       cairo_clip_extents (cr, &x1, &y1, &x2, &y2);
 
        gdk_cairo_set_source_rgba (cr, (GdkRGBA *)color);
        cairo_set_line_width (cr, 1);
-       cairo_rectangle (cr, line_rect.x, line_rect.y + .5,
-                        line_rect.width, line_rect.height - 1);
+       cairo_rectangle (cr, x1, y + .5, x2 - x1, height - 1);
        cairo_stroke_preserve (cr);
        cairo_fill (cr);
 }
@@ -2216,21 +2197,6 @@ gtk_source_view_paint_marks_background (GtkSourceView *view,
        y1 = clip.y;
        y2 = y1 + clip.height;
 
-       /* get the extents of the line printing */
-       gtk_text_view_window_to_buffer_coords (text_view,
-                                              GTK_TEXT_WINDOW_TEXT,
-                                              0,
-                                              y1,
-                                              NULL,
-                                              &y1);
-
-       gtk_text_view_window_to_buffer_coords (text_view,
-                                              GTK_TEXT_WINDOW_TEXT,
-                                              0,
-                                              y2,
-                                              NULL,
-                                              &y2);
-
        numbers = g_array_new (FALSE, FALSE, sizeof (gint));
        pixels = g_array_new (FALSE, FALSE, sizeof (gint));
        heights = g_array_new (FALSE, FALSE, sizeof (gint));
@@ -3023,9 +2989,7 @@ gtk_source_view_draw_layer (GtkTextView      *text_view,
                {
                        gtk_source_view_paint_background_pattern_grid (view, cr);
                }
-       }
-       else if (layer == GTK_TEXT_VIEW_LAYER_BELOW)
-       {
+
                if (gtk_widget_is_sensitive (GTK_WIDGET (view)) &&
                    view->priv->highlight_current_line &&
                    view->priv->current_line_color_set)


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