diff --git a/ChangeLog b/ChangeLog index b0fb0c41f1..21af4f97f9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2001-10-24 Havoc Pennington + + * gtk/gtktextview.c (gtk_text_view_update_adjustments): don't + create layout if we didn't have one + (gtk_text_view_set_buffer): invalidate so we get the idle handlers + as appropriate + (gtk_text_view_invalidate): new function to do invalidation, + containing old guts of invalidated_handler + Wed Oct 24 10:29:47 2001 Owen Taylor * gtk/gtkalignment.c (gtk_alignment_class_init): Improve diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0 index b0fb0c41f1..21af4f97f9 100644 --- a/ChangeLog.pre-2-0 +++ b/ChangeLog.pre-2-0 @@ -1,3 +1,12 @@ +2001-10-24 Havoc Pennington + + * gtk/gtktextview.c (gtk_text_view_update_adjustments): don't + create layout if we didn't have one + (gtk_text_view_set_buffer): invalidate so we get the idle handlers + as appropriate + (gtk_text_view_invalidate): new function to do invalidation, + containing old guts of invalidated_handler + Wed Oct 24 10:29:47 2001 Owen Taylor * gtk/gtkalignment.c (gtk_alignment_class_init): Improve diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index b0fb0c41f1..21af4f97f9 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,12 @@ +2001-10-24 Havoc Pennington + + * gtk/gtktextview.c (gtk_text_view_update_adjustments): don't + create layout if we didn't have one + (gtk_text_view_set_buffer): invalidate so we get the idle handlers + as appropriate + (gtk_text_view_invalidate): new function to do invalidation, + containing old guts of invalidated_handler + Wed Oct 24 10:29:47 2001 Owen Taylor * gtk/gtkalignment.c (gtk_alignment_class_init): Improve diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index b0fb0c41f1..21af4f97f9 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,12 @@ +2001-10-24 Havoc Pennington + + * gtk/gtktextview.c (gtk_text_view_update_adjustments): don't + create layout if we didn't have one + (gtk_text_view_set_buffer): invalidate so we get the idle handlers + as appropriate + (gtk_text_view_invalidate): new function to do invalidation, + containing old guts of invalidated_handler + Wed Oct 24 10:29:47 2001 Owen Taylor * gtk/gtkalignment.c (gtk_alignment_class_init): Improve diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index b0fb0c41f1..21af4f97f9 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,12 @@ +2001-10-24 Havoc Pennington + + * gtk/gtktextview.c (gtk_text_view_update_adjustments): don't + create layout if we didn't have one + (gtk_text_view_set_buffer): invalidate so we get the idle handlers + as appropriate + (gtk_text_view_invalidate): new function to do invalidation, + containing old guts of invalidated_handler + Wed Oct 24 10:29:47 2001 Owen Taylor * gtk/gtkalignment.c (gtk_alignment_class_init): Improve diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index b0fb0c41f1..21af4f97f9 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,12 @@ +2001-10-24 Havoc Pennington + + * gtk/gtktextview.c (gtk_text_view_update_adjustments): don't + create layout if we didn't have one + (gtk_text_view_set_buffer): invalidate so we get the idle handlers + as appropriate + (gtk_text_view_invalidate): new function to do invalidation, + containing old guts of invalidated_handler + Wed Oct 24 10:29:47 2001 Owen Taylor * gtk/gtkalignment.c (gtk_alignment_class_init): Improve diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index b0fb0c41f1..21af4f97f9 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,12 @@ +2001-10-24 Havoc Pennington + + * gtk/gtktextview.c (gtk_text_view_update_adjustments): don't + create layout if we didn't have one + (gtk_text_view_set_buffer): invalidate so we get the idle handlers + as appropriate + (gtk_text_view_invalidate): new function to do invalidation, + containing old guts of invalidated_handler + Wed Oct 24 10:29:47 2001 Owen Taylor * gtk/gtkalignment.c (gtk_alignment_class_init): Improve diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index afd86f2aaf..523a24504f 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -291,6 +291,7 @@ static void gtk_text_view_queue_scroll (GtkTextView *text_view, static gboolean gtk_text_view_flush_scroll (GtkTextView *text_view); static void gtk_text_view_update_adjustments (GtkTextView *text_view); +static void gtk_text_view_invalidate (GtkTextView *text_view); static void gtk_text_view_update_im_spot_location (GtkTextView *text_view); @@ -1096,9 +1097,11 @@ gtk_text_view_set_buffer (GtkTextView *text_view, gtk_text_buffer_add_selection_clipboard (text_view->buffer, gtk_clipboard_get (GDK_SELECTION_PRIMARY)); } - + if (GTK_WIDGET_VISIBLE (text_view)) gtk_widget_queue_draw (GTK_WIDGET (text_view)); + + gtk_text_view_invalidate (text_view); } static GtkTextBuffer* @@ -1563,8 +1566,9 @@ gtk_text_view_update_adjustments (GtkTextView *text_view) gint width = 0, height = 0; DV(g_print(">Updating adjustments ("G_STRLOC")\n")); - - gtk_text_layout_get_size (text_view->layout, &width, &height); + + if (text_view->layout) + gtk_text_layout_get_size (text_view->layout, &width, &height); if (text_view->width != width || text_view->height != height) { @@ -2796,13 +2800,8 @@ incremental_validate_callback (gpointer data) } static void -invalidated_handler (GtkTextLayout *layout, - gpointer data) +gtk_text_view_invalidate (GtkTextView *text_view) { - GtkTextView *text_view; - - text_view = GTK_TEXT_VIEW (data); - text_view->onscreen_validated = FALSE; DV(g_print(">Invalidate, onscreen_validated = FALSE ("G_STRLOC")\n")); @@ -2822,6 +2821,17 @@ invalidated_handler (GtkTextLayout *layout, } } +static void +invalidated_handler (GtkTextLayout *layout, + gpointer data) +{ + GtkTextView *text_view; + + text_view = GTK_TEXT_VIEW (data); + + gtk_text_view_invalidate (text_view); +} + static void changed_handler (GtkTextLayout *layout, gint start_y,