Mercurial > hg > xemacs-beta
comparison src/gutter.c @ 4186:05dd0ed58262
[xemacs-hg @ 2007-09-26 09:36:49 by didierv]
Don't assume DEFAULT_INDEX will always be 0
author | didierv |
---|---|
date | Wed, 26 Sep 2007 09:36:51 +0000 |
parents | facf3239ba30 |
children | 91b3d00e717f |
comparison
equal
deleted
inserted
replaced
4185:b8b517535c23 | 4186:05dd0ed58262 |
---|---|
270 nargs = 0; | 270 nargs = 0; |
271 | 271 |
272 for (rest = gutter; !NILP (rest); rest = XCDR (XCDR (rest))) | 272 for (rest = gutter; !NILP (rest); rest = XCDR (XCDR (rest))) |
273 { | 273 { |
274 /* We only put things in the real gutter that are declared to be | 274 /* We only put things in the real gutter that are declared to be |
275 visible. */ | 275 visible. */ |
276 if (!CONSP (WINDOW_GUTTER_VISIBLE (w, pos)) | 276 if (!CONSP (WINDOW_GUTTER_VISIBLE (w, pos)) |
277 || | 277 || |
278 !NILP (Fmemq (XCAR (rest), WINDOW_GUTTER_VISIBLE (w, pos)))) | 278 !NILP (Fmemq (XCAR (rest), WINDOW_GUTTER_VISIBLE (w, pos)))) |
279 { | 279 { |
280 args [nargs++] = XCAR (XCDR (rest)); | 280 args [nargs++] = XCAR (XCDR (rest)); |
299 { | 299 { |
300 /* grab coordinates of last line */ | 300 /* grab coordinates of last line */ |
301 if (Dynarr_length (ddla)) | 301 if (Dynarr_length (ddla)) |
302 { | 302 { |
303 dl = Dynarr_atp (ddla, Dynarr_length (ddla) - 1); | 303 dl = Dynarr_atp (ddla, Dynarr_length (ddla) - 1); |
304 size = (dl->ypos + dl->descent - dl->clip) | 304 size = (dl->ypos + dl->descent - dl->clip) |
305 - (Dynarr_atp (ddla, 0)->ypos - Dynarr_atp (ddla, 0)->ascent); | 305 - (Dynarr_atp (ddla, 0)->ypos - Dynarr_atp (ddla, 0)->ascent); |
306 } | 306 } |
307 } | 307 } |
308 /* For left and right we have to do some maths. */ | 308 /* For left and right we have to do some maths. */ |
309 else | 309 else |
363 FRAME_TOP_BORDER_END (f), | 363 FRAME_TOP_BORDER_END (f), |
364 FRAME_RIGHT_BORDER_START (f) | 364 FRAME_RIGHT_BORDER_START (f) |
365 - FRAME_LEFT_BORDER_END (f), | 365 - FRAME_LEFT_BORDER_END (f), |
366 FRAME_BOTTOM_BORDER_START (f) | 366 FRAME_BOTTOM_BORDER_START (f) |
367 - FRAME_TOP_BORDER_END (f), | 367 - FRAME_TOP_BORDER_END (f), |
368 ddla, 0, 0); | 368 ddla, 0, DEFAULT_INDEX); |
369 | 369 |
370 /* Let GC happen again. */ | 370 /* Let GC happen again. */ |
371 exit_redisplay_critical_section (count); | 371 exit_redisplay_critical_section (count); |
372 | 372 |
373 ret = make_int (calculate_gutter_size_from_display_lines (pos, ddla)); | 373 ret = make_int (calculate_gutter_size_from_display_lines (pos, ddla)); |
422 w->windows_changed || f->windows_structure_changed || | 422 w->windows_changed || f->windows_structure_changed || |
423 cdla_len != Dynarr_length (ddla) || | 423 cdla_len != Dynarr_length (ddla) || |
424 (f->extents_changed && w->gutter_extent_modiff[pos])) | 424 (f->extents_changed && w->gutter_extent_modiff[pos])) |
425 { | 425 { |
426 #ifdef DEBUG_GUTTERS | 426 #ifdef DEBUG_GUTTERS |
427 stderr_out ("gutter redisplay [%s %dx%d@%d+%d] triggered by %s,\n", | 427 stderr_out ("gutter redisplay [%s %dx%d@%d+%d] triggered by %s,\n", |
428 pos == TOP_GUTTER ? "TOP" : | 428 pos == TOP_GUTTER ? "TOP" : |
429 pos == BOTTOM_GUTTER ? "BOTTOM" : | 429 pos == BOTTOM_GUTTER ? "BOTTOM" : |
430 pos == LEFT_GUTTER ? "LEFT" : "RIGHT", | 430 pos == LEFT_GUTTER ? "LEFT" : "RIGHT", |
431 width, height, x, y, force ? "force" : | 431 width, height, x, y, force ? "force" : |
432 f->faces_changed ? "f->faces_changed" : | 432 f->faces_changed ? "f->faces_changed" : |
463 ypos = y; | 463 ypos = y; |
464 | 464 |
465 redisplay_clear_region (window, findex, x + border_width , ypos, | 465 redisplay_clear_region (window, findex, x + border_width , ypos, |
466 width - 2 * border_width, height - (ypos - y) - border_width); | 466 width - 2 * border_width, height - (ypos - y) - border_width); |
467 /* If, for some reason, we have more to display than we have | 467 /* If, for some reason, we have more to display than we have |
468 room for, and we are allowed to resize the gutter, then make | 468 room for, and we are allowed to resize the gutter, then make |
469 sure this happens before the next time we try and | 469 sure this happens before the next time we try and |
470 output. This can happen when face font sizes change. */ | 470 output. This can happen when face font sizes change. */ |
471 if (dl && EQ (w->gutter_size[pos], Qautodetect) | 471 if (dl && EQ (w->gutter_size[pos], Qautodetect) |
472 && (dl->clip > 0 || | 472 && (dl->clip > 0 || |
473 calculate_gutter_size_from_display_lines (pos, ddla) > | 473 calculate_gutter_size_from_display_lines (pos, ddla) > |
474 WINDOW_GUTTER_SIZE_INTERNAL (w, pos))) | 474 WINDOW_GUTTER_SIZE_INTERNAL (w, pos))) |
475 { | 475 { |
476 /* #### Ideally we would just mark the specifier as dirty | 476 /* #### Ideally we would just mark the specifier as dirty |
477 and everything else would "just work". Unfortunately we have | 477 and everything else would "just work". Unfortunately we have |
478 two problems with this. One is that the specifier cache | 478 two problems with this. One is that the specifier cache |
498 } | 498 } |
499 } | 499 } |
500 else | 500 else |
501 { | 501 { |
502 /* Nothing of significance happened so sync the display line | 502 /* Nothing of significance happened so sync the display line |
503 structs. */ | 503 structs. */ |
504 for (line = 0; line < Dynarr_length (ddla); line++) | 504 for (line = 0; line < Dynarr_length (ddla); line++) |
505 { | 505 { |
506 sync_display_line_structs (w, line, 1, cdla, ddla); | 506 sync_display_line_structs (w, line, 1, cdla, ddla); |
507 } | 507 } |
508 } | 508 } |
540 GUTTER_POS_LOOP (pos) | 540 GUTTER_POS_LOOP (pos) |
541 { | 541 { |
542 if (f->current_display_lines[pos]) | 542 if (f->current_display_lines[pos]) |
543 mark_redisplay_structs (f->current_display_lines[pos]); | 543 mark_redisplay_structs (f->current_display_lines[pos]); |
544 /* [[#### Do we really need to mark the desired lines?]] | 544 /* [[#### Do we really need to mark the desired lines?]] |
545 ALWAYS mark everything. --ben */ | 545 ALWAYS mark everything. --ben */ |
546 if (f->desired_display_lines[pos]) | 546 if (f->desired_display_lines[pos]) |
547 mark_redisplay_structs (f->desired_display_lines[pos]); | 547 mark_redisplay_structs (f->desired_display_lines[pos]); |
548 } | 548 } |
549 } | 549 } |
550 | 550 |
600 } | 600 } |
601 | 601 |
602 void | 602 void |
603 update_frame_gutter_geometry (struct frame *f) | 603 update_frame_gutter_geometry (struct frame *f) |
604 { | 604 { |
605 if (f->gutter_changed | 605 if (f->gutter_changed |
606 || f->frame_layout_changed | 606 || f->frame_layout_changed |
607 || f->windows_structure_changed) | 607 || f->windows_structure_changed) |
608 { | 608 { |
609 enum gutter_pos pos; | 609 enum gutter_pos pos; |
610 | 610 |
611 /* If the gutter geometry has changed then re-layout the | 611 /* If the gutter geometry has changed then re-layout the |
612 frame. If we are in display there is almost no point in doing | 612 frame. If we are in display there is almost no point in doing |
613 anything else since the frame size changes will be delayed | 613 anything else since the frame size changes will be delayed |
614 until we are out of redisplay proper. */ | 614 until we are out of redisplay proper. */ |
615 GUTTER_POS_LOOP (pos) | 615 GUTTER_POS_LOOP (pos) |
616 { | 616 { |
617 update_gutter_geometry (f, pos); | 617 update_gutter_geometry (f, pos); |
618 } | 618 } |
619 } | 619 } |
629 f->extents_changed || f->frame_layout_changed) | 629 f->extents_changed || f->frame_layout_changed) |
630 { | 630 { |
631 enum gutter_pos pos; | 631 enum gutter_pos pos; |
632 | 632 |
633 /* We don't actually care about these when outputting the gutter | 633 /* We don't actually care about these when outputting the gutter |
634 so locally disable them. */ | 634 so locally disable them. */ |
635 int local_clip_changed = f->clip_changed; | 635 int local_clip_changed = f->clip_changed; |
636 int local_buffers_changed = f->buffers_changed; | 636 int local_buffers_changed = f->buffers_changed; |
637 f->clip_changed = 0; | 637 f->clip_changed = 0; |
638 f->buffers_changed = 0; | 638 f->buffers_changed = 0; |
639 | 639 |
1127 else if (FRAME_REPAINT_P (f)) | 1127 else if (FRAME_REPAINT_P (f)) |
1128 { | 1128 { |
1129 int depth; | 1129 int depth; |
1130 | 1130 |
1131 /* We have to be "in display" when we output the gutter | 1131 /* We have to be "in display" when we output the gutter |
1132 - make it so. */ | 1132 - make it so. */ |
1133 depth = enter_redisplay_critical_section (); | 1133 depth = enter_redisplay_critical_section (); |
1134 update_frame_gutters (f); | 1134 update_frame_gutters (f); |
1135 exit_redisplay_critical_section (depth); | 1135 exit_redisplay_critical_section (depth); |
1136 } | 1136 } |
1137 | 1137 |