GtkWidget *widget,
GtkImage *old_widget)
{
+#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+ cairo_surface_t *surface;
+#else
GdkPixbuf *icon_buf;
+#endif
/* If we have a file, let GTK do all the image handling.
This seems to be the only way to make insensitive and activated icons
on a monochrome display, and sometimes bad on all displays with
certain themes. */
+#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+ surface = img->cr_data;
+
+ if (surface)
+ {
+ if (! old_widget)
+ old_widget = GTK_IMAGE (gtk_image_new_from_surface (surface));
+ else
+ gtk_image_set_from_surface (old_widget, surface);
+ }
+#else
/* This is a workaround to make icons look good on pseudo color
displays. Apparently GTK expects the images to have an alpha
channel. If they don't, insensitive and activated icons will
g_object_unref (G_OBJECT (icon_buf));
}
+#endif
return GTK_WIDGET (old_widget);
}
{
gpointer gold_img = g_object_get_data (G_OBJECT (wimage),
XG_TOOL_BAR_IMAGE_DATA);
+#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+ void *old_img = (void *) gold_img;
+ if (old_img != img->cr_data)
+ return 1;
+#else
Pixmap old_img = (Pixmap) gold_img;
if (old_img != img->pixmap)
return 1;
+#endif
}
/* Check button configuration and label. */
img = IMAGE_FROM_ID (f, img_id);
prepare_image_for_display (f, img);
- if (img->load_failed_p || img->pixmap == None)
+ if (img->load_failed_p
+#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+ || img->cr_data == NULL
+#else
+ || img->pixmap == None
+#endif
+ )
{
if (ti)
gtk_container_remove (GTK_CONTAINER (wtoolbar),
{
w = xg_get_image_for_pixmap (f, img, x->widget, NULL);
g_object_set_data (G_OBJECT (w), XG_TOOL_BAR_IMAGE_DATA,
- (gpointer)img->pixmap);
+#if defined USE_CAIRO && GTK_CHECK_VERSION (3, 10, 0)
+ (gpointer)img->cr_data
+#else
+ (gpointer)img->pixmap
+#endif
+ );
}
#if GTK_CHECK_VERSION (3, 14, 0)