summaryrefslogtreecommitdiff
path: root/gtk/gtktextlayout.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2009-09-27 00:14:54 -0400
committerMatthias Clasen <mclasen@redhat.com>2009-09-27 00:14:54 -0400
commitf506752affaf5bc0e8e96ab6c3421b042ab0319a (patch)
treeec446cd5ae3b755fd2f40601773c03149163285a /gtk/gtktextlayout.c
parent17130a8ec9f461b681cce41215f460307a20aaba (diff)
downloadgtk+-f506752affaf5bc0e8e96ab6c3421b042ab0319a.tar.gz
Handle child widgets correctly with multiple views
This was broken by an RTL fix in April.
Diffstat (limited to 'gtk/gtktextlayout.c')
-rw-r--r--gtk/gtktextlayout.c63
1 files changed, 33 insertions, 30 deletions
diff --git a/gtk/gtktextlayout.c b/gtk/gtktextlayout.c
index 319b8ce645..8c5d419b63 100644
--- a/gtk/gtktextlayout.c
+++ b/gtk/gtktextlayout.c
@@ -1812,56 +1812,59 @@ allocate_child_widgets (GtkTextLayout *text_layout,
{
PangoLayout *layout = display->layout;
PangoLayoutIter *run_iter;
-
+
run_iter = pango_layout_get_iter (layout);
-
do
{
PangoLayoutRun *run = pango_layout_iter_get_run_readonly (run_iter);
-
+
if (run && is_shape (run))
{
gint byte_index;
GtkTextIter text_iter;
- GtkTextChildAnchor *anchor = 0;
- GList *widgets = 0;
-
- /* The pango iterator iterates in visual order.
+ GtkTextChildAnchor *anchor = NULL;
+ GList *widgets = NULL;
+ GList *l;
+
+ /* The pango iterator iterates in visual order.
* We use the byte index to find the child widget.
*/
-
byte_index = pango_layout_iter_get_index (run_iter);
line_display_index_to_iter (text_layout, display, &text_iter, byte_index, 0);
anchor = gtk_text_iter_get_child_anchor (&text_iter);
- widgets = gtk_text_child_anchor_get_widgets (anchor);
-
- if (widgets)
+ if (anchor)
+ widgets = gtk_text_child_anchor_get_widgets (anchor);
+
+ for (l = widgets; l; l = l->next)
{
PangoRectangle extents;
- GtkWidget *child = widgets->data;
+ GtkWidget *child = l->data;
- /* We emit "allocate_child" with the x,y of
- * the widget with respect to the top of the line
- * and the left side of the buffer
- */
-
- pango_layout_iter_get_run_extents (run_iter,
- NULL,
- &extents);
-
- g_signal_emit (text_layout,
- signals[ALLOCATE_CHILD],
- 0,
- child,
- PANGO_PIXELS (extents.x) + display->x_offset,
- PANGO_PIXELS (extents.y) + display->top_margin);
-
- g_list_free (widgets);
+ if (_gtk_anchored_child_get_layout (child) == text_layout)
+ {
+
+ /* We emit "allocate_child" with the x,y of
+ * the widget with respect to the top of the line
+ * and the left side of the buffer
+ */
+ pango_layout_iter_get_run_extents (run_iter,
+ NULL,
+ &extents);
+
+ g_signal_emit (text_layout,
+ signals[ALLOCATE_CHILD],
+ 0,
+ child,
+ PANGO_PIXELS (extents.x) + display->x_offset,
+ PANGO_PIXELS (extents.y) + display->top_margin);
+ }
}
+
+ g_list_free (widgets);
}
}
while (pango_layout_iter_next_run (run_iter));
-
+
pango_layout_iter_free (run_iter);
}