[gtksourceview/wip/chergert/gsv-gtk4: 72/84] view: add gtk_source_view_queue_draw() helper
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview/wip/chergert/gsv-gtk4: 72/84] view: add gtk_source_view_queue_draw() helper
- Date: Thu, 16 Jan 2020 00:14:35 +0000 (UTC)
commit 2915c0718d2e1decdff0d95c242dabc9034ef3cf
Author: Christian Hergert <chergert redhat com>
Date: Wed Jan 15 15:20:54 2020 -0800
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.
gtksourceview/gtksourceview.c | 35 +++++++++++++++++++++++++++--------
1 file changed, 27 insertions(+), 8 deletions(-)
---
diff --git a/gtksourceview/gtksourceview.c b/gtksourceview/gtksourceview.c
index 87f61128..ff283339 100644
--- a/gtksourceview/gtksourceview.c
+++ b/gtksourceview/gtksourceview.c
@@ -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);
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]