aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiles Bader2004-09-30 01:20:39 +0000
committerMiles Bader2004-09-30 01:20:39 +0000
commited1ae069fd2c8652f6cec917ba94f5f95546cdd7 (patch)
tree59b7c3c4d32d5da944e3d135e653974240d72bbf /src
parentda39f3418de1cbfd09f62f526991d4977af657b1 (diff)
parent14e20e1309c68b214db1b6d3c369a2c2bdaeb4e2 (diff)
downloademacs-ed1ae069fd2c8652f6cec917ba94f5f95546cdd7.tar.gz
emacs-ed1ae069fd2c8652f6cec917ba94f5f95546cdd7.zip
Revision: miles@gnu.org--gnu-2004/emacs--unicode--0--patch-48
Merge from emacs--cvs-trunk--0 Patches applied: * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-581 Fix exec-shield autoconf test * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-582 - miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-584 Update from CVS * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-585 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-586 Update from CVS * miles@gnu.org--gnu-2004/gnus--rel--5.10--patch-38 Update from CVS
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog36
-rw-r--r--src/dispextern.h28
-rw-r--r--src/fringe.c151
-rw-r--r--src/w32term.c17
-rw-r--r--src/xdisp.c9
5 files changed, 147 insertions, 94 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index b71bffc5bce..266b62588ea 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,41 @@
12004-09-29 Kim F. Storm <storm@cua.dk> 12004-09-29 Kim F. Storm <storm@cua.dk>
2 2
3 * fringe.c: Remove limit on number of bitmaps.
4 (fringe_bitmaps, fringe_faces): Change to pointers.
5 (max_fringe_bitmaps): New var.
6 (Fdefine_fringe_bitmap): Expand fringe_bitmaps and fringe_faces.
7 (init_fringe): Allocate fringe_bitmaps and fringe_faces.
8
9 * dispextern.h (FRINGE_ID_BITS): Increase to 16 bits (64K bitmaps).
10 (struct glyph_row): Reorder fringe_bitmap related fields.
11 (struct it): Likewise.
12
13 * w32term.c (fringe_bmp): Change to pointer.
14 (max_fringe_bmp): New var.
15 (w32_define_fringe_bitmap): Expand fringe_bmp.
16 (w32_draw_fringe_bitmap): Check max_fringe_bmp.
17 (w32_destroy_fringe_bitmap): Likewise.
18
192004-09-29 Kim F. Storm <storm@cua.dk>
20
21 * fringe.c: Simplify last change.
22 (lookup_fringe_bitmap): New function.
23 (valid_fringe_bitmap_p, resolve_fringe_bitmap): Remove.
24 (Fdestroy_fringe_bitmap): Use lookup_fringe_bitmap.
25 Keep standard bitmaps in Vfringe_bitmaps.
26 (Fdefine_fringe_bitmap): Use lookup_fringe_bitmap.
27 (Fset_fringe_bitmap_face): Likewise.
28
29 * dispextern.h (lookup_fringe_bitmap): Add prototype.
30 (valid_fringe_bitmap_p): Remove prototype.
31
32 * xdisp.c (handle_single_display_prop): Use lookup_fringe_bitmap.
33
342004-09-29 Kim F. Storm <storm@cua.dk>
35
36 * fringe.c (destroy_fringe_bitmap, init_fringe_bitmap)
37 (w32_init_fringe, w32_reset_fringes): Fix bootstrap (NULL rif).
38
3 * dispextern.h (valid_fringe_bitmap_p): Fix prototype. 39 * dispextern.h (valid_fringe_bitmap_p): Fix prototype.
4 40
5 * fringe.c (Vfringe_bitmaps): New variable. 41 * fringe.c (Vfringe_bitmaps): New variable.
diff --git a/src/dispextern.h b/src/dispextern.h
index 47454d5ba5a..f28b39f0c64 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -104,7 +104,7 @@ enum window_part
104}; 104};
105 105
106/* Number of bits allocated to store fringe bitmap numbers. */ 106/* Number of bits allocated to store fringe bitmap numbers. */
107#define FRINGE_ID_BITS 8 107#define FRINGE_ID_BITS 16
108 108
109 109
110 110
@@ -714,24 +714,24 @@ struct glyph_row
714 /* Left fringe bitmap number (enum fringe_bitmap_type). */ 714 /* Left fringe bitmap number (enum fringe_bitmap_type). */
715 unsigned left_user_fringe_bitmap : FRINGE_ID_BITS; 715 unsigned left_user_fringe_bitmap : FRINGE_ID_BITS;
716 716
717 /* Face of the left fringe glyph. */
718 unsigned left_user_fringe_face_id : FACE_ID_BITS;
719
720 /* Right fringe bitmap number (enum fringe_bitmap_type). */ 717 /* Right fringe bitmap number (enum fringe_bitmap_type). */
721 unsigned right_user_fringe_bitmap : FRINGE_ID_BITS; 718 unsigned right_user_fringe_bitmap : FRINGE_ID_BITS;
722 719
723 /* Face of the right fringe glyph. */
724 unsigned right_user_fringe_face_id : FACE_ID_BITS;
725
726 /* Left fringe bitmap number (enum fringe_bitmap_type). */ 720 /* Left fringe bitmap number (enum fringe_bitmap_type). */
727 unsigned left_fringe_bitmap : FRINGE_ID_BITS; 721 unsigned left_fringe_bitmap : FRINGE_ID_BITS;
728 722
729 /* Face of the left fringe glyph. */
730 unsigned left_fringe_face_id : FACE_ID_BITS;
731
732 /* Right fringe bitmap number (enum fringe_bitmap_type). */ 723 /* Right fringe bitmap number (enum fringe_bitmap_type). */
733 unsigned right_fringe_bitmap : FRINGE_ID_BITS; 724 unsigned right_fringe_bitmap : FRINGE_ID_BITS;
734 725
726 /* Face of the left fringe glyph. */
727 unsigned left_user_fringe_face_id : FACE_ID_BITS;
728
729 /* Face of the right fringe glyph. */
730 unsigned right_user_fringe_face_id : FACE_ID_BITS;
731
732 /* Face of the left fringe glyph. */
733 unsigned left_fringe_face_id : FACE_ID_BITS;
734
735 /* Face of the right fringe glyph. */ 735 /* Face of the right fringe glyph. */
736 unsigned right_fringe_face_id : FACE_ID_BITS; 736 unsigned right_fringe_face_id : FACE_ID_BITS;
737 737
@@ -2041,12 +2041,12 @@ struct it
2041 /* Left fringe bitmap number (enum fringe_bitmap_type). */ 2041 /* Left fringe bitmap number (enum fringe_bitmap_type). */
2042 unsigned left_user_fringe_bitmap : FRINGE_ID_BITS; 2042 unsigned left_user_fringe_bitmap : FRINGE_ID_BITS;
2043 2043
2044 /* Face of the left fringe glyph. */
2045 unsigned left_user_fringe_face_id : FACE_ID_BITS;
2046
2047 /* Right fringe bitmap number (enum fringe_bitmap_type). */ 2044 /* Right fringe bitmap number (enum fringe_bitmap_type). */
2048 unsigned right_user_fringe_bitmap : FRINGE_ID_BITS; 2045 unsigned right_user_fringe_bitmap : FRINGE_ID_BITS;
2049 2046
2047 /* Face of the left fringe glyph. */
2048 unsigned left_user_fringe_face_id : FACE_ID_BITS;
2049
2050 /* Face of the right fringe glyph. */ 2050 /* Face of the right fringe glyph. */
2051 unsigned right_user_fringe_face_id : FACE_ID_BITS; 2051 unsigned right_user_fringe_face_id : FACE_ID_BITS;
2052}; 2052};
@@ -2634,7 +2634,7 @@ extern int x_intersect_rectangles P_ ((XRectangle *, XRectangle *,
2634 2634
2635/* Defined in fringe.c */ 2635/* Defined in fringe.c */
2636 2636
2637int valid_fringe_bitmap_p (Lisp_Object); 2637int lookup_fringe_bitmap (Lisp_Object);
2638void draw_fringe_bitmap P_ ((struct window *, struct glyph_row *, int)); 2638void draw_fringe_bitmap P_ ((struct window *, struct glyph_row *, int));
2639void draw_row_fringe_bitmaps P_ ((struct window *, struct glyph_row *)); 2639void draw_row_fringe_bitmaps P_ ((struct window *, struct glyph_row *));
2640void draw_window_fringes P_ ((struct window *)); 2640void draw_window_fringes P_ ((struct window *));
diff --git a/src/fringe.c b/src/fringe.c
index d731bf5eaa6..0bf830cbd8c 100644
--- a/src/fringe.c
+++ b/src/fringe.c
@@ -445,27 +445,34 @@ struct fringe_bitmap standard_bitmaps[MAX_STANDARD_FRINGE_BITMAPS] =
445 { FRBITS (zv_bits), 8, 3, ALIGN_BITMAP_TOP, 0 }, 445 { FRBITS (zv_bits), 8, 3, ALIGN_BITMAP_TOP, 0 },
446}; 446};
447 447
448static struct fringe_bitmap *fringe_bitmaps[MAX_FRINGE_BITMAPS]; 448static struct fringe_bitmap **fringe_bitmaps;
449static unsigned fringe_faces[MAX_FRINGE_BITMAPS]; 449static unsigned *fringe_faces;
450static int max_fringe_bitmaps;
450 451
451static int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS; 452static int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS;
452 453
453/* Return 1 if FRINGE_ID is a valid fringe bitmap id. */ 454
455/* Lookup bitmap number for symbol BITMAP.
456 Return 0 if not a bitmap. */
454 457
455int 458int
456valid_fringe_bitmap_p (bitmap) 459lookup_fringe_bitmap (bitmap)
457 Lisp_Object bitmap; 460 Lisp_Object bitmap;
458{ 461{
459 int bn; 462 int bn;
460 463
464 bitmap = Fget (bitmap, Qfringe);
461 if (!INTEGERP (bitmap)) 465 if (!INTEGERP (bitmap))
462 return 0; 466 return 0;
463 467
464 bn = XINT (bitmap); 468 bn = XINT (bitmap);
465 return (bn >= NO_FRINGE_BITMAP 469 if (bn > NO_FRINGE_BITMAP
466 && bn < max_used_fringe_bitmap 470 && bn < max_used_fringe_bitmap
467 && (bn < MAX_STANDARD_FRINGE_BITMAPS 471 && (bn < MAX_STANDARD_FRINGE_BITMAPS
468 || fringe_bitmaps[bn] != NULL)); 472 || fringe_bitmaps[bn] != NULL))
473 return bn;
474
475 return 0;
469} 476}
470 477
471/* Get fringe bitmap name for bitmap number BN. 478/* Get fringe bitmap name for bitmap number BN.
@@ -501,42 +508,6 @@ get_fringe_bitmap_name (bn)
501} 508}
502 509
503 510
504/* Resolve a BITMAP parameter.
505
506 An INTEGER, corresponding to a bitmap number.
507 A STRING which is interned to a symbol.
508 A SYMBOL which has a fringe property which is a bitmap number.
509*/
510
511static int
512resolve_fringe_bitmap (bitmap, namep)
513 Lisp_Object bitmap;
514 Lisp_Object *namep;
515{
516 if (namep)
517 *namep = Qnil;
518
519 if (STRINGP (bitmap))
520 bitmap = intern (SDATA (bitmap));
521
522 if (SYMBOLP (bitmap))
523 {
524 if (namep)
525 *namep = bitmap;
526 bitmap = Fget (bitmap, Qfringe);
527 }
528
529 if (valid_fringe_bitmap_p (bitmap))
530 {
531 if (namep && NILP (*namep))
532 *namep = get_fringe_bitmap_name (XINT (bitmap));
533 return XINT (bitmap);
534 }
535
536 return -1;
537}
538
539
540/* Draw the bitmap WHICH in one of the left or right fringes of 511/* Draw the bitmap WHICH in one of the left or right fringes of
541 window W. ROW is the glyph row for which to display the bitmap; it 512 window W. ROW is the glyph row for which to display the bitmap; it
542 determines the vertical position at which the bitmap has to be 513 determines the vertical position at which the bitmap has to be
@@ -1068,7 +1039,9 @@ compute_fringe_widths (f, redraw)
1068} 1039}
1069 1040
1070 1041
1071void 1042/* Free resources used by a user-defined bitmap. */
1043
1044int
1072destroy_fringe_bitmap (n) 1045destroy_fringe_bitmap (n)
1073 int n; 1046 int n;
1074{ 1047{
@@ -1079,7 +1052,7 @@ destroy_fringe_bitmap (n)
1079 fbp = &fringe_bitmaps[n]; 1052 fbp = &fringe_bitmaps[n];
1080 if (*fbp && (*fbp)->dynamic) 1053 if (*fbp && (*fbp)->dynamic)
1081 { 1054 {
1082 if (rif->destroy_fringe_bitmap) 1055 if (rif && rif->destroy_fringe_bitmap)
1083 rif->destroy_fringe_bitmap (n); 1056 rif->destroy_fringe_bitmap (n);
1084 xfree (*fbp); 1057 xfree (*fbp);
1085 *fbp = NULL; 1058 *fbp = NULL;
@@ -1099,20 +1072,21 @@ If BITMAP overrides a standard fringe bitmap, the original bitmap is restored.
1099 Lisp_Object bitmap; 1072 Lisp_Object bitmap;
1100{ 1073{
1101 int n; 1074 int n;
1102 Lisp_Object sym;
1103 1075
1104 n = resolve_fringe_bitmap (bitmap, &sym); 1076 CHECK_SYMBOL (bitmap);
1105 if (n < 0) 1077 n = lookup_fringe_bitmap (bitmap);
1078 if (!n)
1106 return Qnil; 1079 return Qnil;
1107 1080
1108 destroy_fringe_bitmap (n); 1081 destroy_fringe_bitmap (n);
1109 1082
1110 if (SYMBOLP (sym)) 1083 if (n >= MAX_STANDARD_FRINGE_BITMAPS)
1111 { 1084 {
1112 Vfringe_bitmaps = Fdelq (sym, Vfringe_bitmaps); 1085 Vfringe_bitmaps = Fdelq (bitmap, Vfringe_bitmaps);
1113 /* It would be better to remove the fringe property. */ 1086 /* It would be better to remove the fringe property. */
1114 Fput (sym, Qfringe, Qnil); 1087 Fput (bitmap, Qfringe, Qnil);
1115 } 1088 }
1089
1116 return Qnil; 1090 return Qnil;
1117} 1091}
1118 1092
@@ -1185,7 +1159,7 @@ init_fringe_bitmap (which, fb, once_p)
1185 { 1159 {
1186 destroy_fringe_bitmap (which); 1160 destroy_fringe_bitmap (which);
1187 1161
1188 if (rif->define_fringe_bitmap) 1162 if (rif && rif->define_fringe_bitmap)
1189 rif->define_fringe_bitmap (which, fb->bits, fb->height, fb->width); 1163 rif->define_fringe_bitmap (which, fb->bits, fb->height, fb->width);
1190 1164
1191 fringe_bitmaps[which] = fb; 1165 fringe_bitmaps[which] = fb;
@@ -1216,12 +1190,8 @@ If BITMAP already exists, the existing definition is replaced. */)
1216 unsigned short *b; 1190 unsigned short *b;
1217 struct fringe_bitmap fb, *xfb; 1191 struct fringe_bitmap fb, *xfb;
1218 int fill1 = 0, fill2 = 0; 1192 int fill1 = 0, fill2 = 0;
1219 Lisp_Object sym;
1220
1221 n = resolve_fringe_bitmap (bitmap, &sym);
1222 1193
1223 if (NILP (sym) || INTEGERP (sym)) 1194 CHECK_SYMBOL (bitmap);
1224 sym = wrong_type_argument (Qsymbolp, bitmap);
1225 1195
1226 if (!STRINGP (bits) && !VECTORP (bits)) 1196 if (!STRINGP (bits) && !VECTORP (bits))
1227 bits = wrong_type_argument (Qstringp, bits); 1197 bits = wrong_type_argument (Qstringp, bits);
@@ -1274,23 +1244,42 @@ If BITMAP already exists, the existing definition is replaced. */)
1274 else if (!NILP (align) && !EQ (align, Qcenter)) 1244 else if (!NILP (align) && !EQ (align, Qcenter))
1275 error ("Bad align argument"); 1245 error ("Bad align argument");
1276 1246
1277 if (n < 0) 1247 n = lookup_fringe_bitmap (bitmap);
1248 if (!n)
1278 { 1249 {
1279 if (max_used_fringe_bitmap < MAX_FRINGE_BITMAPS) 1250 if (max_used_fringe_bitmap < max_fringe_bitmaps)
1280 n = max_used_fringe_bitmap++; 1251 n = max_used_fringe_bitmap++;
1281 else 1252 else
1282 { 1253 {
1283 for (n = MAX_STANDARD_FRINGE_BITMAPS; 1254 for (n = MAX_STANDARD_FRINGE_BITMAPS;
1284 n < MAX_FRINGE_BITMAPS; 1255 n < max_fringe_bitmaps;
1285 n++) 1256 n++)
1286 if (fringe_bitmaps[n] == NULL) 1257 if (fringe_bitmaps[n] == NULL)
1287 break; 1258 break;
1288 if (n == MAX_FRINGE_BITMAPS) 1259
1289 error ("Cannot define more fringe bitmaps"); 1260 if (n == max_fringe_bitmaps)
1261 {
1262 if ((max_fringe_bitmaps + 20) > MAX_FRINGE_BITMAPS)
1263 error ("No free fringe bitmap slots");
1264
1265 i = max_fringe_bitmaps;
1266 max_fringe_bitmaps += 20;
1267 fringe_bitmaps
1268 = ((struct fringe_bitmap **)
1269 xrealloc (fringe_bitmaps, max_fringe_bitmaps * sizeof (struct fringe_bitmap *)));
1270 fringe_faces
1271 = (unsigned *) xrealloc (fringe_faces, max_fringe_bitmaps * sizeof (unsigned));
1272
1273 for (; i < max_fringe_bitmaps; i++)
1274 {
1275 fringe_bitmaps[i] = NULL;
1276 fringe_faces[i] = FRINGE_FACE_ID;
1277 }
1278 }
1290 } 1279 }
1291 1280
1292 Vfringe_bitmaps = Fcons (sym, Vfringe_bitmaps); 1281 Vfringe_bitmaps = Fcons (bitmap, Vfringe_bitmaps);
1293 Fput (sym, Qfringe, make_number (n)); 1282 Fput (bitmap, Qfringe, make_number (n));
1294 } 1283 }
1295 1284
1296 fb.dynamic = 1; 1285 fb.dynamic = 1;
@@ -1318,7 +1307,7 @@ If BITMAP already exists, the existing definition is replaced. */)
1318 1307
1319 init_fringe_bitmap (n, xfb, 0); 1308 init_fringe_bitmap (n, xfb, 0);
1320 1309
1321 return sym; 1310 return bitmap;
1322} 1311}
1323 1312
1324DEFUN ("set-fringe-bitmap-face", Fset_fringe_bitmap_face, Sset_fringe_bitmap_face, 1313DEFUN ("set-fringe-bitmap-face", Fset_fringe_bitmap_face, Sset_fringe_bitmap_face,
@@ -1328,11 +1317,12 @@ If FACE is nil, reset face to default fringe face. */)
1328 (bitmap, face) 1317 (bitmap, face)
1329 Lisp_Object bitmap, face; 1318 Lisp_Object bitmap, face;
1330{ 1319{
1331 int bn; 1320 int n;
1332 int face_id; 1321 int face_id;
1333 1322
1334 bn = resolve_fringe_bitmap (bitmap, 0); 1323 CHECK_SYMBOL (bitmap);
1335 if (bn < 0) 1324 n = lookup_fringe_bitmap (bitmap);
1325 if (!n)
1336 error ("Undefined fringe bitmap"); 1326 error ("Undefined fringe bitmap");
1337 1327
1338 if (!NILP (face)) 1328 if (!NILP (face))
@@ -1344,7 +1334,7 @@ If FACE is nil, reset face to default fringe face. */)
1344 else 1334 else
1345 face_id = FRINGE_FACE_ID; 1335 face_id = FRINGE_FACE_ID;
1346 1336
1347 fringe_faces [bn] = face_id; 1337 fringe_faces[n] = face_id;
1348 1338
1349 return Qnil; 1339 return Qnil;
1350} 1340}
@@ -1433,9 +1423,18 @@ init_fringe ()
1433{ 1423{
1434 int i; 1424 int i;
1435 1425
1436 bzero (fringe_bitmaps, sizeof fringe_bitmaps); 1426 max_fringe_bitmaps = MAX_STANDARD_FRINGE_BITMAPS + 20;
1437 for (i = 0; i < MAX_FRINGE_BITMAPS; i++) 1427
1438 fringe_faces[i] = FRINGE_FACE_ID; 1428 fringe_bitmaps
1429 = (struct fringe_bitmap **) xmalloc (max_fringe_bitmaps * sizeof (struct fringe_bitmap *));
1430 fringe_faces
1431 = (unsigned *) xmalloc (max_fringe_bitmaps * sizeof (unsigned));
1432
1433 for (i = 0; i < max_fringe_bitmaps; i++)
1434 {
1435 fringe_bitmaps[i] = NULL;
1436 fringe_faces[i] = FRINGE_FACE_ID;
1437 }
1439} 1438}
1440 1439
1441#ifdef HAVE_NTGUI 1440#ifdef HAVE_NTGUI
@@ -1445,6 +1444,9 @@ w32_init_fringe ()
1445{ 1444{
1446 enum fringe_bitmap_type bt; 1445 enum fringe_bitmap_type bt;
1447 1446
1447 if (!rif)
1448 return;
1449
1448 for (bt = NO_FRINGE_BITMAP + 1; bt < MAX_STANDARD_FRINGE_BITMAPS; bt++) 1450 for (bt = NO_FRINGE_BITMAP + 1; bt < MAX_STANDARD_FRINGE_BITMAPS; bt++)
1449 { 1451 {
1450 struct fringe_bitmap *fb = &standard_bitmaps[bt]; 1452 struct fringe_bitmap *fb = &standard_bitmaps[bt];
@@ -1458,6 +1460,9 @@ w32_reset_fringes ()
1458 /* Destroy row bitmaps. */ 1460 /* Destroy row bitmaps. */
1459 int bt; 1461 int bt;
1460 1462
1463 if (!rif)
1464 return;
1465
1461 for (bt = NO_FRINGE_BITMAP + 1; bt < max_used_fringe_bitmap; bt++) 1466 for (bt = NO_FRINGE_BITMAP + 1; bt < max_used_fringe_bitmap; bt++)
1462 rif->destroy_fringe_bitmap (bt); 1467 rif->destroy_fringe_bitmap (bt);
1463} 1468}
diff --git a/src/w32term.c b/src/w32term.c
index 50a777f2002..1d6b4ec7535 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -64,7 +64,8 @@ Boston, MA 02111-1307, USA. */
64 64
65/* Fringe bitmaps. */ 65/* Fringe bitmaps. */
66 66
67static HBITMAP fringe_bmp[MAX_FRINGE_BITMAPS]; 67static int max_fringe_bmp = 0;
68static HBITMAP *fringe_bmp = 0;
68 69
69/* Non-nil means Emacs uses toolkit scroll bars. */ 70/* Non-nil means Emacs uses toolkit scroll bars. */
70 71
@@ -731,7 +732,7 @@ w32_draw_fringe_bitmap (w, row, p)
731 p->bx, p->by, p->nx, p->ny); 732 p->bx, p->by, p->nx, p->ny);
732 } 733 }
733 734
734 if (p->which) 735 if (p->which && p->which < max_fringe_bmp)
735 { 736 {
736 HBITMAP pixmap = fringe_bmp[p->which]; 737 HBITMAP pixmap = fringe_bmp[p->which];
737 HDC compat_hdc; 738 HDC compat_hdc;
@@ -794,6 +795,15 @@ w32_define_fringe_bitmap (which, bits, h, wd)
794 unsigned short *bits; 795 unsigned short *bits;
795 int h, wd; 796 int h, wd;
796{ 797{
798 if (which >= max_fringe_bmp)
799 {
800 int i = max_fringe_bmp;
801 max_fringe_bmp = which + 20;
802 fringe_bmp = (HBITMAP *) xrealloc (fringe_bmp, max_fringe_bmp * sizeof (HBITMAP));
803 while (i < max_fringe_bmp)
804 fringe_bmp[i++] = 0;
805 }
806
797 fringe_bmp[which] = CreateBitmap (wd, h, 1, 1, bits); 807 fringe_bmp[which] = CreateBitmap (wd, h, 1, 1, bits);
798} 808}
799 809
@@ -801,6 +811,9 @@ static void
801w32_destroy_fringe_bitmap (which) 811w32_destroy_fringe_bitmap (which)
802 int which; 812 int which;
803{ 813{
814 if (which >= max_fringe_bmp)
815 return;
816
804 if (fringe_bmp[which]) 817 if (fringe_bmp[which])
805 DeleteObject (fringe_bmp[which]); 818 DeleteObject (fringe_bmp[which]);
806 fringe_bmp[which] = 0; 819 fringe_bmp[which] = 0;
diff --git a/src/xdisp.c b/src/xdisp.c
index 353a72f65b6..11eab6532bb 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -308,7 +308,6 @@ extern Lisp_Object Qheight;
308extern Lisp_Object QCwidth, QCheight, QCascent; 308extern Lisp_Object QCwidth, QCheight, QCascent;
309extern Lisp_Object Qscroll_bar; 309extern Lisp_Object Qscroll_bar;
310extern Lisp_Object Qcursor; 310extern Lisp_Object Qcursor;
311extern Lisp_Object Qfringe;
312 311
313/* Non-nil means highlight trailing whitespace. */ 312/* Non-nil means highlight trailing whitespace. */
314 313
@@ -3572,6 +3571,7 @@ handle_single_display_prop (it, prop, object, position,
3572 && CONSP (XCDR (prop))) 3571 && CONSP (XCDR (prop)))
3573 { 3572 {
3574 unsigned face_id = DEFAULT_FACE_ID; 3573 unsigned face_id = DEFAULT_FACE_ID;
3574 int fringe_bitmap;
3575 3575
3576 /* Save current settings of IT so that we can restore them 3576 /* Save current settings of IT so that we can restore them
3577 when we are finished with the glyph property value. */ 3577 when we are finished with the glyph property value. */
@@ -3583,8 +3583,7 @@ handle_single_display_prop (it, prop, object, position,
3583#ifdef HAVE_WINDOW_SYSTEM 3583#ifdef HAVE_WINDOW_SYSTEM
3584 value = XCAR (XCDR (prop)); 3584 value = XCAR (XCDR (prop));
3585 if (!SYMBOLP (value) 3585 if (!SYMBOLP (value)
3586 || (value = Fget (value, Qfringe), 3586 || !(fringe_bitmap = lookup_fringe_bitmap (value)))
3587 !valid_fringe_bitmap_p (value)))
3588 return 0; 3587 return 0;
3589 3588
3590 if (CONSP (XCDR (XCDR (prop)))) 3589 if (CONSP (XCDR (XCDR (prop))))
@@ -3613,12 +3612,12 @@ handle_single_display_prop (it, prop, object, position,
3613 3612
3614 if (EQ (XCAR (prop), Qleft_fringe)) 3613 if (EQ (XCAR (prop), Qleft_fringe))
3615 { 3614 {
3616 it->left_user_fringe_bitmap = XINT (value); 3615 it->left_user_fringe_bitmap = fringe_bitmap;
3617 it->left_user_fringe_face_id = face_id; 3616 it->left_user_fringe_face_id = face_id;
3618 } 3617 }
3619 else 3618 else
3620 { 3619 {
3621 it->right_user_fringe_bitmap = XINT (value); 3620 it->right_user_fringe_bitmap = fringe_bitmap;
3622 it->right_user_fringe_face_id = face_id; 3621 it->right_user_fringe_face_id = face_id;
3623 } 3622 }
3624#endif /* HAVE_WINDOW_SYSTEM */ 3623#endif /* HAVE_WINDOW_SYSTEM */