From c2c89fcb8cfa5661e94de5e57c7dbc80c3342ede Mon Sep 17 00:00:00 2001 From: Matthew Barnes Date: Wed, 13 Jan 2010 12:50:49 -0500 Subject: Fix all remaining GTK3 issues. Work around the issue of GnomeCanvasItem amending its own flags to GtkObject::flags (which is sealed) by giving it its own flags field. This breaks libgnomecanvas ABI and API, but I see no other way. This commit didn't work the first time because gnome-pilot libraries were still pulling in the system-wide libgnomecanvas, and that was interfereing with our bundled version which has a different ABI. But gnome-pilot integration was dropped in the previous commit, so everything is now using the bundled libgnomecanvas. --- libgnomecanvas/gnome-canvas-rich-text.c | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) (limited to 'libgnomecanvas/gnome-canvas-rich-text.c') diff --git a/libgnomecanvas/gnome-canvas-rich-text.c b/libgnomecanvas/gnome-canvas-rich-text.c index 2a50f2ed4d..db0e52fde1 100644 --- a/libgnomecanvas/gnome-canvas-rich-text.c +++ b/libgnomecanvas/gnome-canvas-rich-text.c @@ -1522,8 +1522,14 @@ gnome_canvas_rich_text_event(GnomeCanvasItem *item, GdkEvent *event) return gnome_canvas_rich_text_button_release_event( item, (GdkEventButton *) event); case GDK_FOCUS_CHANGE: - if (((GdkEventFocus *) event)->window != - item->canvas->layout.bin_window) + { + GtkLayout *layout; + GdkWindow *bin_window; + + layout = GTK_LAYOUT (item->canvas); + bin_window = gtk_layout_get_bin_window (layout); + + if (((GdkEventFocus *) event)->window != bin_window) return FALSE; if (((GdkEventFocus *) event)->in) @@ -1532,6 +1538,7 @@ gnome_canvas_rich_text_event(GnomeCanvasItem *item, GdkEvent *event) else return gnome_canvas_rich_text_focus_out_event( item, (GdkEventFocus *) event); + } default: return FALSE; } @@ -1705,8 +1712,13 @@ scale_fonts(GtkTextTag *tag, gpointer data) { GnomeCanvasRichText *text = GNOME_CANVAS_RICH_TEXT(data); + /* XXX GtkTextTag::values is sealed with apparently no way + * to access it. This looks like a small optimization + * anyway. */ +#if 0 if (!tag->values) return; +#endif g_object_set( G_OBJECT(tag), "scale", @@ -1919,7 +1931,7 @@ gnome_canvas_rich_text_ensure_layout(GnomeCanvasRichText *text) style = gtk_text_attributes_new(); gnome_canvas_rich_text_set_attributes_from_style( - text, style, canvas->style); + text, style, gtk_widget_get_style (canvas)); style->pixels_above_lines = text->_priv->pixels_above_lines; style->pixels_below_lines = text->_priv->pixels_below_lines; @@ -2120,6 +2132,8 @@ gnome_canvas_rich_text_draw(GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, int height) { GnomeCanvasRichText *text = GNOME_CANVAS_RICH_TEXT(item); + GtkStyle *style; + GtkWidget *widget; double i2w[6], w2c[6], i2c[6]; double ax, ay; int x1, y1, x2, y2; @@ -2145,13 +2159,16 @@ gnome_canvas_rich_text_draw(GnomeCanvasItem *item, GdkDrawable *drawable, y2 = c2.y; gtk_text_layout_set_screen_width(text->_priv->layout, x2 - x1); - + + widget = GTK_WIDGET (item->canvas); + style = gtk_widget_get_style (widget); + /* FIXME: should last arg be NULL? */ gtk_text_layout_draw( text->_priv->layout, - GTK_WIDGET(item->canvas), + widget, drawable, - GTK_WIDGET (item->canvas)->style->text_gc[GTK_STATE_NORMAL], + style->text_gc[GTK_STATE_NORMAL], x - x1, y - y1, 0, 0, (x2 - x1) - (x - x1), (y2 - y1) - (y - y1), NULL); -- cgit v1.2.3