After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 529544 - Problem with XPM images in OSX
Problem with XPM images in OSX
Status: RESOLVED DUPLICATE of bug 502997
Product: gtk+
Classification: Platform
Component: Backend: Quartz
2.12.x
Other Mac OS
: Normal normal
: ---
Assigned To: gtk-quartz maintainers
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2008-04-23 13:48 UTC by Gabriele Greco
Modified: 2008-10-25 04:50 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Gabriele Greco 2008-04-23 13:48:25 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:
Comment 1 Matthias Clasen 2008-07-15 04:37:26 UTC
Looks very similar to bug 502997
Comment 2 Richard Hult 2008-07-25 07:13:02 UTC

*** This bug has been marked as a duplicate of 502997 ***