# HG changeset patch # User Richard M. Stallman # Date 782258482 0 # Node ID f8b7a65a94bc35e7cc3c0ba7801b9bd70e40e626 # Parent 449e024f13be914b5bff21762f5b437b7b3261c6 (x_bitmap_icon): Allow bitmap to come from file. (x_wm_set_icon_pixmap): Second arg is now pixmap_id; call x_lookup_pixmap. (x_text_icon): Call x_destroy_bitmap. diff -r 449e024f13be -r f8b7a65a94bc src/xterm.c --- a/src/xterm.c Sat Oct 15 21:29:19 1994 +0000 +++ b/src/xterm.c Sat Oct 15 22:01:22 1994 +0000 @@ -144,11 +144,11 @@ int BLOCK_INPUT_mask; #endif /* ! defined (SIGIO) && defined (FIONREAD) */ -/* The id of a bitmap used for icon windows. - One such map is shared by all Emacs icon windows. - This is zero if we have not yet had a need to create the bitmap. */ - -static Bitmap icon_bitmap; +/* The id of a bitmap used for icon windows, in frames + for which no specific bitmap was specified. + This is 0 if we have not yet had a need to create the bitmap. */ + +static int icon_bitmap; /* Font used for text icons. */ @@ -4263,18 +4263,26 @@ x_bitmap_icon (f) struct frame *f; { - int mask; + int mask, bitmap_id; Window icon_window; if (FRAME_X_WINDOW (f) == 0) return 1; - if (! icon_bitmap) - icon_bitmap = - XCreateBitmapFromData (x_current_display, FRAME_X_WINDOW (f), - gnu_bits, gnu_width, gnu_height); - x_wm_set_icon_pixmap (f, icon_bitmap); - f->display.x->icon_bitmap_flag = 1; +#ifdef HAVE_X11 + if (file) + bitmap_id = x_create_bitmap_from_file (f, file); + else + { + if (!icon_bitmap) + icon_bitmap = x_create_bitmap_from_data (f, gnu_bits, + gnu_width, gnu_height); + x_reference_bitmap (icon_bitmap); + bitmap_id = icon_bitmap; + } + + x_wm_set_icon_pixmap (f, bitmap_id); + f->display.x->icon_bitmap = bitmap_id; return 0; } @@ -4301,7 +4309,8 @@ (char *) f->display.x->icon_label); #endif - f->display.x->icon_bitmap_flag = 0; + x_destroy_bitmap (f->display.x->icon_bitmap); + f->display.x->icon_bitmap = 0; x_wm_set_icon_pixmap (f, 0); return 0; @@ -5392,9 +5401,9 @@ #endif /* not USE_X_TOOLKIT */ } -x_wm_set_icon_pixmap (f, icon_pixmap) +x_wm_set_icon_pixmap (f, pixmap_id) struct frame *f; - Pixmap icon_pixmap; + int pixmap_id; { #ifdef USE_X_TOOLKIT Window window = XtWindow (f->display.x->widget); @@ -5402,13 +5411,17 @@ Window window = FRAME_X_WINDOW (f); #endif - if (icon_pixmap) + if (pixmap_id > 0) { + Pixmap icon_pixmap = x_lookup_pixmap (pixmap_id); f->display.x->wm_hints.icon_pixmap = icon_pixmap; f->display.x->wm_hints.flags |= IconPixmapHint; } else - f->display.x->wm_hints.flags &= ~IconPixmapHint; + { + f->display.x->wm_hints.icon_pixmap = None; + f->display.x->wm_hints.flags &= ~IconPixmapHint; + } XSetWMHints (x_current_display, window, &f->display.x->wm_hints); }