handle NULL shaped object from the empty-child-anchor case by drawing a

2001-08-30  Havoc Pennington  <hp@redhat.com>

	* gtk/gtktextdisplay.c (render_layout_line): handle NULL shaped
	object from the empty-child-anchor case by drawing a little box.

	* gtk/gtktextlayout.c (add_child_attrs): Still set shape attribute
	if the child anchor has no anchored widgets - fixes #59328.

	Also, remove bizarre deletion of preedit string that seems to have
	gotten in here somehow.
This commit is contained in:
Havoc Pennington 2001-08-30 19:09:09 +00:00 committed by Havoc Pennington
parent 181cacbfea
commit 5137409a90
9 changed files with 123 additions and 17 deletions

View File

@ -1,3 +1,14 @@
2001-08-30 Havoc Pennington <hp@redhat.com>
* gtk/gtktextdisplay.c (render_layout_line): handle NULL shaped
object from the empty-child-anchor case by drawing a little box.
* gtk/gtktextlayout.c (add_child_attrs): Still set shape attribute
if the child anchor has no anchored widgets - fixes #59328.
Also, remove bizarre deletion of preedit string that seems to have
gotten in here somehow.
2001-08-30 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_check_cursor_blink): apply fix

View File

@ -1,3 +1,14 @@
2001-08-30 Havoc Pennington <hp@redhat.com>
* gtk/gtktextdisplay.c (render_layout_line): handle NULL shaped
object from the empty-child-anchor case by drawing a little box.
* gtk/gtktextlayout.c (add_child_attrs): Still set shape attribute
if the child anchor has no anchored widgets - fixes #59328.
Also, remove bizarre deletion of preedit string that seems to have
gotten in here somehow.
2001-08-30 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_check_cursor_blink): apply fix

View File

@ -1,3 +1,14 @@
2001-08-30 Havoc Pennington <hp@redhat.com>
* gtk/gtktextdisplay.c (render_layout_line): handle NULL shaped
object from the empty-child-anchor case by drawing a little box.
* gtk/gtktextlayout.c (add_child_attrs): Still set shape attribute
if the child anchor has no anchored widgets - fixes #59328.
Also, remove bizarre deletion of preedit string that seems to have
gotten in here somehow.
2001-08-30 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_check_cursor_blink): apply fix

View File

@ -1,3 +1,14 @@
2001-08-30 Havoc Pennington <hp@redhat.com>
* gtk/gtktextdisplay.c (render_layout_line): handle NULL shaped
object from the empty-child-anchor case by drawing a little box.
* gtk/gtktextlayout.c (add_child_attrs): Still set shape attribute
if the child anchor has no anchored widgets - fixes #59328.
Also, remove bizarre deletion of preedit string that seems to have
gotten in here somehow.
2001-08-30 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_check_cursor_blink): apply fix

View File

@ -1,3 +1,14 @@
2001-08-30 Havoc Pennington <hp@redhat.com>
* gtk/gtktextdisplay.c (render_layout_line): handle NULL shaped
object from the empty-child-anchor case by drawing a little box.
* gtk/gtktextlayout.c (add_child_attrs): Still set shape attribute
if the child anchor has no anchored widgets - fixes #59328.
Also, remove bizarre deletion of preedit string that seems to have
gotten in here somehow.
2001-08-30 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_check_cursor_blink): apply fix

View File

@ -1,3 +1,14 @@
2001-08-30 Havoc Pennington <hp@redhat.com>
* gtk/gtktextdisplay.c (render_layout_line): handle NULL shaped
object from the empty-child-anchor case by drawing a little box.
* gtk/gtktextlayout.c (add_child_attrs): Still set shape attribute
if the child anchor has no anchored widgets - fixes #59328.
Also, remove bizarre deletion of preedit string that seems to have
gotten in here somehow.
2001-08-30 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_check_cursor_blink): apply fix

View File

@ -1,3 +1,14 @@
2001-08-30 Havoc Pennington <hp@redhat.com>
* gtk/gtktextdisplay.c (render_layout_line): handle NULL shaped
object from the empty-child-anchor case by drawing a little box.
* gtk/gtktextlayout.c (add_child_attrs): Still set shape attribute
if the child anchor has no anchored widgets - fixes #59328.
Also, remove bizarre deletion of preedit string that seems to have
gotten in here somehow.
2001-08-30 Havoc Pennington <hp@redhat.com>
* gtk/gtktextview.c (gtk_text_view_check_cursor_blink): apply fix

View File

@ -297,8 +297,38 @@ render_layout_line (GdkDrawable *drawable,
GObject *shaped = (*shaped_pointer)->data;
*shaped_pointer = (*shaped_pointer)->next;
if (GDK_IS_PIXBUF (shaped))
if (shaped == NULL)
{
/* This happens if we have an empty widget anchor. Draw
* something empty-looking.
*/
GdkRectangle shape_rect, draw_rect;
shape_rect.x = x + x_off / PANGO_SCALE;
shape_rect.y = risen_y - PANGO_PIXELS (logical_rect.height);
shape_rect.width = PANGO_PIXELS (logical_rect.width);
shape_rect.height = PANGO_PIXELS (logical_rect.height);
if (gdk_rectangle_intersect (&shape_rect, &render_state->clip_rect,
&draw_rect))
{
gdk_draw_rectangle (drawable, render_state->fg_gc,
FALSE, shape_rect.x, shape_rect.y,
shape_rect.width, shape_rect.height);
gdk_draw_line (drawable, render_state->fg_gc,
shape_rect.x, shape_rect.y,
shape_rect.x + shape_rect.width,
shape_rect.y + shape_rect.height);
gdk_draw_line (drawable, render_state->fg_gc,
shape_rect.x + shape_rect.width, shape_rect.y,
shape_rect.x,
shape_rect.y + shape_rect.height);
}
}
else if (GDK_IS_PIXBUF (shaped))
{
gint width, height;
GdkRectangle pixbuf_rect, draw_rect;

View File

@ -1411,23 +1411,19 @@ add_child_attrs (GtkTextLayout *layout,
if (tmp_list == NULL)
{
/* No widget at this anchor in this display;
* not an error.
/* If tmp_list == NULL then there is no widget at this anchor in
* this display; not an error. We make up an arbitrary size
* to use, just so the programmer can see the blank spot.
* We also put a NULL in the shaped objects list, to keep
* the correspondence between the list and the shaped chars in
* the layout. A bad hack, yes.
*/
return;
}
width = 30;
height = 20;
if (layout->preedit_string)
{
g_free (layout->preedit_string);
layout->preedit_string = NULL;
}
if (layout->preedit_attrs)
{
pango_attr_list_unref (layout->preedit_attrs);
layout->preedit_attrs = NULL;
display->shaped_objects =
g_slist_append (display->shaped_objects, NULL);
}
logical_rect.x = 0;
@ -1540,7 +1536,10 @@ allocate_child_widgets (GtkTextLayout *text_layout,
GObject *shaped_object = shaped->data;
shaped = shaped->next;
if (GTK_IS_WIDGET (shaped_object))
/* shaped_object is NULL for child anchors with no
* widgets stored at them
*/
if (shaped_object && GTK_IS_WIDGET (shaped_object))
{
PangoRectangle extents;