diff options
| author | Gerd Moellmann | 2000-12-27 12:43:22 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-12-27 12:43:22 +0000 |
| commit | 9b0e97aaa024e7fca64fa967a169885caa629708 (patch) | |
| tree | d89b63fcac1e48de2aa1f23dc9116b75a46e48ee | |
| parent | 3e32cc273a2da0327704585533d73b262f5b3e24 (diff) | |
| download | emacs-9b0e97aaa024e7fca64fa967a169885caa629708.tar.gz emacs-9b0e97aaa024e7fca64fa967a169885caa629708.zip | |
(struct redisplay_history) [GLYPH_DEBUG]: New.
(REDISPLAY_HISTORY_SIZE) [GLYPH_DEBUG]: New macro.
(redisplay_history, history_idx, history_tick) [GLYPH_DEBUG]: New
variables.
(add_window_display_history, add_frame_display_history)
(Fdump_redisplay_history) [GLYPH_DEBUG]: New functions.
(build_frame_matrix_from_leaf_window): Remove unused code.
(build_frame_matrix_from_leaf_window) [GLYPH_DEBUG]: Add to
redisplay history.
(update_frame) [GLYPH_DEBUG]: Add to redisplay history.
(update_window) [GLYPH_DEBUG]: Likewise.
(syms_of_display): Defsubr dump-redisplay-history.
| -rw-r--r-- | src/dispnew.c | 137 |
1 files changed, 112 insertions, 25 deletions
diff --git a/src/dispnew.c b/src/dispnew.c index 36ccd0d7bf6..87e7f689bb7 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -187,7 +187,6 @@ static int margin_glyphs_to_reserve P_ ((struct window *, int, Lisp_Object)); | |||
| 187 | static void sync_window_with_frame_matrix_rows P_ ((struct window *)); | 187 | static void sync_window_with_frame_matrix_rows P_ ((struct window *)); |
| 188 | struct window *frame_row_to_window P_ ((struct window *, int)); | 188 | struct window *frame_row_to_window P_ ((struct window *, int)); |
| 189 | 189 | ||
| 190 | |||
| 191 | 190 | ||
| 192 | /* Non-zero means don't pause redisplay for pending input. (This is | 191 | /* Non-zero means don't pause redisplay for pending input. (This is |
| 193 | for debugging and for a future implementation of EDT-like | 192 | for debugging and for a future implementation of EDT-like |
| @@ -331,6 +330,105 @@ static int window_to_frame_hpos P_ ((struct window *, int)); | |||
| 331 | #define WINDOW_TO_FRAME_VPOS(W, VPOS) window_to_frame_vpos ((W), (VPOS)) | 330 | #define WINDOW_TO_FRAME_VPOS(W, VPOS) window_to_frame_vpos ((W), (VPOS)) |
| 332 | #define WINDOW_TO_FRAME_HPOS(W, HPOS) window_to_frame_hpos ((W), (HPOS)) | 331 | #define WINDOW_TO_FRAME_HPOS(W, HPOS) window_to_frame_hpos ((W), (HPOS)) |
| 333 | 332 | ||
| 333 | /* One element of the ring buffer containing redisplay history | ||
| 334 | information. */ | ||
| 335 | |||
| 336 | struct redisplay_history | ||
| 337 | { | ||
| 338 | char trace[512 + 100]; | ||
| 339 | }; | ||
| 340 | |||
| 341 | /* The size of the history buffer. */ | ||
| 342 | |||
| 343 | #define REDISPLAY_HISTORY_SIZE 30 | ||
| 344 | |||
| 345 | /* The redisplay history buffer. */ | ||
| 346 | |||
| 347 | static struct redisplay_history redisplay_history[REDISPLAY_HISTORY_SIZE]; | ||
| 348 | |||
| 349 | /* Next free entry in redisplay_history. */ | ||
| 350 | |||
| 351 | static int history_idx; | ||
| 352 | |||
| 353 | /* A tick that's incremented each time something is added to the | ||
| 354 | history. */ | ||
| 355 | |||
| 356 | static unsigned history_tick; | ||
| 357 | |||
| 358 | static void add_frame_display_history P_ ((struct frame *, int)); | ||
| 359 | static void add_window_display_history P_ ((struct window *, char *, int)); | ||
| 360 | |||
| 361 | |||
| 362 | /* Add to the redisplay history how window W has been displayed. | ||
| 363 | MSG is a trace containing the information how W's glyph matrix | ||
| 364 | has been contructed. PAUSED_P non-zero means that the update | ||
| 365 | has been interrupted for pending input. */ | ||
| 366 | |||
| 367 | static void | ||
| 368 | add_window_display_history (w, msg, paused_p) | ||
| 369 | struct window *w; | ||
| 370 | char *msg; | ||
| 371 | int paused_p; | ||
| 372 | { | ||
| 373 | char *buf; | ||
| 374 | |||
| 375 | if (history_idx >= REDISPLAY_HISTORY_SIZE) | ||
| 376 | history_idx = 0; | ||
| 377 | buf = redisplay_history[history_idx].trace; | ||
| 378 | ++history_idx; | ||
| 379 | |||
| 380 | sprintf (buf, "%d: window %p (`%s')%s\n", | ||
| 381 | history_tick++, | ||
| 382 | w, | ||
| 383 | ((BUFFERP (w->buffer) | ||
| 384 | && STRINGP (XBUFFER (w->buffer)->name)) | ||
| 385 | ? (char *) XSTRING (XBUFFER (w->buffer)->name)->data | ||
| 386 | : "???"), | ||
| 387 | paused_p ? " ***paused***" : ""); | ||
| 388 | strcat (buf, msg); | ||
| 389 | } | ||
| 390 | |||
| 391 | |||
| 392 | /* Add to the redisplay history that frame F has been displayed. | ||
| 393 | PAUSED_P non-zero means that the update has been interrupted for | ||
| 394 | pending input. */ | ||
| 395 | |||
| 396 | static void | ||
| 397 | add_frame_display_history (f, paused_p) | ||
| 398 | struct frame *f; | ||
| 399 | int paused_p; | ||
| 400 | { | ||
| 401 | char *buf; | ||
| 402 | |||
| 403 | if (history_idx >= REDISPLAY_HISTORY_SIZE) | ||
| 404 | history_idx = 0; | ||
| 405 | buf = redisplay_history[history_idx].trace; | ||
| 406 | ++history_idx; | ||
| 407 | |||
| 408 | sprintf (buf, "%d: update frame %p%s", | ||
| 409 | history_tick++, | ||
| 410 | f, paused_p ? " ***paused***" : ""); | ||
| 411 | } | ||
| 412 | |||
| 413 | |||
| 414 | DEFUN ("dump-redisplay-history", Fdump_redisplay_history, | ||
| 415 | Sdump_redisplay_history, 0, 0, "", | ||
| 416 | "Dump redisplay history to stderr.") | ||
| 417 | () | ||
| 418 | { | ||
| 419 | int i; | ||
| 420 | |||
| 421 | for (i = history_idx - 1; i != history_idx; --i) | ||
| 422 | { | ||
| 423 | if (i < 0) | ||
| 424 | i = REDISPLAY_HISTORY_SIZE - 1; | ||
| 425 | fprintf (stderr, "%s\n", redisplay_history[i].trace); | ||
| 426 | } | ||
| 427 | |||
| 428 | return Qnil; | ||
| 429 | } | ||
| 430 | |||
| 431 | |||
| 334 | #else /* GLYPH_DEBUG == 0 */ | 432 | #else /* GLYPH_DEBUG == 0 */ |
| 335 | 433 | ||
| 336 | #define WINDOW_TO_FRAME_VPOS(W, VPOS) ((VPOS) + XFASTINT ((W)->top)) | 434 | #define WINDOW_TO_FRAME_VPOS(W, VPOS) ((VPOS) + XFASTINT ((W)->top)) |
| @@ -2613,29 +2711,6 @@ build_frame_matrix_from_leaf_window (frame_matrix, w) | |||
| 2613 | SET_CHAR_GLYPH_FROM_GLYPH (*border, right_border_glyph); | 2711 | SET_CHAR_GLYPH_FROM_GLYPH (*border, right_border_glyph); |
| 2614 | } | 2712 | } |
| 2615 | 2713 | ||
| 2616 | #if 0 /* This shouldn't be necessary. Let's check it. */ | ||
| 2617 | /* Due to hooks installed, it normally doesn't happen that | ||
| 2618 | window rows and frame rows of the same matrix are out of | ||
| 2619 | sync, i.e. have a different understanding of where to | ||
| 2620 | find glyphs for the row. The following is a safety-belt | ||
| 2621 | that doesn't cost much and makes absolutely sure that | ||
| 2622 | window and frame matrices are in sync. */ | ||
| 2623 | if (!glyph_row_slice_p (window_row, frame_row)) | ||
| 2624 | { | ||
| 2625 | /* Find the row in the window being a slice. There | ||
| 2626 | should exist one from program logic. */ | ||
| 2627 | struct glyph_row *slice_row | ||
| 2628 | = find_glyph_row_slice (window_matrix, frame_matrix, frame_y); | ||
| 2629 | xassert (slice_row != 0); | ||
| 2630 | |||
| 2631 | /* Exchange glyphs between both window rows. */ | ||
| 2632 | swap_glyphs_in_rows (window_row, slice_row); | ||
| 2633 | |||
| 2634 | /* Exchange pointers between both rows. */ | ||
| 2635 | swap_glyph_pointers (window_row, slice_row); | ||
| 2636 | } | ||
| 2637 | #endif | ||
| 2638 | |||
| 2639 | /* Window row window_y must be a slice of frame row | 2714 | /* Window row window_y must be a slice of frame row |
| 2640 | frame_y. */ | 2715 | frame_y. */ |
| 2641 | xassert (glyph_row_slice_p (window_row, frame_row)); | 2716 | xassert (glyph_row_slice_p (window_row, frame_row)); |
| @@ -2645,6 +2720,7 @@ build_frame_matrix_from_leaf_window (frame_matrix, w) | |||
| 2645 | 2720 | ||
| 2646 | #if GLYPH_DEBUG | 2721 | #if GLYPH_DEBUG |
| 2647 | strcpy (w->current_matrix->method, w->desired_matrix->method); | 2722 | strcpy (w->current_matrix->method, w->desired_matrix->method); |
| 2723 | add_window_display_history (w, w->current_matrix->method, 0); | ||
| 2648 | #endif | 2724 | #endif |
| 2649 | } | 2725 | } |
| 2650 | 2726 | ||
| @@ -3697,7 +3773,10 @@ update_frame (f, force_p, inhibit_hairy_id_p) | |||
| 3697 | fflush (stdout); | 3773 | fflush (stdout); |
| 3698 | 3774 | ||
| 3699 | /* Check window matrices for lost pointers. */ | 3775 | /* Check window matrices for lost pointers. */ |
| 3700 | IF_DEBUG (check_window_matrix_pointers (root_window)); | 3776 | #ifdef GLYPH_DEBUG |
| 3777 | check_window_matrix_pointers (root_window); | ||
| 3778 | add_frame_display_history (f, paused_p); | ||
| 3779 | #endif | ||
| 3701 | } | 3780 | } |
| 3702 | 3781 | ||
| 3703 | /* Reset flags indicating that a window should be updated. */ | 3782 | /* Reset flags indicating that a window should be updated. */ |
| @@ -4015,6 +4094,10 @@ update_window (w, force_p) | |||
| 4015 | else | 4094 | else |
| 4016 | paused_p = 1; | 4095 | paused_p = 1; |
| 4017 | 4096 | ||
| 4097 | #ifdef GLYPH_DEBUG | ||
| 4098 | add_window_display_history (w, w->current_matrix->method, paused_p); | ||
| 4099 | #endif | ||
| 4100 | |||
| 4018 | clear_glyph_matrix (desired_matrix); | 4101 | clear_glyph_matrix (desired_matrix); |
| 4019 | 4102 | ||
| 4020 | return paused_p; | 4103 | return paused_p; |
| @@ -6399,6 +6482,10 @@ syms_of_display () | |||
| 6399 | defsubr (&Sinternal_show_cursor); | 6482 | defsubr (&Sinternal_show_cursor); |
| 6400 | defsubr (&Sinternal_show_cursor_p); | 6483 | defsubr (&Sinternal_show_cursor_p); |
| 6401 | 6484 | ||
| 6485 | #ifdef GLYPH_DEBUG | ||
| 6486 | defsubr (&Sdump_redisplay_history); | ||
| 6487 | #endif | ||
| 6488 | |||
| 6402 | frame_and_buffer_state = Fmake_vector (make_number (20), Qlambda); | 6489 | frame_and_buffer_state = Fmake_vector (make_number (20), Qlambda); |
| 6403 | staticpro (&frame_and_buffer_state); | 6490 | staticpro (&frame_and_buffer_state); |
| 6404 | 6491 | ||