summaryrefslogtreecommitdiff
path: root/src/image.c
diff options
context:
space:
mode:
authorChong Yidong <cyd@stupidchicken.com>2005-11-16 05:49:18 +0000
committerChong Yidong <cyd@stupidchicken.com>2005-11-16 05:49:18 +0000
commit786a43d6cf102c185b05a31c10fba6b62b21511a (patch)
treee86798e3e8e287214932fe2bd4171c2f79867a01 /src/image.c
parent496f36c064a146b0d43a6ffc6ff1c7425cb5254b (diff)
downloademacs-786a43d6cf102c185b05a31c10fba6b62b21511a.tar.gz
* 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.
Diffstat (limited to 'src/image.c')
-rw-r--r--src/image.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/image.c b/src/image.c
index 08d2a9f9813..aec66eb3cb8 100644
--- a/src/image.c
+++ b/src/image.c
@@ -3716,6 +3716,40 @@ xpm_image_p (object)
#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. */