[gedit/wip/use-gsv-search: 4/6] Do not update search highlighting, done in gsv



commit 165005f2999c132877ab7435791bbb8e559bfcac
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Wed Jun 19 12:13:24 2013 +0200

    Do not update search highlighting, done in gsv

 gedit/gedit-view.c |   96 ----------------------------------------------------
 1 files changed, 0 insertions(+), 96 deletions(-)
---
diff --git a/gedit/gedit-view.c b/gedit/gedit-view.c
index f59ae92..f69c092 100644
--- a/gedit/gedit-view.c
+++ b/gedit/gedit-view.c
@@ -98,58 +98,6 @@ document_read_only_notify_handler (GeditDocument *document,
 }
 
 static void
-search_highlight_updated_cb (GeditDocument *doc,
-                             GtkTextIter   *start,
-                             GtkTextIter   *end,
-                             GeditView     *view)
-{
-       GdkRectangle visible_rect;
-       GdkRectangle updated_rect;
-       GdkRectangle redraw_rect;
-       gint y;
-       gint height;
-       GtkTextView *text_view;
-
-       text_view = GTK_TEXT_VIEW (view);
-
-       g_return_if_fail (gedit_document_get_enable_search_highlighting (
-                               GEDIT_DOCUMENT (gtk_text_view_get_buffer (text_view))));
-
-       /* get visible area */
-       gtk_text_view_get_visible_rect (text_view, &visible_rect);
-
-       /* get updated rectangle */
-       gtk_text_view_get_line_yrange (text_view, start, &y, &height);
-       updated_rect.y = y;
-       gtk_text_view_get_line_yrange (text_view, end, &y, &height);
-       updated_rect.height = y + height - updated_rect.y;
-       updated_rect.x = visible_rect.x;
-       updated_rect.width = visible_rect.width;
-
-       /* intersect both rectangles to see whether we need to queue a redraw */
-       if (gdk_rectangle_intersect (&updated_rect, &visible_rect, &redraw_rect))
-       {
-               GdkRectangle widget_rect;
-
-               gtk_text_view_buffer_to_window_coords (text_view,
-                                                      GTK_TEXT_WINDOW_WIDGET,
-                                                      redraw_rect.x,
-                                                      redraw_rect.y,
-                                                      &widget_rect.x,
-                                                      &widget_rect.y);
-
-               widget_rect.width = redraw_rect.width;
-               widget_rect.height = redraw_rect.height;
-
-               gtk_widget_queue_draw_area (GTK_WIDGET (text_view),
-                                           widget_rect.x,
-                                           widget_rect.y,
-                                           widget_rect.width,
-                                           widget_rect.height);
-       }
-}
-
-static void
 current_buffer_removed (GeditView *view)
 {
        if (view->priv->current_buffer)
@@ -157,9 +105,6 @@ current_buffer_removed (GeditView *view)
                g_signal_handlers_disconnect_by_func (view->priv->current_buffer,
                                                      document_read_only_notify_handler,
                                                      view);
-               g_signal_handlers_disconnect_by_func (view->priv->current_buffer,
-                                                     search_highlight_updated_cb,
-                                                     view);
 
                g_object_unref (view->priv->current_buffer);
                view->priv->current_buffer = NULL;
@@ -187,11 +132,6 @@ on_notify_buffer_cb (GeditView  *view,
 
        gtk_text_view_set_editable (GTK_TEXT_VIEW (view),
                                    !gedit_document_get_readonly (GEDIT_DOCUMENT (buffer)));
-
-       g_signal_connect (buffer,
-                         "search_highlight_updated",
-                         G_CALLBACK (search_highlight_updated_cb),
-                         view);
 }
 
 static void
@@ -370,41 +310,6 @@ gedit_view_focus_out (GtkWidget *widget, GdkEventFocus *event)
        return FALSE;
 }
 
-static gboolean
-gedit_view_draw (GtkWidget *widget,
-                 cairo_t   *cr)
-{
-       GtkTextView *text_view;
-       GeditDocument *doc;
-       GdkWindow *window;
-
-       text_view = GTK_TEXT_VIEW (widget);
-
-       doc = GEDIT_DOCUMENT (gtk_text_view_get_buffer (text_view));
-       window = gtk_text_view_get_window (text_view, GTK_TEXT_WINDOW_TEXT);
-
-       if (gtk_cairo_should_draw_window (cr, window) &&
-           gedit_document_get_enable_search_highlighting (doc))
-       {
-               GdkRectangle visible_rect;
-               GtkTextIter iter1, iter2;
-
-               gtk_text_view_get_visible_rect (text_view, &visible_rect);
-               gtk_text_view_get_line_at_y (text_view, &iter1,
-                                            visible_rect.y, NULL);
-               gtk_text_view_get_line_at_y (text_view, &iter2,
-                                            visible_rect.y
-                                            + visible_rect.height, NULL);
-               gtk_text_iter_forward_line (&iter2);
-
-               _gedit_document_search_region (doc,
-                                              &iter1,
-                                              &iter2);
-       }
-
-       return GTK_WIDGET_CLASS (gedit_view_parent_class)->draw (widget, cr);
-}
-
 static GdkAtom
 drag_get_uri_target (GtkWidget      *widget,
                     GdkDragContext *context)
@@ -801,7 +706,6 @@ gedit_view_class_init (GeditViewClass *klass)
 
        widget_class->destroy = gedit_view_destroy;
        widget_class->focus_out_event = gedit_view_focus_out;
-       widget_class->draw = gedit_view_draw;
 
        /*
         * Override the gtk_text_view_drag_motion and drag_drop


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