aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/dispextern.h27
-rw-r--r--src/xdisp.c90
2 files changed, 56 insertions, 61 deletions
diff --git a/src/dispextern.h b/src/dispextern.h
index 5d66fd8a489..4e947daa253 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -196,29 +196,6 @@ enum window_part
196#else 196#else
197#define IF_DEBUG(X) ((void) 0) 197#define IF_DEBUG(X) ((void) 0)
198#endif 198#endif
199
200/* Macro for displaying traces of redisplay. If Emacs was compiled
201 with GLYPH_DEBUG defined, the variable trace_redisplay_p can be set to
202 a non-zero value in debugging sessions to activate traces. */
203
204#ifdef GLYPH_DEBUG
205
206extern bool trace_redisplay_p EXTERNALLY_VISIBLE;
207#include <stdio.h>
208
209#define TRACE(X) \
210 do { \
211 if (trace_redisplay_p) \
212 fprintf X; \
213 } while (false)
214
215#else /* not GLYPH_DEBUG */
216
217#define TRACE(X) ((void) 0)
218
219#endif /* GLYPH_DEBUG */
220
221
222 199
223/*********************************************************************** 200/***********************************************************************
224 Text positions 201 Text positions
@@ -3324,10 +3301,6 @@ extern void get_font_ascent_descent (struct font *, int *, int *);
3324 3301
3325#ifdef HAVE_WINDOW_SYSTEM 3302#ifdef HAVE_WINDOW_SYSTEM
3326 3303
3327#ifdef GLYPH_DEBUG
3328extern void dump_glyph_string (struct glyph_string *) EXTERNALLY_VISIBLE;
3329#endif
3330
3331extern void gui_get_glyph_overhangs (struct glyph *, struct frame *, 3304extern void gui_get_glyph_overhangs (struct glyph *, struct frame *,
3332 int *, int *); 3305 int *, int *);
3333extern struct font *font_for_underline_metrics (struct glyph_string *); 3306extern struct font *font_for_underline_metrics (struct glyph_string *);
diff --git a/src/xdisp.c b/src/xdisp.c
index 4bda3ec481e..c13a950e3a6 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -666,23 +666,45 @@ This function may be passed to `add-variable-watcher'. */)
666 return Qnil; 666 return Qnil;
667} 667}
668 668
669/* redisplay_trace is for displaying traces of redisplay.
670 If Emacs was compiled with GLYPH_DEBUG defined, the variable
671 trace_redisplay_p can be set to a non-zero value in debugging
672 sessions to activate traces. */
669#ifdef GLYPH_DEBUG 673#ifdef GLYPH_DEBUG
670 674extern bool trace_redisplay_p EXTERNALLY_VISIBLE;
671/* True means print traces of redisplay if compiled with
672 GLYPH_DEBUG defined. */
673
674bool trace_redisplay_p; 675bool trace_redisplay_p;
675 676#else
676#endif /* GLYPH_DEBUG */ 677enum { trace_redisplay_p = false };
678#endif
679static void ATTRIBUTE_FORMAT_PRINTF (1, 2)
680redisplay_trace (char const *fmt, ...)
681{
682 if (trace_redisplay_p)
683 {
684 va_list ap;
685 va_start (ap, fmt);
686 vprintf (fmt, ap);
687 va_end (ap);
688 }
689}
677 690
678#ifdef DEBUG_TRACE_MOVE 691#ifdef DEBUG_TRACE_MOVE
679/* True means trace with TRACE_MOVE to stderr. */ 692extern bool trace_move EXTERNALLY_VISIBLE;
680static bool trace_move; 693bool trace_move;
681
682#define TRACE_MOVE(x) if (trace_move) fprintf x; else (void) 0
683#else 694#else
684#define TRACE_MOVE(x) (void) 0 695enum { trace_move = false };
685#endif 696#endif
697static void ATTRIBUTE_FORMAT_PRINTF (1, 2)
698move_trace (char const *fmt, ...)
699{
700 if (trace_move)
701 {
702 va_list ap;
703 va_start (ap, fmt);
704 vprintf (fmt, ap);
705 va_end (ap);
706 }
707}
686 708
687/* Buffer being redisplayed -- for redisplay_window_error. */ 709/* Buffer being redisplayed -- for redisplay_window_error. */
688 710
@@ -9212,8 +9234,8 @@ move_it_in_display_line_to (struct it *it,
9212 atx_it.sp = -1; 9234 atx_it.sp = -1;
9213 } 9235 }
9214 9236
9215 TRACE_MOVE ((stderr, "move_it_in: continued at %td\n", 9237 move_trace ("move_it_in: continued at %td\n",
9216 IT_CHARPOS (*it))); 9238 IT_CHARPOS (*it));
9217 result = MOVE_LINE_CONTINUED; 9239 result = MOVE_LINE_CONTINUED;
9218 break; 9240 break;
9219 } 9241 }
@@ -9577,12 +9599,12 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos
9577 break; 9599 break;
9578 } 9600 }
9579 SAVE_IT (it_backup, *it, backup_data); 9601 SAVE_IT (it_backup, *it, backup_data);
9580 TRACE_MOVE ((stderr, "move_it: from %td\n", IT_CHARPOS (*it))); 9602 move_trace ("move_it: from %td\n", IT_CHARPOS (*it));
9581 skip2 = move_it_in_display_line_to (it, to_charpos, -1, 9603 skip2 = move_it_in_display_line_to (it, to_charpos, -1,
9582 op & MOVE_TO_POS); 9604 op & MOVE_TO_POS);
9583 TRACE_MOVE ((stderr, "move_it: to %td\n", IT_CHARPOS (*it))); 9605 move_trace ("move_it: to %td\n", IT_CHARPOS (*it));
9584 line_height = it->max_ascent + it->max_descent; 9606 line_height = it->max_ascent + it->max_descent;
9585 TRACE_MOVE ((stderr, "move_it: line_height = %d\n", line_height)); 9607 move_trace ("move_it: line_height = %d\n", line_height);
9586 9608
9587 if (to_y >= it->current_y 9609 if (to_y >= it->current_y
9588 && to_y < it->current_y + line_height) 9610 && to_y < it->current_y + line_height)
@@ -9614,7 +9636,7 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos
9614 { 9636 {
9615 /* Check whether TO_Y is in this line. */ 9637 /* Check whether TO_Y is in this line. */
9616 line_height = it->max_ascent + it->max_descent; 9638 line_height = it->max_ascent + it->max_descent;
9617 TRACE_MOVE ((stderr, "move_it: line_height = %d\n", line_height)); 9639 move_trace ("move_it: line_height = %d\n", line_height);
9618 9640
9619 if (to_y >= it->current_y 9641 if (to_y >= it->current_y
9620 && to_y < it->current_y + line_height) 9642 && to_y < it->current_y + line_height)
@@ -9774,7 +9796,7 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos
9774 if (backup_data) 9796 if (backup_data)
9775 bidi_unshelve_cache (backup_data, true); 9797 bidi_unshelve_cache (backup_data, true);
9776 9798
9777 TRACE_MOVE ((stderr, "move_it_to: reached %d\n", reached)); 9799 move_trace ("move_it_to: reached %d\n", reached);
9778 9800
9779 return max_current_x; 9801 return max_current_x;
9780} 9802}
@@ -9917,8 +9939,8 @@ move_it_vertically_backward (struct it *it, int dy)
9917 > min (window_box_height (it->w), line_height * 2 / 3)) 9939 > min (window_box_height (it->w), line_height * 2 / 3))
9918 && IT_CHARPOS (*it) > BEGV) 9940 && IT_CHARPOS (*it) > BEGV)
9919 { 9941 {
9920 TRACE_MOVE ((stderr, " not far enough -> move_vert %d\n", 9942 move_trace (" not far enough -> move_vert %d\n",
9921 target_y - it->current_y)); 9943 target_y - it->current_y);
9922 dy = it->current_y - target_y; 9944 dy = it->current_y - target_y;
9923 goto move_further_back; 9945 goto move_further_back;
9924 } 9946 }
@@ -9959,10 +9981,10 @@ move_it_vertically (struct it *it, int dy)
9959 move_it_vertically_backward (it, -dy); 9981 move_it_vertically_backward (it, -dy);
9960 else 9982 else
9961 { 9983 {
9962 TRACE_MOVE ((stderr, "move_it_v: from %td, %d\n", IT_CHARPOS (*it), dy)); 9984 move_trace ("move_it_v: from %td, %d\n", IT_CHARPOS (*it), dy);
9963 move_it_to (it, ZV, -1, it->current_y + dy, -1, 9985 move_it_to (it, ZV, -1, it->current_y + dy, -1,
9964 MOVE_TO_POS | MOVE_TO_Y); 9986 MOVE_TO_POS | MOVE_TO_Y);
9965 TRACE_MOVE ((stderr, "move_it_v: to %td\n", IT_CHARPOS (*it))); 9987 move_trace ("move_it_v: to %td\n", IT_CHARPOS (*it));
9966 9988
9967 /* If buffer ends in ZV without a newline, move to the start of 9989 /* If buffer ends in ZV without a newline, move to the start of
9968 the line to satisfy the post-condition. */ 9990 the line to satisfy the post-condition. */
@@ -14048,7 +14070,7 @@ redisplay_internal (void)
14048 /* True means redisplay has to redisplay the miniwindow. */ 14070 /* True means redisplay has to redisplay the miniwindow. */
14049 bool update_miniwindow_p = false; 14071 bool update_miniwindow_p = false;
14050 14072
14051 TRACE ((stderr, "redisplay_internal %d\n", redisplaying_p)); 14073 redisplay_trace ("redisplay_internal %d\n", redisplaying_p);
14052 14074
14053 /* No redisplay if running in batch mode or frame is not yet fully 14075 /* No redisplay if running in batch mode or frame is not yet fully
14054 initialized, or redisplay is explicitly turned off by setting 14076 initialized, or redisplay is explicitly turned off by setting
@@ -14321,7 +14343,7 @@ redisplay_internal (void)
14321 if (it.current_x != this_line_start_x) 14343 if (it.current_x != this_line_start_x)
14322 goto cancel; 14344 goto cancel;
14323 14345
14324 TRACE ((stderr, "trying display optimization 1\n")); 14346 redisplay_trace ("trying display optimization 1\n");
14325 w->cursor.vpos = -1; 14347 w->cursor.vpos = -1;
14326 overlay_arrow_seen = false; 14348 overlay_arrow_seen = false;
14327 it.vpos = this_line_vpos; 14349 it.vpos = this_line_vpos;
@@ -14840,7 +14862,7 @@ unwind_redisplay_preserve_echo_area (void)
14840void 14862void
14841redisplay_preserve_echo_area (int from_where) 14863redisplay_preserve_echo_area (int from_where)
14842{ 14864{
14843 TRACE ((stderr, "redisplay_preserve_echo_area (%d)\n", from_where)); 14865 redisplay_trace ("redisplay_preserve_echo_area (%d)\n", from_where);
14844 14866
14845 block_input (); 14867 block_input ();
14846 ptrdiff_t count = SPECPDL_INDEX (); 14868 ptrdiff_t count = SPECPDL_INDEX ();
@@ -18753,7 +18775,7 @@ try_window_id (struct window *w)
18753#if false 18775#if false
18754#define GIVE_UP(X) \ 18776#define GIVE_UP(X) \
18755 do { \ 18777 do { \
18756 TRACE ((stderr, "try_window_id give up %d\n", (X))); \ 18778 redisplay_trace ("try_window_id give up %d\n", X); \
18757 return 0; \ 18779 return 0; \
18758 } while (false) 18780 } while (false)
18759#else 18781#else
@@ -19595,7 +19617,7 @@ dump_glyph (struct glyph_row *row, struct glyph *glyph, int area)
19595 eassume (false); 19617 eassume (false);
19596#else 19618#else
19597 fprintf (stderr, 19619 fprintf (stderr,
19598 " %5d %4c %6d %c %3d 0x%05x %c %4d %1.1d%1.1d\n", 19620 " %5td %4c %6td %c %3d %7p %c %4d %1.1d%1.1d\n",
19599 glyph - row->glyphs[TEXT_AREA], 19621 glyph - row->glyphs[TEXT_AREA],
19600 'X', 19622 'X',
19601 glyph->charpos, 19623 glyph->charpos,
@@ -25947,6 +25969,7 @@ get_font_ascent_descent (struct font *font, int *ascent, int *descent)
25947 25969
25948#ifdef GLYPH_DEBUG 25970#ifdef GLYPH_DEBUG
25949 25971
25972extern void dump_glyph_string (struct glyph_string *) EXTERNALLY_VISIBLE;
25950void 25973void
25951dump_glyph_string (struct glyph_string *s) 25974dump_glyph_string (struct glyph_string *s)
25952{ 25975{
@@ -32507,8 +32530,8 @@ expose_window (struct window *w, const Emacs_Rectangle *fr)
32507 struct glyph_row *row; 32530 struct glyph_row *row;
32508 struct glyph_row *first_overlapping_row, *last_overlapping_row; 32531 struct glyph_row *first_overlapping_row, *last_overlapping_row;
32509 32532
32510 TRACE ((stderr, "expose_window (%d, %d, %d, %d)\n", 32533 redisplay_trace ("expose_window (%d, %d, %d, %d)\n",
32511 r.x, r.y, r.width, r.height)); 32534 r.x, r.y, r.width, r.height);
32512 32535
32513 /* Convert to window coordinates. */ 32536 /* Convert to window coordinates. */
32514 r.x -= WINDOW_LEFT_EDGE_X (w); 32537 r.x -= WINDOW_LEFT_EDGE_X (w);
@@ -32666,11 +32689,9 @@ expose_frame (struct frame *f, int x, int y, int w, int h)
32666 Emacs_Rectangle r; 32689 Emacs_Rectangle r;
32667 bool mouse_face_overwritten_p = false; 32690 bool mouse_face_overwritten_p = false;
32668 32691
32669 TRACE ((stderr, "expose_frame "));
32670
32671 if (FRAME_GARBAGED_P (f)) 32692 if (FRAME_GARBAGED_P (f))
32672 { 32693 {
32673 TRACE ((stderr, " garbaged\n")); 32694 redisplay_trace ("expose_frame garbaged\n");
32674 return; 32695 return;
32675 } 32696 }
32676 32697
@@ -32680,7 +32701,7 @@ expose_frame (struct frame *f, int x, int y, int w, int h)
32680 if (FRAME_FACE_CACHE (f) == NULL 32701 if (FRAME_FACE_CACHE (f) == NULL
32681 || FRAME_FACE_CACHE (f)->used < BASIC_FACE_ID_SENTINEL) 32702 || FRAME_FACE_CACHE (f)->used < BASIC_FACE_ID_SENTINEL)
32682 { 32703 {
32683 TRACE ((stderr, " no faces\n")); 32704 redisplay_trace ("expose_frame no faces\n");
32684 return; 32705 return;
32685 } 32706 }
32686 32707
@@ -32698,7 +32719,8 @@ expose_frame (struct frame *f, int x, int y, int w, int h)
32698 r.height = h; 32719 r.height = h;
32699 } 32720 }
32700 32721
32701 TRACE ((stderr, "(%d, %d, %d, %d)\n", r.x, r.y, r.width, r.height)); 32722 redisplay_trace ("expose_frame (%d, %d, %d, %d)\n",
32723 r.x, r.y, r.width, r.height);
32702 mouse_face_overwritten_p = expose_window_tree (XWINDOW (f->root_window), &r); 32724 mouse_face_overwritten_p = expose_window_tree (XWINDOW (f->root_window), &r);
32703 32725
32704#ifndef HAVE_EXT_TOOL_BAR 32726#ifndef HAVE_EXT_TOOL_BAR