changeset 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 a4fc9278ae05
children 47bb0fdd5b6b
files src/ChangeLog src/gnu.h src/image.c src/xterm.c
diffstat 4 files changed, 166 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Wed Nov 16 05:02:40 2005 +0000
+++ b/src/ChangeLog	Wed Nov 16 05:49:18 2005 +0000
@@ -1,3 +1,11 @@
+2005-11-16  Chong Yidong  <cyd@stupidchicken.com>
+
+	* 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.
+
 2005-11-15  Luc Teirlinck  <teirllm@auburn.edu>
 
 	* Makefile.in (lisp, shortlisp): Add rfn-eshadow.
--- a/src/gnu.h	Wed Nov 16 05:02:40 2005 +0000
+++ b/src/gnu.h	Wed Nov 16 05:49:18 2005 +0000
@@ -1,3 +1,118 @@
+#if defined (HAVE_XPM) && defined (HAVE_X_WINDOWS)
+static char * gnu_bits[] = {
+"16 16 95 2",
+"  	c None",
+". 	c #686482",
+"+ 	c #615C79",
+"@ 	c #5F5B76",
+"# 	c #68647D",
+"$ 	c #757186",
+"% 	c #787589",
+"& 	c #726E84",
+"* 	c #68647E",
+"= 	c #676280",
+"- 	c #C3C1CC",
+"; 	c #B7B4C6",
+"> 	c #9893B1",
+", 	c #A5A1BA",
+"' 	c #E5E4EB",
+") 	c #FFFFFF",
+"! 	c #F2F1F5",
+"~ 	c #BEBBCE",
+"{ 	c #8E8AA6",
+"] 	c #6D6882",
+"^ 	c #5F5B77",
+"/ 	c #B7B4C5",
+"( 	c #938FAB",
+"_ 	c #A7A4BB",
+": 	c #F9F8F9",
+"< 	c #D0CEDA",
+"[ 	c #9995B0",
+"} 	c #8984A0",
+"| 	c #5D5974",
+"1 	c #8E8AA5",
+"2 	c #D5D3DD",
+"3 	c #BFBDCD",
+"4 	c #5C5873",
+"5 	c #8985A0",
+"6 	c #9F9CB1",
+"7 	c #F8F7F9",
+"8 	c #AEABBD",
+"9 	c #5B5772",
+"0 	c #85819A",
+"a 	c #9491A6",
+"b 	c #E1E0E5",
+"c 	c #F7F7F9",
+"d 	c #B3B1C0",
+"e 	c #8D89A1",
+"f 	c #5A5670",
+"g 	c #817D95",
+"h 	c #89859B",
+"i 	c #D8D7DE",
+"j 	c #EFEFF1",
+"k 	c #C8C6D1",
+"l 	c #58546D",
+"m 	c #7C798E",
+"n 	c #E6E5E9",
+"o 	c #F7F6F8",
+"p 	c #B5B3BF",
+"q 	c #56526B",
+"r 	c #DFDEE3",
+"s 	c #AAA8B5",
+"t 	c #545068",
+"u 	c #504D64",
+"v 	c #A7A6B1",
+"w 	c #F4F4F5",
+"x 	c #7C7A8B",
+"y 	c #514E65",
+"z 	c #4A475D",
+"A 	c #555267",
+"B 	c #BBBAC2",
+"C 	c #D2D1D6",
+"D 	c #777586",
+"E 	c #4E4B62",
+"F 	c #444156",
+"G 	c #5B586B",
+"H 	c #D0CFD5",
+"I 	c #5B596B",
+"J 	c #4B485E",
+"K 	c #423F53",
+"L 	c #3F3C4F",
+"M 	c #DBDADE",
+"N 	c #F3F3F4",
+"O 	c #636170",
+"P 	c #464357",
+"Q 	c #48455A",
+"R 	c #3F3C4E",
+"S 	c #3A3748",
+"T 	c #53505F",
+"U 	c #9D9BA4",
+"V 	c #F3F2F4",
+"W 	c #908F9A",
+"X 	c #423F52",
+"Y 	c #454256",
+"Z 	c #524F62",
+"` 	c #6B6879",
+" .	c #7D7B8B",
+"..	c #9D9AA8",
+"+.	c #9694A2",
+"    . + @ @ @ # $ % % % & * .   ",
+"  = - ; > , ' ) ) ) ! ~ > { ] = ",
+"  ^ / ( _ : ) ) ) < [ ( ( ( } ^ ",
+"  | 1 1 2 ) ) ) 3 1 1 1 1 1 1 | ",
+"  4 5 5 6 7 ) ) 8 5 5 5 5 5 5 4 ",
+"  9 0 0 0 a b ) c d e 0 0 0 0 9 ",
+"  f g g h i ) ) ) j k g g g g f ",
+"  l m m n ) ) o p m m m m m m l ",
+"  q q q r ) ) s q q q q q q q q ",
+"  t u u u v w w x u u u u u u t ",
+"  y z z z z A B ) C D z z z z y ",
+"  E F F F F F F G H ) H I F F E ",
+"  J K L L L L L L L M ) N O K J ",
+"  P Q R S S S S T U V ) ) W Q P ",
+"    X Y Y Y Y Z `  ...+.` Y X   ",
+"                                "};
+#else
 #define gnu_width 50
 #define gnu_height 50
 static unsigned char gnu_bits[] = {
@@ -13,8 +128,8 @@
    0xc7, 0xe3, 0x1f, 0x00, 0x10, 0xf1, 0xd8, 0x01, 0x05, 0x3c, 0x00, 0x10,
    0x83, 0x6c, 0x00, 0x1a, 0x40, 0x00, 0x10, 0x66, 0x36, 0x54, 0xd5, 0xff,
    0x00, 0x30, 0x3c, 0xdb, 0xab, 0x3a, 0x2a, 0x00, 0x60, 0x80, 0xe9, 0x54,
-   0x35, 0x00, 0x00, 0xe0, 0xe0, 0x6c, 0xb9, 0x6a, 0x00, 0x00, 0x80, 0x37,
-   0xb6, 0x66, 0x75, 0x00, 0x00, 0x00, 0x0f, 0xb6, 0xb4, 0x6a, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x06, 0xb3, 0x77, 0x75, 0x00, 0x00, 0x00, 0xe1, 0x19, 0xa7, 0x6a,
    0x00, 0x00, 0xc0, 0xff, 0x19, 0x48, 0xf5, 0x00, 0x00, 0x40, 0x75, 0x15,
    0xaf, 0xea, 0x00, 0x00, 0x00, 0x70, 0x35, 0x66, 0xd5, 0x00, 0x00, 0x00,
@@ -32,5 +147,7 @@
    0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00};
 
+#endif
+
 /* arch-tag: b57020c7-c937-4d77-8ca6-3875178d9828
    (do not change this comment) */
--- 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.  */
 
--- a/src/xterm.c	Wed Nov 16 05:02:40 2005 +0000
+++ b/src/xterm.c	Wed Nov 16 05:49:18 2005 +0000
@@ -7362,9 +7362,14 @@
       /* Create the GNU bitmap and mask if necessary.  */
       if (FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id < 0)
 	{
+#if defined (HAVE_XPM) && defined (HAVE_X_WINDOWS)
+	  FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id
+	    = x_create_bitmap_from_xpm_data (f, gnu_bits);
+#else
 	  FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id
 	    = x_create_bitmap_from_data (f, gnu_bits,
 					 gnu_width, gnu_height);
+#endif /*  (HAVE_XPM) && defined (HAVE_X_WINDOWS) */
 	  x_create_bitmap_mask (f, FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id);
 	}