GNOME Bugzilla – Bug 529544
Problem with XPM images in OSX
Last modified: 2008-10-25 04:50:53 UTC
Please describe the problem: On OSX GtkImages created from disk or memory XPM files are not rendered at all, tried with branch 2.12 and with trunk. Here is a minimal example: #include <gtk/gtk.h> static char * cross_xpm[] = { "16 16 2 1", " c None", ". c #FF0000", " ", " .. ", " ... ... ", " ... ... ", " .. ... ", " ... .. ", " .... ", " .. ", " ... ", " ...... ", " ... ... ", " ... ... ", " ... ... ", " .. .. ", " ", " "}; GtkWidget *create_pixmap(GtkWidget *ref, void *ptr) { GtkWidget *pixmap; GdkPixmap *gdkpixmap; GdkBitmap *mask; gdkpixmap = gdk_pixmap_colormap_create_from_xpm_d (NULL, gtk_widget_get_colormap(ref), &mask, NULL, ptr); pixmap = gtk_image_new_from_pixmap (gdkpixmap, mask); gdk_pixmap_unref (gdkpixmap); gdk_bitmap_unref (mask); return pixmap; } int main(int argc, char *argv[]) { GtkWidget *w, *b; gtk_init(&argc, &argv); w = gtk_window_new(GTK_WINDOW_TOPLEVEL); b = gtk_toggle_button_new(); gtk_container_add(GTK_CONTAINER(b), create_pixmap(w, cross_xpm)); gtk_container_add(GTK_CONTAINER(w), b); gtk_widget_show_all(w); gtk_main(); return 0; } Steps to reproduce: Use the attached minimal example or: 1. Create a pixmap from an XPM (on disk or in ram) with gdk_pixmap_colormap_create_from_xpm_d for instance 2. Try to display it inside a GtkImage (created with gtk_image_new_from_pixmap) Actual results: On OSX platform the example program renders an empty button. Expected results: On win32/linux (with various GTK versions) the cross image of the example program is rendered correctly. Does this happen every time? Yes, on OSX (both 10.4 and 10.5) Other information:
Looks very similar to bug 502997
*** This bug has been marked as a duplicate of 502997 ***