aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-10-15 22:01:22 +0000
committerRichard M. Stallman1994-10-15 22:01:22 +0000
commit7f2ae036225e2c8814ad1eadf1608c3eac3fddc3 (patch)
treec1b896ff8c5988afa969a3a0595a24e97cc3e878
parent919fa9cbf0b0aabb55af71e54a2050304f4347bf (diff)
downloademacs-7f2ae036225e2c8814ad1eadf1608c3eac3fddc3.tar.gz
emacs-7f2ae036225e2c8814ad1eadf1608c3eac3fddc3.zip
(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.
-rw-r--r--src/xterm.c45
1 files changed, 29 insertions, 16 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 8523880ef75..749859d1b0a 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -144,11 +144,11 @@ static int expose_all_icons;
144int BLOCK_INPUT_mask; 144int BLOCK_INPUT_mask;
145#endif /* ! defined (SIGIO) && defined (FIONREAD) */ 145#endif /* ! defined (SIGIO) && defined (FIONREAD) */
146 146
147/* The id of a bitmap used for icon windows. 147/* The id of a bitmap used for icon windows, in frames
148 One such map is shared by all Emacs icon windows. 148 for which no specific bitmap was specified.
149 This is zero if we have not yet had a need to create the bitmap. */ 149 This is 0 if we have not yet had a need to create the bitmap. */
150 150
151static Bitmap icon_bitmap; 151static int icon_bitmap;
152 152
153/* Font used for text icons. */ 153/* Font used for text icons. */
154 154
@@ -4263,18 +4263,26 @@ int
4263x_bitmap_icon (f) 4263x_bitmap_icon (f)
4264 struct frame *f; 4264 struct frame *f;
4265{ 4265{
4266 int mask; 4266 int mask, bitmap_id;
4267 Window icon_window; 4267 Window icon_window;
4268 4268
4269 if (FRAME_X_WINDOW (f) == 0) 4269 if (FRAME_X_WINDOW (f) == 0)
4270 return 1; 4270 return 1;
4271 4271
4272 if (! icon_bitmap) 4272#ifdef HAVE_X11
4273 icon_bitmap = 4273 if (file)
4274 XCreateBitmapFromData (x_current_display, FRAME_X_WINDOW (f), 4274 bitmap_id = x_create_bitmap_from_file (f, file);
4275 gnu_bits, gnu_width, gnu_height); 4275 else
4276 x_wm_set_icon_pixmap (f, icon_bitmap); 4276 {
4277 f->display.x->icon_bitmap_flag = 1; 4277 if (!icon_bitmap)
4278 icon_bitmap = x_create_bitmap_from_data (f, gnu_bits,
4279 gnu_width, gnu_height);
4280 x_reference_bitmap (icon_bitmap);
4281 bitmap_id = icon_bitmap;
4282 }
4283
4284 x_wm_set_icon_pixmap (f, bitmap_id);
4285 f->display.x->icon_bitmap = bitmap_id;
4278 4286
4279 return 0; 4287 return 0;
4280} 4288}
@@ -4301,7 +4309,8 @@ x_text_icon (f, icon_name)
4301 (char *) f->display.x->icon_label); 4309 (char *) f->display.x->icon_label);
4302#endif 4310#endif
4303 4311
4304 f->display.x->icon_bitmap_flag = 0; 4312 x_destroy_bitmap (f->display.x->icon_bitmap);
4313 f->display.x->icon_bitmap = 0;
4305 x_wm_set_icon_pixmap (f, 0); 4314 x_wm_set_icon_pixmap (f, 0);
4306 4315
4307 return 0; 4316 return 0;
@@ -5392,9 +5401,9 @@ x_wm_set_window_state (f, state)
5392#endif /* not USE_X_TOOLKIT */ 5401#endif /* not USE_X_TOOLKIT */
5393} 5402}
5394 5403
5395x_wm_set_icon_pixmap (f, icon_pixmap) 5404x_wm_set_icon_pixmap (f, pixmap_id)
5396 struct frame *f; 5405 struct frame *f;
5397 Pixmap icon_pixmap; 5406 int pixmap_id;
5398{ 5407{
5399#ifdef USE_X_TOOLKIT 5408#ifdef USE_X_TOOLKIT
5400 Window window = XtWindow (f->display.x->widget); 5409 Window window = XtWindow (f->display.x->widget);
@@ -5402,13 +5411,17 @@ x_wm_set_icon_pixmap (f, icon_pixmap)
5402 Window window = FRAME_X_WINDOW (f); 5411 Window window = FRAME_X_WINDOW (f);
5403#endif 5412#endif
5404 5413
5405 if (icon_pixmap) 5414 if (pixmap_id > 0)
5406 { 5415 {
5416 Pixmap icon_pixmap = x_lookup_pixmap (pixmap_id);
5407 f->display.x->wm_hints.icon_pixmap = icon_pixmap; 5417 f->display.x->wm_hints.icon_pixmap = icon_pixmap;
5408 f->display.x->wm_hints.flags |= IconPixmapHint; 5418 f->display.x->wm_hints.flags |= IconPixmapHint;
5409 } 5419 }
5410 else 5420 else
5411 f->display.x->wm_hints.flags &= ~IconPixmapHint; 5421 {
5422 f->display.x->wm_hints.icon_pixmap = None;
5423 f->display.x->wm_hints.flags &= ~IconPixmapHint;
5424 }
5412 5425
5413 XSetWMHints (x_current_display, window, &f->display.x->wm_hints); 5426 XSetWMHints (x_current_display, window, &f->display.x->wm_hints);
5414} 5427}