diff options
author | Owen Taylor <otaylor@src.gnome.org> | 2000-11-15 21:12:58 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2000-11-15 21:12:58 +0000 |
commit | de49f2ce050d3581d848137ec037fcd3a92385d9 (patch) | |
tree | c7f03e9e42685af709721f0dae3d4bf13f3858db /gtk | |
parent | c990d4ab1a1598cb9b252159f5b3730c3f96e7a4 (diff) | |
download | gtk+-de49f2ce050d3581d848137ec037fcd3a92385d9.tar.gz |
ed Nov 15 16:02:20 2000 Owen Taylor <otaylor@redhat.com>
* gtk/gtktextview.c (changed_handler): Call scroll_calc_now()
unconditionally, since we may need to update the horizontal
scrollbars even if the height didn't change.
* gtk/gtktextlayout.c (add_preedit_attrs): Always get
the extra attrs, since some of them affect size.
* gtk/gtktextdisplay.c (gtk_text_layout_draw): Factor in
x_offset correctly.
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtktextdisplay.c | 8 | ||||
-rw-r--r-- | gtk/gtktextlayout.c | 33 | ||||
-rw-r--r-- | gtk/gtktextview.c | 21 |
3 files changed, 25 insertions, 37 deletions
diff --git a/gtk/gtktextdisplay.c b/gtk/gtktextdisplay.c index ebe457549c..104a278ecf 100644 --- a/gtk/gtktextdisplay.c +++ b/gtk/gtktextdisplay.c @@ -668,8 +668,8 @@ void gtk_text_layout_draw (GtkTextLayout *layout, GtkWidget *widget, GdkDrawable *drawable, - /* Location of the layout - in buffer coordinates */ + /* Location of the drawable + in layout coordinates */ gint x_offset, gint y_offset, /* Region of the layout to @@ -782,9 +782,9 @@ gtk_text_layout_draw (GtkTextLayout *layout, gc = widget->style->fg_gc[GTK_STATE_NORMAL]; gdk_draw_line (drawable, gc, - line_display->x_offset + cursor->x, + line_display->x_offset + cursor->x - x_offset, current_y + line_display->top_margin + cursor->y, - line_display->x_offset + cursor->x, + line_display->x_offset + cursor->x - x_offset, current_y + line_display->top_margin + cursor->y + cursor->height - 1); cursor_list = cursor_list->next; diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c index f6c1e755e4..01d76ddab3 100644 --- a/gtk/gtktextlayout.c +++ b/gtk/gtktextlayout.c @@ -480,17 +480,8 @@ gtk_text_layout_get_size (GtkTextLayout *layout, gint *width, gint *height) { - gint w, h; - g_return_if_fail (GTK_IS_TEXT_LAYOUT (layout)); - gtk_text_btree_get_view_size (_gtk_text_buffer_get_btree (layout->buffer), - layout, - &w, &h); - - layout->width = w; - layout->height = h; - if (width) *width = layout->width; @@ -739,6 +730,14 @@ gtk_text_layout_is_valid (GtkTextLayout *layout) layout); } +static void +update_layout_size (GtkTextLayout *layout) +{ + gtk_text_btree_get_view_size (_gtk_text_buffer_get_btree (layout->buffer), + layout, + &layout->width, &layout->height); +} + /** * gtk_text_layout_validate_yrange: * @layout: a #GtkTextLayout @@ -835,13 +834,17 @@ gtk_text_layout_validate_yrange (GtkTextLayout *layout, line = gtk_text_line_next (line); } - /* If we found and validated any invalid lines, emit the changed singal + /* If we found and validated any invalid lines, update size and + * emit the changed signal */ if (first_line) { - gint line_top = - gtk_text_btree_find_line_top (_gtk_text_buffer_get_btree (layout->buffer), - first_line, layout); + gint line_top; + + update_layout_size (layout); + + line_top = gtk_text_btree_find_line_top (_gtk_text_buffer_get_btree (layout->buffer), + first_line, layout); gtk_text_layout_changed (layout, line_top, @@ -874,6 +877,8 @@ gtk_text_layout_validate (GtkTextLayout *layout, &y, &old_height, &new_height)) { max_pixels -= new_height; + + update_layout_size (layout); gtk_text_layout_changed (layout, y, old_height, new_height); } } @@ -1475,7 +1480,7 @@ add_preedit_attrs (GtkTextLayout *layout, end = layout->preedit_len; pango_attr_iterator_get_font (iter, &style->font, - &font_desc, size_only ? NULL : &extra_attrs); + &font_desc, &extra_attrs); tmp_list = extra_attrs; while (tmp_list) diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index c1112fc8af..72ca677464 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -2141,11 +2141,11 @@ changed_handler (GtkTextLayout *layout, yoffset_changed = TRUE; } - gtk_text_view_scroll_calc_now (text_view); - if (yoffset_changed) gtk_adjustment_value_changed (get_vadjustment (text_view)); } + + gtk_text_view_scroll_calc_now (text_view); } static void @@ -3539,25 +3539,8 @@ gtk_text_view_scroll_calc_now (GtkTextView *text_view) gtk_text_layout_get_size (text_view->layout, &width, &height); -#if 0 - /* If the width is less than the screen width (likely - if we have wrapping turned on for the whole widget), - then we want to set the scroll region to the screen - width. If the width is greater (wrapping off) then we - probably want to set the scroll region to the width - of the layout. I guess. - */ - - width = MAX (text_view->layout->screen_width, width); - height = height; -#endif - if (text_view->width != width || text_view->height != height) { -#if 0 - printf ("layout size set, widget width is %d\n", - GTK_WIDGET (text_view)->allocation.width); -#endif text_view->width = width; text_view->height = height; |