[gtksourceview] gutter: fix line number drawing upon resize
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtksourceview] gutter: fix line number drawing upon resize
- Date: Thu, 11 Feb 2021 22:41:23 +0000 (UTC)
commit 8911a7ae879c078583d6a65df221f1dd5add62fb
Author: Christian Hergert <chergert redhat com>
Date: Thu Feb 11 14:41:12 2021 -0800
gutter: fix line number drawing upon resize
This fixes an issue where the line numbers were not updated until we
hovered over the gutter.
Fixes #170
gtksourceview/gtksourcegutter.c | 25 +++++++++++++++++--------
1 file changed, 17 insertions(+), 8 deletions(-)
---
diff --git a/gtksourceview/gtksourcegutter.c b/gtksourceview/gtksourcegutter.c
index ca282477..889a7b2e 100644
--- a/gtksourceview/gtksourcegutter.c
+++ b/gtksourceview/gtksourcegutter.c
@@ -79,6 +79,7 @@ struct _GtkSourceGutter
GtkOrientation orientation;
gulong adj_changed_handler;
+ gulong adj_upper_changed_handler;
guint is_drawing : 1;
};
@@ -190,14 +191,15 @@ static void
on_adjustment_value_changed (GtkAdjustment *adj,
GtkSourceGutter *gutter)
{
- const GList *list;
-
- for (list = gutter->renderers; list; list = list->next)
- {
- Renderer *renderer = list->data;
+ _gtk_source_gutter_queue_draw (gutter);
+}
- gtk_widget_queue_draw (GTK_WIDGET (renderer->renderer));
- }
+static void
+on_adjustment_upper_changed (GtkAdjustment *adj,
+ GParamSpec *pspec,
+ GtkSourceGutter *gutter)
+{
+ _gtk_source_gutter_queue_draw (gutter);
}
static GtkAdjustment *
@@ -227,6 +229,11 @@ connect_view (GtkSourceGutter *gutter,
"value-changed",
G_CALLBACK (on_adjustment_value_changed),
gutter);
+ gutter->adj_upper_changed_handler =
+ g_signal_connect (get_adjustment (gutter, view),
+ "notify::upper",
+ G_CALLBACK (on_adjustment_upper_changed),
+ gutter);
}
static void
@@ -238,6 +245,8 @@ disconnect_view (GtkSourceGutter *gutter,
g_clear_signal_handler (&gutter->adj_changed_handler,
get_adjustment (gutter, view));
+ g_clear_signal_handler (&gutter->adj_upper_changed_handler,
+ get_adjustment (gutter, view));
}
static void
@@ -1018,7 +1027,7 @@ _gtk_source_gutter_queue_draw (GtkSourceGutter *gutter)
{
Renderer *renderer = iter->data;
- gtk_widget_queue_allocate (GTK_WIDGET (renderer->renderer));
+ gtk_widget_queue_draw (GTK_WIDGET (renderer->renderer));
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]