aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiles Bader2000-10-16 11:48:31 +0000
committerMiles Bader2000-10-16 11:48:31 +0000
commit9d1af64f7a75e2ab67f08422b5057edecf9b895b (patch)
tree69c6b349484e2481024543126200c4ccdaeb4fe6 /src
parent1e4d32f80e868ab417c2acf1002e378b03237d7e (diff)
downloademacs-9d1af64f7a75e2ab67f08422b5057edecf9b895b.tar.gz
emacs-9d1af64f7a75e2ab67f08422b5057edecf9b895b.zip
(xpm_lookup_color):
Make h unsigned to avoid wackiness when the high bit gets set.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog5
-rw-r--r--src/xfns.c70
2 files changed, 65 insertions, 10 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 39d7e0d7450..aa3ad9e4566 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,4 +1,7 @@
12000-10-16 Miles Bader <miles@lsi.nec.co.jp> 12000-10-16 Miles Bader <miles@gnu.org>
2
3 * xfns.c (xpm_lookup_color): Make h unsigned to avoid wackiness
4 when the high bit gets set.
2 5
3 * editfns.c (Fconstrain_to_field): Check carefully for field 6 * editfns.c (Fconstrain_to_field): Check carefully for field
4 boundaries if either OLD_POS or NEW_POS has a non-nil field 7 boundaries if either OLD_POS or NEW_POS has a non-nil field
diff --git a/src/xfns.c b/src/xfns.c
index 4c53ccb85ae..9e7f9268841 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -239,6 +239,7 @@ extern Lisp_Object Qdisplay;
239Lisp_Object Qscroll_bar_foreground, Qscroll_bar_background; 239Lisp_Object Qscroll_bar_foreground, Qscroll_bar_background;
240Lisp_Object Qscreen_gamma, Qline_spacing, Qcenter; 240Lisp_Object Qscreen_gamma, Qline_spacing, Qcenter;
241Lisp_Object Qcompound_text; 241Lisp_Object Qcompound_text;
242extern Lisp_Object Qbackground_tile;
242 243
243/* The below are defined in frame.c. */ 244/* The below are defined in frame.c. */
244 245
@@ -750,6 +751,7 @@ static void x_create_im P_ ((struct frame *));
750void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); 751void x_set_foreground_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
751static void x_set_line_spacing P_ ((struct frame *, Lisp_Object, Lisp_Object)); 752static void x_set_line_spacing P_ ((struct frame *, Lisp_Object, Lisp_Object));
752void x_set_background_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); 753void x_set_background_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
754void x_set_background_tile P_ ((struct frame *, Lisp_Object, Lisp_Object));
753void x_set_mouse_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); 755void x_set_mouse_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
754void x_set_cursor_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); 756void x_set_cursor_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
755void x_set_border_color P_ ((struct frame *, Lisp_Object, Lisp_Object)); 757void x_set_border_color P_ ((struct frame *, Lisp_Object, Lisp_Object));
@@ -796,6 +798,7 @@ static struct x_frame_parm_table x_frame_parms[] =
796 "auto-raise", x_set_autoraise, 798 "auto-raise", x_set_autoraise,
797 "auto-lower", x_set_autolower, 799 "auto-lower", x_set_autolower,
798 "background-color", x_set_background_color, 800 "background-color", x_set_background_color,
801 "background-tile", x_set_background_tile,
799 "border-color", x_set_border_color, 802 "border-color", x_set_border_color,
800 "border-width", x_set_border_width, 803 "border-width", x_set_border_width,
801 "cursor-color", x_set_cursor_color, 804 "cursor-color", x_set_cursor_color,
@@ -1425,6 +1428,42 @@ x_set_background_color (f, arg, oldval)
1425} 1428}
1426 1429
1427void 1430void
1431x_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
1461 if (FRAME_VISIBLE_P (f))
1462 redraw_frame (f);
1463 }
1464}
1465
1466void
1428x_set_mouse_color (f, arg, oldval) 1467x_set_mouse_color (f, arg, oldval)
1429 struct frame *f; 1468 struct frame *f;
1430 Lisp_Object arg, oldval; 1469 Lisp_Object arg, oldval;
@@ -5385,7 +5424,7 @@ or omitted means use the selected frame.")
5385 if (valid_image_p (spec)) 5424 if (valid_image_p (spec))
5386 { 5425 {
5387 struct frame *f = check_x_frame (frame); 5426 struct frame *f = check_x_frame (frame);
5388 int id = lookup_image (f, spec); 5427 int id = lookup_image (f, spec, 0);
5389 struct image *img = IMAGE_FROM_ID (f, id); 5428 struct image *img = IMAGE_FROM_ID (f, id);
5390 int width = img->width + 2 * img->margin; 5429 int width = img->width + 2 * img->margin;
5391 int height = img->height + 2 * img->margin; 5430 int height = img->height + 2 * img->margin;
@@ -5416,7 +5455,7 @@ or omitted means use the selected frame.")
5416 if (valid_image_p (spec)) 5455 if (valid_image_p (spec))
5417 { 5456 {
5418 struct frame *f = check_x_frame (frame); 5457 struct frame *f = check_x_frame (frame);
5419 int id = lookup_image (f, spec); 5458 int id = lookup_image (f, spec, 0);
5420 struct image *img = IMAGE_FROM_ID (f, id); 5459 struct image *img = IMAGE_FROM_ID (f, id);
5421 if (img->mask) 5460 if (img->mask)
5422 mask = Qt; 5461 mask = Qt;
@@ -5699,7 +5738,7 @@ clear_image_cache (f, force_p)
5699{ 5738{
5700 struct image_cache *c = FRAME_X_IMAGE_CACHE (f); 5739 struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
5701 5740
5702 if (c && INTEGERP (Vimage_cache_eviction_delay)) 5741 if (c && (c->refcount <= 1) && INTEGERP (Vimage_cache_eviction_delay))
5703 { 5742 {
5704 EMACS_TIME t; 5743 EMACS_TIME t;
5705 unsigned long old; 5744 unsigned long old;
@@ -5736,7 +5775,10 @@ clear_image_cache (f, force_p)
5736 struct frame *f = XFRAME (frame); 5775 struct frame *f = XFRAME (frame);
5737 if (FRAME_X_P (f) 5776 if (FRAME_X_P (f)
5738 && FRAME_X_IMAGE_CACHE (f) == c) 5777 && FRAME_X_IMAGE_CACHE (f) == c)
5739 clear_current_matrices (f); 5778 {
5779 clear_current_matrices (f);
5780 free_all_realized_faces (frame);
5781 }
5740 } 5782 }
5741 5783
5742 ++windows_or_buffers_changed; 5784 ++windows_or_buffers_changed;
@@ -5771,12 +5813,15 @@ FRAME t means clear the image caches of all frames.")
5771 5813
5772 5814
5773/* Return the id of image with Lisp specification SPEC on frame F. 5815/* Return the id of image with Lisp specification SPEC on frame F.
5774 SPEC must be a valid Lisp image specification (see valid_image_p). */ 5816 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). */
5775 5819
5776int 5820int
5777lookup_image (f, spec) 5821lookup_image (f, spec, delay_load)
5778 struct frame *f; 5822 struct frame *f;
5779 Lisp_Object spec; 5823 Lisp_Object spec;
5824 int delay_load;
5780{ 5825{
5781 struct image_cache *c = FRAME_X_IMAGE_CACHE (f); 5826 struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
5782 struct image *img; 5827 struct image *img;
@@ -5806,12 +5851,14 @@ lookup_image (f, spec)
5806 BLOCK_INPUT; 5851 BLOCK_INPUT;
5807 img = make_image (spec, hash); 5852 img = make_image (spec, hash);
5808 cache_image (f, img); 5853 cache_image (f, img);
5809 img->load_failed_p = img->type->load (f, img) == 0; 5854 if (! delay_load)
5855 img->load_failed_p = img->type->load (f, img) == 0;
5856 xassert (!interrupt_input_blocked);
5810 5857
5811 /* If we can't load the image, and we don't have a width and 5858 /* If we can't load the image, and we don't have a width and
5812 height, use some arbitrary width and height so that we can 5859 height, use some arbitrary width and height so that we can
5813 draw a rectangle for it. */ 5860 draw a rectangle for it. */
5814 if (img->load_failed_p) 5861 if (img->pixmap == 0)
5815 { 5862 {
5816 Lisp_Object value; 5863 Lisp_Object value;
5817 5864
@@ -7002,8 +7049,13 @@ xpm_lookup_color (f, color_name, color)
7002 char *color_name; 7049 char *color_name;
7003 XColor *color; 7050 XColor *color;
7004{ 7051{
7052 char *s;
7005 struct xpm_cached_color *p; 7053 struct xpm_cached_color *p;
7006 int h = xpm_color_bucket (color_name); 7054 unsigned 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;
7007 7059
7008 for (p = xpm_color_cache[h]; p; p = p->next) 7060 for (p = xpm_color_cache[h]; p; p = p->next)
7009 if (strcmp (p->name, color_name) == 0) 7061 if (strcmp (p->name, color_name) == 0)