[gtk+] Revert part of "textview: Remove extra magic for drawing children"
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Revert part of "textview: Remove extra magic for drawing children"
- Date: Tue, 10 Apr 2012 14:32:58 +0000 (UTC)
commit 3610ef90c3b4e555dcb6e767d4f2a79649a359f5
Author: Benjamin Otte <otte redhat com>
Date: Tue Apr 10 16:14:59 2012 +0200
Revert part of "textview: Remove extra magic for drawing children"
This partially reverts commit df37446f9b4116887865b7ecfddeb535fbc0eacb.
The commit changed API that was public (or at least semi-public) and
it's not worth changing that.
The original bug should still be fixed.
https://bugzilla.gnome.org/show_bug.cgi?id=673839
gtk/gtktextdisplay.c | 25 +++++++++++++++++++++----
gtk/gtktextdisplay.h | 3 ++-
gtk/gtktextutil.c | 2 +-
gtk/gtktextview.c | 3 ++-
4 files changed, 26 insertions(+), 7 deletions(-)
---
diff --git a/gtk/gtktextdisplay.c b/gtk/gtktextdisplay.c
index 863cb3c..db88dca 100644
--- a/gtk/gtktextdisplay.c
+++ b/gtk/gtktextdisplay.c
@@ -108,6 +108,7 @@ struct _GtkTextRenderer
cairo_t *cr;
GdkRGBA *error_color; /* Error underline color for this widget */
+ GList *widgets; /* widgets encountered when drawing */
GdkRGBA rgba[4];
guint8 rgba_set[4];
@@ -422,7 +423,12 @@ gtk_text_renderer_draw_shape (PangoRenderer *renderer,
}
else if (GTK_IS_WIDGET (attr->data))
{
- /* nothing to do */
+ GtkWidget *widget;
+
+ widget = GTK_WIDGET (attr->data);
+
+ text_renderer->widgets = g_list_prepend (text_renderer->widgets,
+ g_object_ref (widget));
}
else
g_assert_not_reached (); /* not a pixbuf or widget */
@@ -491,10 +497,11 @@ text_renderer_begin (GtkTextRenderer *text_renderer,
/* Returns a GSList of (referenced) widgets encountered while drawing.
*/
-static void
+static GList *
text_renderer_end (GtkTextRenderer *text_renderer)
{
GtkStyleContext *context;
+ GList *widgets = text_renderer->widgets;
cairo_restore (text_renderer->cr);
@@ -505,11 +512,15 @@ text_renderer_end (GtkTextRenderer *text_renderer)
text_renderer->widget = NULL;
text_renderer->cr = NULL;
+ text_renderer->widgets = NULL;
+
if (text_renderer->error_color)
{
gdk_rgba_free (text_renderer->error_color);
text_renderer->error_color = NULL;
}
+
+ return widgets;
}
static cairo_region_t *
@@ -805,7 +816,8 @@ get_text_renderer (void)
void
gtk_text_layout_draw (GtkTextLayout *layout,
GtkWidget *widget,
- cairo_t *cr)
+ cairo_t *cr,
+ GList **widgets)
{
GtkStyleContext *context;
gint offset_y;
@@ -814,6 +826,7 @@ gtk_text_layout_draw (GtkTextLayout *layout,
gboolean have_selection;
GSList *line_list;
GSList *tmp_list;
+ GList *tmp_widgets;
GdkRectangle clip;
g_return_if_fail (GTK_IS_TEXT_LAYOUT (layout));
@@ -918,7 +931,11 @@ gtk_text_layout_draw (GtkTextLayout *layout,
gtk_text_layout_wrap_loop_end (layout);
- text_renderer_end (text_renderer);
+ tmp_widgets = text_renderer_end (text_renderer);
+ if (widgets)
+ *widgets = tmp_widgets;
+ else
+ g_list_free_full (tmp_widgets, g_object_unref);
g_slist_free (line_list);
}
diff --git a/gtk/gtktextdisplay.h b/gtk/gtktextdisplay.h
index c35b133..3f130b4 100644
--- a/gtk/gtktextdisplay.h
+++ b/gtk/gtktextdisplay.h
@@ -92,7 +92,8 @@ G_BEGIN_DECLS
*/
void gtk_text_layout_draw (GtkTextLayout *layout,
GtkWidget *widget,
- cairo_t *cr);
+ cairo_t *cr,
+ GList **widgets);
G_END_DECLS
diff --git a/gtk/gtktextutil.c b/gtk/gtktextutil.c
index f5eae4c..d5a60c4 100644
--- a/gtk/gtktextutil.c
+++ b/gtk/gtktextutil.c
@@ -398,7 +398,7 @@ _gtk_text_util_create_rich_drag_icon (GtkWidget *widget,
cairo_save (cr);
cairo_translate (cr, 1 + DRAG_ICON_LAYOUT_BORDER, 1 + DRAG_ICON_LAYOUT_BORDER);
- gtk_text_layout_draw (layout, widget, cr);
+ gtk_text_layout_draw (layout, widget, cr, NULL);
cairo_restore (cr);
diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c
index c61d0fb..53e1004 100644
--- a/gtk/gtktextview.c
+++ b/gtk/gtktextview.c
@@ -4836,7 +4836,8 @@ gtk_text_view_paint (GtkWidget *widget,
gtk_text_layout_draw (priv->layout,
widget,
- cr);
+ cr,
+ NULL);
cairo_restore (cr);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]