Mercurial > emacs
comparison src/xfns.c @ 32536:c198e3edcae6
Revert last change.
author | Miles Bader <miles@gnu.org> |
---|---|
date | Mon, 16 Oct 2000 14:45:44 +0000 |
parents | d913c96d248f |
children | 73521ea30674 |
comparison
equal
deleted
inserted
replaced
32535:3c3fa768e7d1 | 32536:c198e3edcae6 |
---|---|
237 Lisp_Object Quser_size; | 237 Lisp_Object Quser_size; |
238 extern Lisp_Object Qdisplay; | 238 extern Lisp_Object Qdisplay; |
239 Lisp_Object Qscroll_bar_foreground, Qscroll_bar_background; | 239 Lisp_Object Qscroll_bar_foreground, Qscroll_bar_background; |
240 Lisp_Object Qscreen_gamma, Qline_spacing, Qcenter; | 240 Lisp_Object Qscreen_gamma, Qline_spacing, Qcenter; |
241 Lisp_Object Qcompound_text; | 241 Lisp_Object Qcompound_text; |
242 extern Lisp_Object Qbackground_tile; | |
243 | 242 |
244 /* The below are defined in frame.c. */ | 243 /* The below are defined in frame.c. */ |
245 | 244 |
246 extern Lisp_Object Qheight, Qminibuffer, Qname, Qonly, Qwidth; | 245 extern Lisp_Object Qheight, Qminibuffer, Qname, Qonly, Qwidth; |
247 extern Lisp_Object Qunsplittable, Qmenu_bar_lines, Qbuffer_predicate, Qtitle; | 246 extern Lisp_Object Qunsplittable, Qmenu_bar_lines, Qbuffer_predicate, Qtitle; |
749 static void x_disable_image P_ ((struct frame *, struct image *)); | 748 static void x_disable_image P_ ((struct frame *, struct image *)); |
750 static void x_create_im P_ ((struct frame *)); | 749 static void x_create_im P_ ((struct frame *)); |
751 void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); | 750 void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
752 static void x_set_line_spacing P_ ((struct frame *, Lisp_Object, Lisp_Object)); | 751 static void x_set_line_spacing P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
753 void x_set_background_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); | 752 void x_set_background_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
754 void x_set_background_tile P_ ((struct frame *, Lisp_Object, Lisp_Object)); | |
755 void x_set_mouse_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); | 753 void x_set_mouse_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
756 void x_set_cursor_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); | 754 void x_set_cursor_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
757 void x_set_border_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); | 755 void x_set_border_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
758 void x_set_cursor_type P_ ((struct frame *, Lisp_Object, Lisp_Object)); | 756 void x_set_cursor_type P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
759 void x_set_icon_type P_ ((struct frame *, Lisp_Object, Lisp_Object)); | 757 void x_set_icon_type P_ ((struct frame *, Lisp_Object, Lisp_Object)); |
796 static struct x_frame_parm_table x_frame_parms[] = | 794 static struct x_frame_parm_table x_frame_parms[] = |
797 { | 795 { |
798 "auto-raise", x_set_autoraise, | 796 "auto-raise", x_set_autoraise, |
799 "auto-lower", x_set_autolower, | 797 "auto-lower", x_set_autolower, |
800 "background-color", x_set_background_color, | 798 "background-color", x_set_background_color, |
801 "background-tile", x_set_background_tile, | |
802 "border-color", x_set_border_color, | 799 "border-color", x_set_border_color, |
803 "border-width", x_set_border_width, | 800 "border-width", x_set_border_width, |
804 "cursor-color", x_set_cursor_color, | 801 "cursor-color", x_set_cursor_color, |
805 "cursor-type", x_set_cursor_type, | 802 "cursor-type", x_set_cursor_type, |
806 "font", x_set_font, | 803 "font", x_set_font, |
1419 f->output_data.x->background_pixel); | 1416 f->output_data.x->background_pixel); |
1420 } | 1417 } |
1421 UNBLOCK_INPUT; | 1418 UNBLOCK_INPUT; |
1422 | 1419 |
1423 update_face_from_frame_parameter (f, Qbackground_color, arg); | 1420 update_face_from_frame_parameter (f, Qbackground_color, arg); |
1424 | |
1425 if (FRAME_VISIBLE_P (f)) | |
1426 redraw_frame (f); | |
1427 } | |
1428 } | |
1429 | |
1430 void | |
1431 x_set_background_tile (f, arg, oldval) | |
1432 struct frame *f; | |
1433 Lisp_Object arg, oldval; | |
1434 { | |
1435 int tile_id = lookup_image (f, arg, 0); | |
1436 struct image *tile_image = IMAGE_FROM_ID (f, tile_id); | |
1437 Pixmap tile_pixmap = tile_image ? tile_image->pixmap : 0; | |
1438 | |
1439 f->output_data.x->background_tile = tile_pixmap; | |
1440 | |
1441 if (FRAME_X_WINDOW (f) != 0 && tile_pixmap) | |
1442 { | |
1443 BLOCK_INPUT; | |
1444 /* The main frame area. */ | |
1445 XSetTile (FRAME_X_DISPLAY (f), f->output_data.x->normal_gc, | |
1446 f->output_data.x->background_tile); | |
1447 XSetWindowBackgroundPixmap (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), | |
1448 f->output_data.x->background_tile); | |
1449 { | |
1450 Lisp_Object bar; | |
1451 for (bar = FRAME_SCROLL_BARS (f); !NILP (bar); | |
1452 bar = XSCROLL_BAR (bar)->next) | |
1453 XSetWindowBackgroundPixmap (FRAME_X_DISPLAY (f), | |
1454 SCROLL_BAR_X_WINDOW (XSCROLL_BAR (bar)), | |
1455 f->output_data.x->background_tile); | |
1456 } | |
1457 UNBLOCK_INPUT; | |
1458 | |
1459 update_face_from_frame_parameter (f, Qbackground_tile, arg); | |
1460 | 1421 |
1461 if (FRAME_VISIBLE_P (f)) | 1422 if (FRAME_VISIBLE_P (f)) |
1462 redraw_frame (f); | 1423 redraw_frame (f); |
1463 } | 1424 } |
1464 } | 1425 } |
5422 | 5383 |
5423 size = Qnil; | 5384 size = Qnil; |
5424 if (valid_image_p (spec)) | 5385 if (valid_image_p (spec)) |
5425 { | 5386 { |
5426 struct frame *f = check_x_frame (frame); | 5387 struct frame *f = check_x_frame (frame); |
5427 int id = lookup_image (f, spec, 0); | 5388 int id = lookup_image (f, spec); |
5428 struct image *img = IMAGE_FROM_ID (f, id); | 5389 struct image *img = IMAGE_FROM_ID (f, id); |
5429 int width = img->width + 2 * img->margin; | 5390 int width = img->width + 2 * img->margin; |
5430 int height = img->height + 2 * img->margin; | 5391 int height = img->height + 2 * img->margin; |
5431 | 5392 |
5432 if (NILP (pixels)) | 5393 if (NILP (pixels)) |
5453 | 5414 |
5454 mask = Qnil; | 5415 mask = Qnil; |
5455 if (valid_image_p (spec)) | 5416 if (valid_image_p (spec)) |
5456 { | 5417 { |
5457 struct frame *f = check_x_frame (frame); | 5418 struct frame *f = check_x_frame (frame); |
5458 int id = lookup_image (f, spec, 0); | 5419 int id = lookup_image (f, spec); |
5459 struct image *img = IMAGE_FROM_ID (f, id); | 5420 struct image *img = IMAGE_FROM_ID (f, id); |
5460 if (img->mask) | 5421 if (img->mask) |
5461 mask = Qt; | 5422 mask = Qt; |
5462 } | 5423 } |
5463 else | 5424 else |
5736 struct frame *f; | 5697 struct frame *f; |
5737 int force_p; | 5698 int force_p; |
5738 { | 5699 { |
5739 struct image_cache *c = FRAME_X_IMAGE_CACHE (f); | 5700 struct image_cache *c = FRAME_X_IMAGE_CACHE (f); |
5740 | 5701 |
5741 if (c && (c->refcount <= 1) && INTEGERP (Vimage_cache_eviction_delay)) | 5702 if (c && INTEGERP (Vimage_cache_eviction_delay)) |
5742 { | 5703 { |
5743 EMACS_TIME t; | 5704 EMACS_TIME t; |
5744 unsigned long old; | 5705 unsigned long old; |
5745 int i, nfreed; | 5706 int i, nfreed; |
5746 | 5707 |
5773 FOR_EACH_FRAME (tail, frame) | 5734 FOR_EACH_FRAME (tail, frame) |
5774 { | 5735 { |
5775 struct frame *f = XFRAME (frame); | 5736 struct frame *f = XFRAME (frame); |
5776 if (FRAME_X_P (f) | 5737 if (FRAME_X_P (f) |
5777 && FRAME_X_IMAGE_CACHE (f) == c) | 5738 && FRAME_X_IMAGE_CACHE (f) == c) |
5778 { | 5739 clear_current_matrices (f); |
5779 clear_current_matrices (f); | |
5780 free_all_realized_faces (frame); | |
5781 } | |
5782 } | 5740 } |
5783 | 5741 |
5784 ++windows_or_buffers_changed; | 5742 ++windows_or_buffers_changed; |
5785 } | 5743 } |
5786 | 5744 |
5811 return Qnil; | 5769 return Qnil; |
5812 } | 5770 } |
5813 | 5771 |
5814 | 5772 |
5815 /* Return the id of image with Lisp specification SPEC on frame F. | 5773 /* Return the id of image with Lisp specification SPEC on frame F. |
5816 SPEC must be a valid Lisp image specification (see valid_image_p). | 5774 SPEC must be a valid Lisp image specification (see valid_image_p). */ |
5817 If DELAY_LOAD is true, then the image isn't actually loaded yet (it | |
5818 will be loaded when prepare_image_for_display is called). */ | |
5819 | 5775 |
5820 int | 5776 int |
5821 lookup_image (f, spec, delay_load) | 5777 lookup_image (f, spec) |
5822 struct frame *f; | 5778 struct frame *f; |
5823 Lisp_Object spec; | 5779 Lisp_Object spec; |
5824 int delay_load; | |
5825 { | 5780 { |
5826 struct image_cache *c = FRAME_X_IMAGE_CACHE (f); | 5781 struct image_cache *c = FRAME_X_IMAGE_CACHE (f); |
5827 struct image *img; | 5782 struct image *img; |
5828 int i; | 5783 int i; |
5829 unsigned hash; | 5784 unsigned hash; |
5849 if (img == NULL) | 5804 if (img == NULL) |
5850 { | 5805 { |
5851 BLOCK_INPUT; | 5806 BLOCK_INPUT; |
5852 img = make_image (spec, hash); | 5807 img = make_image (spec, hash); |
5853 cache_image (f, img); | 5808 cache_image (f, img); |
5854 if (! delay_load) | 5809 img->load_failed_p = img->type->load (f, img) == 0; |
5855 img->load_failed_p = img->type->load (f, img) == 0; | |
5856 xassert (!interrupt_input_blocked); | |
5857 | 5810 |
5858 /* If we can't load the image, and we don't have a width and | 5811 /* If we can't load the image, and we don't have a width and |
5859 height, use some arbitrary width and height so that we can | 5812 height, use some arbitrary width and height so that we can |
5860 draw a rectangle for it. */ | 5813 draw a rectangle for it. */ |
5861 if (img->pixmap == 0) | 5814 if (img->load_failed_p) |
5862 { | 5815 { |
5863 Lisp_Object value; | 5816 Lisp_Object value; |
5864 | 5817 |
5865 value = image_spec_value (spec, QCwidth, NULL); | 5818 value = image_spec_value (spec, QCwidth, NULL); |
5866 img->width = (INTEGERP (value) | 5819 img->width = (INTEGERP (value) |
7047 xpm_lookup_color (f, color_name, color) | 7000 xpm_lookup_color (f, color_name, color) |
7048 struct frame *f; | 7001 struct frame *f; |
7049 char *color_name; | 7002 char *color_name; |
7050 XColor *color; | 7003 XColor *color; |
7051 { | 7004 { |
7052 char *s; | |
7053 struct xpm_cached_color *p; | 7005 struct xpm_cached_color *p; |
7054 unsigned h = xpm_color_bucket (color_name); | 7006 int h = xpm_color_bucket (color_name); |
7055 | |
7056 for (s = color_name; *s; ++s) | |
7057 h = (h << 2) ^ *s; | |
7058 h %= XPM_COLOR_CACHE_BUCKETS; | |
7059 | 7007 |
7060 for (p = xpm_color_cache[h]; p; p = p->next) | 7008 for (p = xpm_color_cache[h]; p; p = p->next) |
7061 if (strcmp (p->name, color_name) == 0) | 7009 if (strcmp (p->name, color_name) == 0) |
7062 break; | 7010 break; |
7063 | 7011 |