aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1994-10-17 07:24:58 +0000
committerRichard M. Stallman1994-10-17 07:24:58 +0000
commit990ba8548cdcd175a68aeb3ade98fa909f3ee8f4 (patch)
tree7981a1d350d7fc56ddb22e8ccbc198db0f0b8814
parentcd0bb842f6b515dd9fa6c27fca3740c271767248 (diff)
downloademacs-990ba8548cdcd175a68aeb3ade98fa909f3ee8f4.tar.gz
emacs-990ba8548cdcd175a68aeb3ade98fa909f3ee8f4.zip
(dumpglyphs): Explicitly draw background stipple.
(x_bitmap_icon): Arg FILE is now a Lisp_Object. (x_iconify_frame, x_make_frame_visible): Supply FILE arg to it. (x_bitmap_icon): Properly discard the previous bitmap. (x_text_icon): Discard bitmap only if we have one.
-rw-r--r--src/xterm.c71
1 files changed, 58 insertions, 13 deletions
diff --git a/src/xterm.c b/src/xterm.c
index 749859d1b0a..a43c795126e 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -583,6 +583,7 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground)
583 struct face *face = FRAME_DEFAULT_FACE (f); 583 struct face *face = FRAME_DEFAULT_FACE (f);
584 FONT_TYPE *font = FACE_FONT (face); 584 FONT_TYPE *font = FACE_FONT (face);
585 GC gc = FACE_GC (face); 585 GC gc = FACE_GC (face);
586 int stippled = 0;
586 587
587 /* HL = 3 means use a mouse face previously chosen. */ 588 /* HL = 3 means use a mouse face previously chosen. */
588 if (hl == 3) 589 if (hl == 3)
@@ -603,6 +604,8 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground)
603 face = intern_face (f, FRAME_COMPUTED_FACES (f) [cf]); 604 face = intern_face (f, FRAME_COMPUTED_FACES (f) [cf]);
604 font = FACE_FONT (face); 605 font = FACE_FONT (face);
605 gc = FACE_GC (face); 606 gc = FACE_GC (face);
607 if (FACE_STIPPLE (face))
608 stippled = 1;
606 } 609 }
607 610
608 /* Then comes the distinction between modeline and normal text. */ 611 /* Then comes the distinction between modeline and normal text. */
@@ -613,6 +616,8 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground)
613 face = FRAME_MODE_LINE_FACE (f); 616 face = FRAME_MODE_LINE_FACE (f);
614 font = FACE_FONT (face); 617 font = FACE_FONT (face);
615 gc = FACE_GC (face); 618 gc = FACE_GC (face);
619 if (FACE_STIPPLE (face))
620 stippled = 1;
616 } 621 }
617 622
618#define FACE_DEFAULT (~0) 623#define FACE_DEFAULT (~0)
@@ -620,6 +625,9 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground)
620 /* Now override that if the cursor's on this character. */ 625 /* Now override that if the cursor's on this character. */
621 if (hl == 2) 626 if (hl == 2)
622 { 627 {
628 /* The cursor overrides stippling. */
629 stippled = 0;
630
623 if ((!face->font 631 if ((!face->font
624 || (int) face->font == FACE_DEFAULT 632 || (int) face->font == FACE_DEFAULT
625 || face->font == f->display.x->font) 633 || face->font == f->display.x->font)
@@ -657,8 +665,8 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground)
657 if (scratch_cursor_gc) 665 if (scratch_cursor_gc)
658 XChangeGC (x_current_display, scratch_cursor_gc, mask, &xgcv); 666 XChangeGC (x_current_display, scratch_cursor_gc, mask, &xgcv);
659 else 667 else
660 scratch_cursor_gc = 668 scratch_cursor_gc
661 XCreateGC (x_current_display, window, mask, &xgcv); 669 = XCreateGC (x_current_display, window, mask, &xgcv);
662 gc = scratch_cursor_gc; 670 gc = scratch_cursor_gc;
663#if 0 671#if 0
664/* If this code is restored, it must also reset to the default stipple 672/* If this code is restored, it must also reset to the default stipple
@@ -677,8 +685,28 @@ dumpglyphs (f, left, top, gp, n, hl, just_foreground)
677 left, top + FONT_BASE (font), buf, len); 685 left, top + FONT_BASE (font), buf, len);
678 else 686 else
679 { 687 {
680 XDrawImageString (x_current_display, window, gc, 688 if (stippled)
681 left, top + FONT_BASE (font), buf, len); 689 {
690 /* Turn stipple on. */
691 XSetFillStyle (FRAME_X_DISPLAY (f), gc, FillOpaqueStippled);
692
693 /* Draw stipple on background. */
694 XFillRectangle (x_current_display, window, gc,
695 left, top,
696 FONT_WIDTH (font) * len,
697 FONT_HEIGHT (font));
698
699 /* Turn stipple off. */
700 XSetFillStyle (FRAME_X_DISPLAY (f), gc, FillSolid);
701
702 /* Draw the text, solidly, onto the stipple pattern. */
703 XDrawString (x_current_display, window, gc,
704 left, top + FONT_BASE (font), buf, len);
705 }
706 else
707 XDrawImageString (x_current_display, window, gc,
708 left, top + FONT_BASE (font), buf, len);
709
682 /* Clear the rest of the line's height. */ 710 /* Clear the rest of the line's height. */
683 if (f->display.x->line_height != FONT_HEIGHT (font)) 711 if (f->display.x->line_height != FONT_HEIGHT (font))
684 XClearArea (x_current_display, window, left, 712 XClearArea (x_current_display, window, left,
@@ -4260,8 +4288,9 @@ refreshicon (f)
4260/* Make the x-window of frame F use the gnu icon bitmap. */ 4288/* Make the x-window of frame F use the gnu icon bitmap. */
4261 4289
4262int 4290int
4263x_bitmap_icon (f) 4291x_bitmap_icon (f, file)
4264 struct frame *f; 4292 struct frame *f;
4293 Lisp_Object file;
4265{ 4294{
4266 int mask, bitmap_id; 4295 int mask, bitmap_id;
4267 Window icon_window; 4296 Window icon_window;
@@ -4269,15 +4298,26 @@ x_bitmap_icon (f)
4269 if (FRAME_X_WINDOW (f) == 0) 4298 if (FRAME_X_WINDOW (f) == 0)
4270 return 1; 4299 return 1;
4271 4300
4272#ifdef HAVE_X11 4301 /* Free up our existing icon bitmap if any. */
4273 if (file) 4302 if (f->display.x->icon_bitmap > 0)
4303 x_destroy_bitmap (f, f->display.x->icon_bitmap);
4304 f->display.x->icon_bitmap = 0;
4305
4306 if (STRINGP (file))
4274 bitmap_id = x_create_bitmap_from_file (f, file); 4307 bitmap_id = x_create_bitmap_from_file (f, file);
4275 else 4308 else
4276 { 4309 {
4310 /* Create the GNU bitmap if necessary. */
4277 if (!icon_bitmap) 4311 if (!icon_bitmap)
4278 icon_bitmap = x_create_bitmap_from_data (f, gnu_bits, 4312 icon_bitmap = x_create_bitmap_from_data (f, gnu_bits,
4279 gnu_width, gnu_height); 4313 gnu_width, gnu_height);
4280 x_reference_bitmap (icon_bitmap); 4314
4315 /* The first time we create the GNU bitmap,
4316 this increments the refcount one extra time.
4317 As a result, the GNU bitmap is never freed.
4318 That way, we don't have to worry about allocating it again. */
4319 x_reference_bitmap (f, icon_bitmap);
4320
4281 bitmap_id = icon_bitmap; 4321 bitmap_id = icon_bitmap;
4282 } 4322 }
4283 4323
@@ -4309,7 +4349,8 @@ x_text_icon (f, icon_name)
4309 (char *) f->display.x->icon_label); 4349 (char *) f->display.x->icon_label);
4310#endif 4350#endif
4311 4351
4312 x_destroy_bitmap (f->display.x->icon_bitmap); 4352 if (f->display.x->icon_bitmap > 0)
4353 x_destroy_bitmap (f, f->display.x->icon_bitmap);
4313 f->display.x->icon_bitmap = 0; 4354 f->display.x->icon_bitmap = 0;
4314 x_wm_set_icon_pixmap (f, 0); 4355 x_wm_set_icon_pixmap (f, 0);
4315 4356
@@ -4959,11 +5000,13 @@ x_make_frame_visible (f)
4959 struct frame *f; 5000 struct frame *f;
4960{ 5001{
4961 int mask; 5002 int mask;
5003 Lisp_Object type;
4962 5004
4963 BLOCK_INPUT; 5005 BLOCK_INPUT;
4964 5006
4965 if (x_icon_type (f)) 5007 type = x_icon_type (f);
4966 x_bitmap_icon (f); 5008 if (!NILP (type))
5009 x_bitmap_icon (f, type);
4967 5010
4968 if (! FRAME_VISIBLE_P (f)) 5011 if (! FRAME_VISIBLE_P (f))
4969 { 5012 {
@@ -5125,6 +5168,7 @@ x_iconify_frame (f)
5125{ 5168{
5126 int mask; 5169 int mask;
5127 int result; 5170 int result;
5171 Lisp_Object type;
5128 5172
5129 /* Don't keep the highlight on an invisible frame. */ 5173 /* Don't keep the highlight on an invisible frame. */
5130 if (x_highlight_frame == f) 5174 if (x_highlight_frame == f)
@@ -5135,8 +5179,9 @@ x_iconify_frame (f)
5135 5179
5136 BLOCK_INPUT; 5180 BLOCK_INPUT;
5137 5181
5138 if (x_icon_type (f)) 5182 type = x_icon_type (f);
5139 x_bitmap_icon (f); 5183 if (!NILP (type))
5184 x_bitmap_icon (f, type);
5140 5185
5141#ifdef USE_X_TOOLKIT 5186#ifdef USE_X_TOOLKIT
5142 5187