diff options
| author | Kim F. Storm | 2005-01-06 22:03:00 +0000 |
|---|---|---|
| committer | Kim F. Storm | 2005-01-06 22:03:00 +0000 |
| commit | 49ce2dbd86e867c5320964ecb8e9d0edb8ef94fa (patch) | |
| tree | b4673836be39b3737aa1877ac953ab54f62c91b7 /src | |
| parent | 454d797353104c296f2a4d805c1b924a8792c3aa (diff) | |
| download | emacs-49ce2dbd86e867c5320964ecb8e9d0edb8ef94fa.tar.gz emacs-49ce2dbd86e867c5320964ecb8e9d0edb8ef94fa.zip | |
(fringe_faces): Change to Lisp_Object pointer.
(draw_fringe_bitmap_1): Lookup user defined fringe faces here.
(destroy_fringe_bitmap): Set fringe_faces element to nil.
(Fdefine_fringe_bitmap, init_fringe): Change allocation of
fringe_faces array and init elements to nil.
(Fset_fringe_bitmap_face): Set fringe_faces to face name instead of
non-persistent face id.
(mark_fringe_data): New function for GC.
Diffstat (limited to 'src')
| -rw-r--r-- | src/fringe.c | 39 |
1 files changed, 28 insertions, 11 deletions
diff --git a/src/fringe.c b/src/fringe.c index 37b3a2cb0ac..e8b8cedee4c 100644 --- a/src/fringe.c +++ b/src/fringe.c | |||
| @@ -446,7 +446,7 @@ struct fringe_bitmap standard_bitmaps[MAX_STANDARD_FRINGE_BITMAPS] = | |||
| 446 | }; | 446 | }; |
| 447 | 447 | ||
| 448 | static struct fringe_bitmap **fringe_bitmaps; | 448 | static struct fringe_bitmap **fringe_bitmaps; |
| 449 | static unsigned *fringe_faces; | 449 | static Lisp_Object *fringe_faces; |
| 450 | static int max_fringe_bitmaps; | 450 | static int max_fringe_bitmaps; |
| 451 | 451 | ||
| 452 | static int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS; | 452 | static int max_used_fringe_bitmap = MAX_STANDARD_FRINGE_BITMAPS; |
| @@ -547,7 +547,13 @@ draw_fringe_bitmap_1 (w, row, left_p, overlay, which) | |||
| 547 | } | 547 | } |
| 548 | 548 | ||
| 549 | if (face_id == DEFAULT_FACE_ID) | 549 | if (face_id == DEFAULT_FACE_ID) |
| 550 | face_id = fringe_faces[which]; | 550 | { |
| 551 | Lisp_Object face; | ||
| 552 | |||
| 553 | if ((face = fringe_faces[which], NILP (face)) | ||
| 554 | || (face_id = lookup_named_face (f, face, 'A', 1), face_id < 0)) | ||
| 555 | face_id = FRINGE_FACE_ID; | ||
| 556 | } | ||
| 551 | 557 | ||
| 552 | fb = fringe_bitmaps[which]; | 558 | fb = fringe_bitmaps[which]; |
| 553 | if (fb == NULL) | 559 | if (fb == NULL) |
| @@ -574,7 +580,8 @@ draw_fringe_bitmap_1 (w, row, left_p, overlay, which) | |||
| 574 | 580 | ||
| 575 | if (p.face == NULL) | 581 | if (p.face == NULL) |
| 576 | { | 582 | { |
| 577 | /* Why does this happen? ++kfs */ | 583 | /* This could happen after clearing face cache. |
| 584 | But it shouldn't happen anymore. ++kfs */ | ||
| 578 | return; | 585 | return; |
| 579 | } | 586 | } |
| 580 | 587 | ||
| @@ -1073,7 +1080,7 @@ destroy_fringe_bitmap (n) | |||
| 1073 | { | 1080 | { |
| 1074 | struct fringe_bitmap **fbp; | 1081 | struct fringe_bitmap **fbp; |
| 1075 | 1082 | ||
| 1076 | fringe_faces[n] = FRINGE_FACE_ID; | 1083 | fringe_faces[n] = Qnil; |
| 1077 | 1084 | ||
| 1078 | fbp = &fringe_bitmaps[n]; | 1085 | fbp = &fringe_bitmaps[n]; |
| 1079 | if (*fbp && (*fbp)->dynamic) | 1086 | if (*fbp && (*fbp)->dynamic) |
| @@ -1294,12 +1301,12 @@ If BITMAP already exists, the existing definition is replaced. */) | |||
| 1294 | = ((struct fringe_bitmap **) | 1301 | = ((struct fringe_bitmap **) |
| 1295 | xrealloc (fringe_bitmaps, max_fringe_bitmaps * sizeof (struct fringe_bitmap *))); | 1302 | xrealloc (fringe_bitmaps, max_fringe_bitmaps * sizeof (struct fringe_bitmap *))); |
| 1296 | fringe_faces | 1303 | fringe_faces |
| 1297 | = (unsigned *) xrealloc (fringe_faces, max_fringe_bitmaps * sizeof (unsigned)); | 1304 | = (unsigned *) xrealloc (fringe_faces, max_fringe_bitmaps * sizeof (Lisp_Object)); |
| 1298 | 1305 | ||
| 1299 | for (; i < max_fringe_bitmaps; i++) | 1306 | for (; i < max_fringe_bitmaps; i++) |
| 1300 | { | 1307 | { |
| 1301 | fringe_bitmaps[i] = NULL; | 1308 | fringe_bitmaps[i] = NULL; |
| 1302 | fringe_faces[i] = FRINGE_FACE_ID; | 1309 | fringe_faces[i] = Qnil; |
| 1303 | } | 1310 | } |
| 1304 | } | 1311 | } |
| 1305 | } | 1312 | } |
| @@ -1357,10 +1364,8 @@ If FACE is nil, reset face to default fringe face. */) | |||
| 1357 | if (face_id < 0) | 1364 | if (face_id < 0) |
| 1358 | error ("No such face"); | 1365 | error ("No such face"); |
| 1359 | } | 1366 | } |
| 1360 | else | ||
| 1361 | face_id = FRINGE_FACE_ID; | ||
| 1362 | 1367 | ||
| 1363 | fringe_faces[n] = face_id; | 1368 | fringe_faces[n] = face; |
| 1364 | 1369 | ||
| 1365 | return Qnil; | 1370 | return Qnil; |
| 1366 | } | 1371 | } |
| @@ -1434,6 +1439,18 @@ You must (require 'fringe) to use fringe bitmap symbols in your programs." */); | |||
| 1434 | Vfringe_bitmaps = Qnil; | 1439 | Vfringe_bitmaps = Qnil; |
| 1435 | } | 1440 | } |
| 1436 | 1441 | ||
| 1442 | /* Garbage collection hook */ | ||
| 1443 | |||
| 1444 | void | ||
| 1445 | mark_fringe_data () | ||
| 1446 | { | ||
| 1447 | int i; | ||
| 1448 | |||
| 1449 | for (i = 0; i < max_fringe_bitmaps; i++) | ||
| 1450 | if (!NILP (fringe_faces[i])) | ||
| 1451 | mark_object (fringe_faces[i]); | ||
| 1452 | } | ||
| 1453 | |||
| 1437 | /* Initialize this module when Emacs starts. */ | 1454 | /* Initialize this module when Emacs starts. */ |
| 1438 | 1455 | ||
| 1439 | void | 1456 | void |
| @@ -1455,12 +1472,12 @@ init_fringe () | |||
| 1455 | fringe_bitmaps | 1472 | fringe_bitmaps |
| 1456 | = (struct fringe_bitmap **) xmalloc (max_fringe_bitmaps * sizeof (struct fringe_bitmap *)); | 1473 | = (struct fringe_bitmap **) xmalloc (max_fringe_bitmaps * sizeof (struct fringe_bitmap *)); |
| 1457 | fringe_faces | 1474 | fringe_faces |
| 1458 | = (unsigned *) xmalloc (max_fringe_bitmaps * sizeof (unsigned)); | 1475 | = (unsigned *) xmalloc (max_fringe_bitmaps * sizeof (Lisp_Object)); |
| 1459 | 1476 | ||
| 1460 | for (i = 0; i < max_fringe_bitmaps; i++) | 1477 | for (i = 0; i < max_fringe_bitmaps; i++) |
| 1461 | { | 1478 | { |
| 1462 | fringe_bitmaps[i] = NULL; | 1479 | fringe_bitmaps[i] = NULL; |
| 1463 | fringe_faces[i] = FRINGE_FACE_ID; | 1480 | fringe_faces[i] = Qnil; |
| 1464 | } | 1481 | } |
| 1465 | } | 1482 | } |
| 1466 | 1483 | ||