[gtksourceview] View: do not connect to the highlight-updated signal
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] View: do not connect to the highlight-updated signal
- Date: Mon, 27 Jan 2014 17:26:43 +0000 (UTC)
commit 949cd128064201935f90d999544e6a19f8e3baa6
Author: Sébastien Wilmet <swilmet gnome org>
Date: Mon Jan 27 18:16:35 2014 +0100
View: do not connect to the highlight-updated signal
This code was added in the big commit "towards gedit integration" back
in 2003, without a comment explaining why this code was required.
I think it is no longer required. If a GtkTextTag is added to the
buffer, the view will normally be redrawn. And if a GtkTextTag is
already present in the buffer, but one of its property changes, the view
will normally also be redrawn.
It was perhaps used for updating the gutter, the right margin, etc. But
it seems to work fine without calling gtk_widget_queue_draw_area().
If something breaks, we can revert this commit, and add a comment
explaining why it is useful.
gtksourceview/gtksourceview.c | 76 -----------------------------------------
1 files changed, 0 insertions(+), 76 deletions(-)
---
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index 98193a1..b3ba091 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -1030,72 +1030,6 @@ gtk_source_view_finalize (GObject *object)
}
static void
-highlight_updated_cb (GtkSourceBuffer *buffer,
- GtkTextIter *start,
- GtkTextIter *end,
- GtkTextView *text_view)
-{
- GdkRectangle visible_rect;
- GdkRectangle updated_rect;
- GdkRectangle redraw_rect;
- gint y;
- gint height;
-
- /* 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;
-
- DEBUG ({
- g_print ("> highlight_updated start\n");
- g_print (" lines udpated: %d - %d\n",
- gtk_text_iter_get_line (start),
- gtk_text_iter_get_line (end));
- g_print (" visible area: %d - %d\n",
- visible_rect.y, visible_rect.y + visible_rect.height);
- g_print (" updated area: %d - %d\n",
- updated_rect.y, updated_rect.y + updated_rect.height);
- });
-
- /* 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;
-
- DEBUG ({
- g_print (" invalidating: %d - %d\n",
- widget_rect.y, widget_rect.y + widget_rect.height);
- });
-
- gtk_widget_queue_draw_area (GTK_WIDGET (text_view),
- widget_rect.x,
- widget_rect.y,
- widget_rect.width,
- widget_rect.height);
- }
-
- DEBUG ({
- g_print ("> highlight_updated end\n");
- });
-}
-
-static void
source_mark_updated_cb (GtkSourceBuffer *buffer,
GtkSourceMark *mark,
GtkTextView *text_view)
@@ -1125,10 +1059,6 @@ set_source_buffer (GtkSourceView *view,
if (view->priv->source_buffer != NULL)
{
g_signal_handlers_disconnect_by_func (view->priv->source_buffer,
- highlight_updated_cb,
- view);
-
- g_signal_handlers_disconnect_by_func (view->priv->source_buffer,
source_mark_updated_cb,
view);
@@ -1144,12 +1074,6 @@ set_source_buffer (GtkSourceView *view,
view->priv->source_buffer = g_object_ref (buffer);
g_signal_connect_object (buffer,
- "highlight_updated",
- G_CALLBACK (highlight_updated_cb),
- view,
- 0);
-
- g_signal_connect_object (buffer,
"source_mark_updated",
G_CALLBACK (source_mark_updated_cb),
view,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]