aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChong Yidong2005-11-16 16:38:48 +0000
committerChong Yidong2005-11-16 16:38:48 +0000
commit9f7b984baef1351ccd203ddfcad11fa574931a1c (patch)
tree2f34225ff32a446b9fdca91280dd179e2e69809f /src
parent5cb35db59310dfa9ee60cb07772def32576668a8 (diff)
downloademacs-9f7b984baef1351ccd203ddfcad11fa574931a1c.tar.gz
emacs-9f7b984baef1351ccd203ddfcad11fa574931a1c.zip
* xfns.c (xg_set_icon_from_xpm_data): New function.
* gnu.h (gnu_xpm_bits): Renamed from gnu_bits. (gnu_xbm_bits): Renamed from gnu_bits (xbm version). * xterm.c (x_bitmap_icon): Use the xpm if available.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/gnu.h12
-rw-r--r--src/xfns.c21
-rw-r--r--src/xterm.c29
4 files changed, 53 insertions, 14 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index d366093114b..513d9d0ff92 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,6 +1,9 @@
12005-11-16 Chong Yidong <cyd@stupidchicken.com> 12005-11-16 Chong Yidong <cyd@stupidchicken.com>
2 2
3 * gnu.h (gnu_bits): Xpm version of the new Emacs icon. 3 * xfns.c (xg_set_icon_from_xpm_data): New function.
4
5 * gnu.h (gnu_xpm_bits): Renamed from gnu_bits.
6 (gnu_xbm_bits): Renamed from gnu_bits (xbm version).
4 7
5 * xterm.c (x_bitmap_icon): Use the xpm if available. 8 * xterm.c (x_bitmap_icon): Use the xpm if available.
6 9
diff --git a/src/gnu.h b/src/gnu.h
index 2f3bb4c7e51..dbf47317493 100644
--- a/src/gnu.h
+++ b/src/gnu.h
@@ -1,5 +1,5 @@
1#if defined (HAVE_XPM) && defined (HAVE_X_WINDOWS) 1#if defined (HAVE_XPM) && defined (HAVE_X_WINDOWS)
2static char * gnu_bits[] = { 2static char * gnu_xpm_bits[] = {
3"32 32 173 2", 3"32 32 173 2",
4" c None", 4" c None",
5". c #67627D", 5". c #67627D",
@@ -206,10 +206,11 @@ static char * gnu_bits[] = {
206" P.P.P.P.P.P.P.P.P.P.P.P.P.P.P.P.P.P.P.P.P.P.P.P. ", 206" P.P.P.P.P.P.P.P.P.P.P.P.P.P.P.P.P.P.P.P.P.P.P.P. ",
207" ", 207" ",
208" "}; 208" "};
209#else 209#endif /* defined (HAVE_XPM) && defined (HAVE_X_WINDOWS) */
210#define gnu_width 50 210
211#define gnu_height 50 211#define gnu_xbm_width 50
212static unsigned char gnu_bits[] = { 212#define gnu_xbm_height 50
213static unsigned char gnu_xbm_bits[] = {
213 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 214 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
214 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 215 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,
215 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 216 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00,
@@ -240,7 +241,6 @@ static unsigned char gnu_bits[] = {
240 0xf8, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0x00, 241 0xf8, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x02, 0x00, 0x00, 0x00,
241 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 242 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
242 0x00, 0x00}; 243 0x00, 0x00};
243#endif
244 244
245/* arch-tag: b57020c7-c937-4d77-8ca6-3875178d9828 245/* arch-tag: b57020c7-c937-4d77-8ca6-3875178d9828
246 (do not change this comment) */ 246 (do not change this comment) */
diff --git a/src/xfns.c b/src/xfns.c
index a1aee42b85b..c3eb173b4f9 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -818,6 +818,27 @@ xg_set_icon (f, file)
818 UNGCPRO; 818 UNGCPRO;
819 return result; 819 return result;
820} 820}
821
822int
823xg_set_icon_from_xpm_data (f, data)
824 FRAME_PTR f;
825 char **data;
826{
827 int result = 0;
828 GError *err = NULL;
829 GdkPixbuf *pixbuf = gdk_pixbuf_new_from_xpm_data (data);
830
831 if (!pixbuf)
832 {
833 g_error_free (err);
834 return 0;
835 }
836
837 gtk_window_set_icon (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
838 pixbuf);
839 g_object_unref (pixbuf);
840 return 1;
841}
821#endif /* USE_GTK */ 842#endif /* USE_GTK */
822 843
823 844
diff --git a/src/xterm.c b/src/xterm.c
index 8359cec0112..113a942de5f 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -7362,15 +7362,30 @@ x_bitmap_icon (f, file)
7362 /* Create the GNU bitmap and mask if necessary. */ 7362 /* Create the GNU bitmap and mask if necessary. */
7363 if (FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id < 0) 7363 if (FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id < 0)
7364 { 7364 {
7365 int rc = -1;
7366
7365#if defined (HAVE_XPM) && defined (HAVE_X_WINDOWS) 7367#if defined (HAVE_XPM) && defined (HAVE_X_WINDOWS)
7366 FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id 7368#ifdef USE_GTK
7367 = x_create_bitmap_from_xpm_data (f, gnu_bits); 7369 if (xg_set_icon_from_xpm_data (f, gnu_xpm_bits))
7370 return 0;
7368#else 7371#else
7369 FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id 7372 rc = x_create_bitmap_from_xpm_data (f, gnu_xpm_bits);
7370 = x_create_bitmap_from_data (f, gnu_bits, 7373 if (rc != -1)
7371 gnu_width, gnu_height); 7374 FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id = rc;
7372#endif /* (HAVE_XPM) && defined (HAVE_X_WINDOWS) */ 7375#endif /* USE_GTK */
7373 x_create_bitmap_mask (f, FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id); 7376#endif /* defined (HAVE_XPM) && defined (HAVE_X_WINDOWS) */
7377
7378 /* If all else fails, use the (black and white) xbm image. */
7379 if (rc == -1)
7380 {
7381 rc = x_create_bitmap_from_data (f, gnu_xbm_bits,
7382 gnu_xbm_width, gnu_xbm_height);
7383 if (rc == -1)
7384 return 1;
7385
7386 FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id = rc;
7387 x_create_bitmap_mask (f, FRAME_X_DISPLAY_INFO (f)->icon_bitmap_id);
7388 }
7374 } 7389 }
7375 7390
7376 /* The first time we create the GNU bitmap and mask, 7391 /* The first time we create the GNU bitmap and mask,