Commit 2915c071 authored by Christian Hergert's avatar Christian Hergert

view: add gtk_source_view_queue_draw() helper

This function queues a draw request on the GtkTextView but additionally
the gutter renderers (via the GtkSourceGutter) as necessary to invalidate
the potentially cached render nodes for lines.
parent 09cfa2c0
......@@ -304,6 +304,7 @@ static void gtk_source_view_draw_layer (GtkTextView
static MarkCategory *mark_category_new (GtkSourceMarkAttributes *attributes,
gint priority);
static void mark_category_free (MarkCategory *category);
static void gtk_source_view_queue_draw (GtkSourceView *view);
static gboolean gtk_source_view_drag_drop (GtkDropTarget *dest,
GdkDrop *drop,
int x,
......@@ -1247,7 +1248,7 @@ space_drawer_notify_cb (GtkSourceSpaceDrawer *space_drawer,
GParamSpec *pspec,
GtkSourceView *view)
{
gtk_widget_queue_draw (GTK_WIDGET (view));
gtk_source_view_queue_draw (view);
}
static void
......@@ -1483,7 +1484,7 @@ source_mark_updated_cb (GtkSourceBuffer *buffer,
{
/* TODO do something more intelligent here, namely
* invalidate only the area under the mark if possible */
gtk_widget_queue_draw (GTK_WIDGET (text_view));
gtk_source_view_queue_draw (GTK_SOURCE_VIEW (text_view));
}
static void
......@@ -1500,7 +1501,7 @@ implicit_trailing_newline_changed_cb (GtkSourceBuffer *buffer,
GtkSourceView *view)
{
/* For drawing or not a trailing newline. */
gtk_widget_queue_draw (GTK_WIDGET (view));
gtk_source_view_queue_draw (view);
}
static void
......@@ -4414,7 +4415,7 @@ gtk_source_view_set_highlight_current_line (GtkSourceView *view,
{
priv->highlight_current_line = highlight;
gtk_widget_queue_draw (GTK_WIDGET (view));
gtk_source_view_queue_draw (view);
g_object_notify (G_OBJECT (view), "highlight_current_line");
}
......@@ -4459,7 +4460,7 @@ gtk_source_view_set_show_right_margin (GtkSourceView *view,
{
priv->show_right_margin = show;
gtk_widget_queue_draw (GTK_WIDGET (view));
gtk_source_view_queue_draw (view);
g_object_notify (G_OBJECT (view), "show-right-margin");
}
......@@ -4504,7 +4505,7 @@ gtk_source_view_set_right_margin_position (GtkSourceView *view,
priv->right_margin_pos = pos;
priv->cached_right_margin_pos = -1;
gtk_widget_queue_draw (GTK_WIDGET (view));
gtk_source_view_queue_draw (view);
g_object_notify (G_OBJECT (view), "right-margin-position");
}
......@@ -4780,7 +4781,7 @@ update_style (GtkSourceView *view)
_gtk_source_space_drawer_update_color (priv->space_drawer, view);
}
gtk_widget_queue_draw (GTK_WIDGET (view));
gtk_source_view_queue_draw (view);
}
static void
......@@ -5022,7 +5023,7 @@ gtk_source_view_set_background_pattern (GtkSourceView *view,
{
priv->background_pattern = background_pattern;
gtk_widget_queue_draw (GTK_WIDGET (view));
gtk_source_view_queue_draw (view);
g_object_notify (G_OBJECT (view), "background-pattern");
}
......@@ -5068,3 +5069,21 @@ gtk_source_view_get_space_drawer (GtkSourceView *view)
return priv->space_drawer;
}
static void
gtk_source_view_queue_draw (GtkSourceView *view)
{
GtkSourceViewPrivate *priv = gtk_source_view_get_instance_private (view);
gtk_widget_queue_draw (GTK_WIDGET (view));
if (priv->left_gutter != NULL)
{
_gtk_source_gutter_queue_draw (priv->left_gutter);
}
if (priv->right_gutter != NULL)
{
_gtk_source_gutter_queue_draw (priv->right_gutter);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment