From eccf6735c90a5c20a2b5445806e1ac7f3170c103 Mon Sep 17 00:00:00 2001 From: Havoc Pennington Date: Tue, 30 Apr 2002 20:51:35 +0000 Subject: [PATCH] use gtk_text_layout_invalidate_cache instead of cut-and-paste 2002-04-30 Havoc Pennington * gtk/gtktextlayout.c (gtk_text_layout_real_free_line_data): use gtk_text_layout_invalidate_cache instead of cut-and-paste (gtk_text_layout_real_invalidate): always invalidate cache, even if the line has no stored line data. #78573 * gtk/gtktextview.c (gtk_text_view_get_iter_location): add call to gtk_text_view_ensure_layout, #77388 (gtk_text_view_get_iter_at_location): ditto (gtk_text_view_get_line_yrange): ditto (gtk_text_view_get_line_at_y): ditto --- ChangeLog | 13 +++++++++++++ ChangeLog.pre-2-10 | 13 +++++++++++++ ChangeLog.pre-2-2 | 13 +++++++++++++ ChangeLog.pre-2-4 | 13 +++++++++++++ ChangeLog.pre-2-6 | 13 +++++++++++++ ChangeLog.pre-2-8 | 13 +++++++++++++ gtk/gtktextlayout.c | 14 ++++---------- gtk/gtktextview.c | 9 ++++++++- 8 files changed, 90 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index e0e5be9fb6..9433f2081b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -29,6 +29,19 @@ Tue Apr 30 14:15:14 2002 Owen Taylor * gdk/x11/gdkimage-x11.c : rationalized multihead code in _gdk_x11_copy_to_image. fixes #80256 and ungrab problems. +2002-04-30 Havoc Pennington + + * gtk/gtktextlayout.c (gtk_text_layout_real_free_line_data): use + gtk_text_layout_invalidate_cache instead of cut-and-paste + (gtk_text_layout_real_invalidate): always invalidate cache, even + if the line has no stored line data. #78573 + + * gtk/gtktextview.c (gtk_text_view_get_iter_location): add call to + gtk_text_view_ensure_layout, #77388 + (gtk_text_view_get_iter_at_location): ditto + (gtk_text_view_get_line_yrange): ditto + (gtk_text_view_get_line_at_y): ditto + 2002-04-30 Havoc Pennington * gtk/gtktextbtree.c (gtk_text_btree_remove_tag_info): assign diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index e0e5be9fb6..9433f2081b 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -29,6 +29,19 @@ Tue Apr 30 14:15:14 2002 Owen Taylor * gdk/x11/gdkimage-x11.c : rationalized multihead code in _gdk_x11_copy_to_image. fixes #80256 and ungrab problems. +2002-04-30 Havoc Pennington + + * gtk/gtktextlayout.c (gtk_text_layout_real_free_line_data): use + gtk_text_layout_invalidate_cache instead of cut-and-paste + (gtk_text_layout_real_invalidate): always invalidate cache, even + if the line has no stored line data. #78573 + + * gtk/gtktextview.c (gtk_text_view_get_iter_location): add call to + gtk_text_view_ensure_layout, #77388 + (gtk_text_view_get_iter_at_location): ditto + (gtk_text_view_get_line_yrange): ditto + (gtk_text_view_get_line_at_y): ditto + 2002-04-30 Havoc Pennington * gtk/gtktextbtree.c (gtk_text_btree_remove_tag_info): assign diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index e0e5be9fb6..9433f2081b 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -29,6 +29,19 @@ Tue Apr 30 14:15:14 2002 Owen Taylor * gdk/x11/gdkimage-x11.c : rationalized multihead code in _gdk_x11_copy_to_image. fixes #80256 and ungrab problems. +2002-04-30 Havoc Pennington + + * gtk/gtktextlayout.c (gtk_text_layout_real_free_line_data): use + gtk_text_layout_invalidate_cache instead of cut-and-paste + (gtk_text_layout_real_invalidate): always invalidate cache, even + if the line has no stored line data. #78573 + + * gtk/gtktextview.c (gtk_text_view_get_iter_location): add call to + gtk_text_view_ensure_layout, #77388 + (gtk_text_view_get_iter_at_location): ditto + (gtk_text_view_get_line_yrange): ditto + (gtk_text_view_get_line_at_y): ditto + 2002-04-30 Havoc Pennington * gtk/gtktextbtree.c (gtk_text_btree_remove_tag_info): assign diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index e0e5be9fb6..9433f2081b 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -29,6 +29,19 @@ Tue Apr 30 14:15:14 2002 Owen Taylor * gdk/x11/gdkimage-x11.c : rationalized multihead code in _gdk_x11_copy_to_image. fixes #80256 and ungrab problems. +2002-04-30 Havoc Pennington + + * gtk/gtktextlayout.c (gtk_text_layout_real_free_line_data): use + gtk_text_layout_invalidate_cache instead of cut-and-paste + (gtk_text_layout_real_invalidate): always invalidate cache, even + if the line has no stored line data. #78573 + + * gtk/gtktextview.c (gtk_text_view_get_iter_location): add call to + gtk_text_view_ensure_layout, #77388 + (gtk_text_view_get_iter_at_location): ditto + (gtk_text_view_get_line_yrange): ditto + (gtk_text_view_get_line_at_y): ditto + 2002-04-30 Havoc Pennington * gtk/gtktextbtree.c (gtk_text_btree_remove_tag_info): assign diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index e0e5be9fb6..9433f2081b 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -29,6 +29,19 @@ Tue Apr 30 14:15:14 2002 Owen Taylor * gdk/x11/gdkimage-x11.c : rationalized multihead code in _gdk_x11_copy_to_image. fixes #80256 and ungrab problems. +2002-04-30 Havoc Pennington + + * gtk/gtktextlayout.c (gtk_text_layout_real_free_line_data): use + gtk_text_layout_invalidate_cache instead of cut-and-paste + (gtk_text_layout_real_invalidate): always invalidate cache, even + if the line has no stored line data. #78573 + + * gtk/gtktextview.c (gtk_text_view_get_iter_location): add call to + gtk_text_view_ensure_layout, #77388 + (gtk_text_view_get_iter_at_location): ditto + (gtk_text_view_get_line_yrange): ditto + (gtk_text_view_get_line_at_y): ditto + 2002-04-30 Havoc Pennington * gtk/gtktextbtree.c (gtk_text_btree_remove_tag_info): assign diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index e0e5be9fb6..9433f2081b 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -29,6 +29,19 @@ Tue Apr 30 14:15:14 2002 Owen Taylor * gdk/x11/gdkimage-x11.c : rationalized multihead code in _gdk_x11_copy_to_image. fixes #80256 and ungrab problems. +2002-04-30 Havoc Pennington + + * gtk/gtktextlayout.c (gtk_text_layout_real_free_line_data): use + gtk_text_layout_invalidate_cache instead of cut-and-paste + (gtk_text_layout_real_invalidate): always invalidate cache, even + if the line has no stored line data. #78573 + + * gtk/gtktextview.c (gtk_text_view_get_iter_location): add call to + gtk_text_view_ensure_layout, #77388 + (gtk_text_view_get_iter_at_location): ditto + (gtk_text_view_get_line_yrange): ditto + (gtk_text_view_get_line_at_y): ditto + 2002-04-30 Havoc Pennington * gtk/gtktextbtree.c (gtk_text_btree_remove_tag_info): assign diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c index 71b585ac87..e414bf975d 100644 --- a/gtk/gtktextlayout.c +++ b/gtk/gtktextlayout.c @@ -719,11 +719,10 @@ gtk_text_layout_real_invalidate (GtkTextLayout *layout, { GtkTextLineData *line_data = _gtk_text_line_get_data (line, layout); + gtk_text_layout_invalidate_cache (layout, line); + if (line_data) - { - gtk_text_layout_invalidate_cache (layout, line); - _gtk_text_line_invalidate_wrap (line, line_data); - } + _gtk_text_line_invalidate_wrap (line, line_data); if (line == last_line) break; @@ -739,12 +738,7 @@ gtk_text_layout_real_free_line_data (GtkTextLayout *layout, GtkTextLine *line, GtkTextLineData *line_data) { - if (layout->one_display_cache && line == layout->one_display_cache->line) - { - GtkTextLineDisplay *tmp_display = layout->one_display_cache; - layout->one_display_cache = NULL; - gtk_text_layout_free_line_display (layout, tmp_display); - } + gtk_text_layout_invalidate_cache (layout, line); g_free (line_data); } diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 5f660b2ab0..2c314b583f 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -1196,8 +1196,9 @@ gtk_text_view_get_iter_at_location (GtkTextView *text_view, { g_return_if_fail (GTK_IS_TEXT_VIEW (text_view)); g_return_if_fail (iter != NULL); - g_return_if_fail (text_view->layout != NULL); + gtk_text_view_ensure_layout (text_view); + gtk_text_layout_get_iter_at_pixel (text_view->layout, iter, x, @@ -1224,6 +1225,8 @@ gtk_text_view_get_iter_location (GtkTextView *text_view, g_return_if_fail (GTK_IS_TEXT_VIEW (text_view)); g_return_if_fail (gtk_text_iter_get_buffer (iter) == get_buffer (text_view)); + gtk_text_view_ensure_layout (text_view); + gtk_text_layout_get_iter_location (text_view->layout, iter, location); } @@ -1248,6 +1251,8 @@ gtk_text_view_get_line_yrange (GtkTextView *text_view, g_return_if_fail (GTK_IS_TEXT_VIEW (text_view)); g_return_if_fail (gtk_text_iter_get_buffer (iter) == get_buffer (text_view)); + gtk_text_view_ensure_layout (text_view); + gtk_text_layout_get_line_yrange (text_view->layout, iter, y, @@ -1275,6 +1280,8 @@ gtk_text_view_get_line_at_y (GtkTextView *text_view, { g_return_if_fail (GTK_IS_TEXT_VIEW (text_view)); + gtk_text_view_ensure_layout (text_view); + gtk_text_layout_get_line_at_y (text_view->layout, target_iter, y,