aboutsummaryrefslogtreecommitdiffstats
path: root/libgnomecanvas/gnome-canvas-rich-text.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-01-14 01:50:49 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-06-16 02:46:02 +0800
commitc2c89fcb8cfa5661e94de5e57c7dbc80c3342ede (patch)
tree6af964bb15322661d28181dc00310e3afe618f46 /libgnomecanvas/gnome-canvas-rich-text.c
parent333897772f2cf3251915800aff2c836f02095c84 (diff)
downloadgsoc2013-evolution-c2c89fcb8cfa5661e94de5e57c7dbc80c3342ede.tar
gsoc2013-evolution-c2c89fcb8cfa5661e94de5e57c7dbc80c3342ede.tar.gz
gsoc2013-evolution-c2c89fcb8cfa5661e94de5e57c7dbc80c3342ede.tar.bz2
gsoc2013-evolution-c2c89fcb8cfa5661e94de5e57c7dbc80c3342ede.tar.lz
gsoc2013-evolution-c2c89fcb8cfa5661e94de5e57c7dbc80c3342ede.tar.xz
gsoc2013-evolution-c2c89fcb8cfa5661e94de5e57c7dbc80c3342ede.tar.zst
gsoc2013-evolution-c2c89fcb8cfa5661e94de5e57c7dbc80c3342ede.zip
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.
Diffstat (limited to 'libgnomecanvas/gnome-canvas-rich-text.c')
-rw-r--r--libgnomecanvas/gnome-canvas-rich-text.c29
1 files changed, 23 insertions, 6 deletions
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);