diff src/image.c @ 66919:a9d1837b115c

* gnu.h (gnu_bits): Xpm version of the new Emacs icon. * xterm.c (x_bitmap_icon): Use the xpm if available. * image.c (x_create_bitmap_from_xpm_data): New function.
author Chong Yidong <cyd@stupidchicken.com>
date Wed, 16 Nov 2005 05:49:18 +0000
parents cbefce182d81
children 53960d1c1f2f
line wrap: on
line diff
--- a/src/image.c	Wed Nov 16 05:02:40 2005 +0000
+++ b/src/image.c	Wed Nov 16 05:49:18 2005 +0000
@@ -3716,6 +3716,40 @@
 
 #endif /* HAVE_XPM || MAC_OS */
 
+#if defined (HAVE_XPM) && defined (HAVE_X_WINDOWS)
+int
+x_create_bitmap_from_xpm_data (f, bits)
+     struct frame *f;
+     char **bits;
+{
+  Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
+  int id, rc;
+  XpmAttributes attrs;
+  Pixmap bitmap, mask;
+
+  bzero (&attrs, sizeof attrs);
+
+  rc = XpmCreatePixmapFromData (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
+				bits, &bitmap, &mask, &attrs);
+  if (rc != XpmSuccess)
+    return -1;
+
+  id = x_allocate_bitmap_record (f);
+
+  dpyinfo->bitmaps[id - 1].pixmap = bitmap;
+  dpyinfo->bitmaps[id - 1].have_mask = 1;
+  dpyinfo->bitmaps[id - 1].mask = mask;
+  dpyinfo->bitmaps[id - 1].file = NULL;
+  dpyinfo->bitmaps[id - 1].height = attrs.height;
+  dpyinfo->bitmaps[id - 1].width = attrs.width;
+  dpyinfo->bitmaps[id - 1].depth = attrs.depth;
+  dpyinfo->bitmaps[id - 1].refcount = 1;
+
+  XpmFreeAttributes (&attrs);
+  return id;
+}
+#endif /* HAVE_X_WINDOWS */
+
 /* Load image IMG which will be displayed on frame F.  Value is
    non-zero if successful.  */