diff options
| author | Gerd Moellmann | 2000-02-25 13:20:36 +0000 |
|---|---|---|
| committer | Gerd Moellmann | 2000-02-25 13:20:36 +0000 |
| commit | a13396c934774d4687f73e4f10fdc96f91d95185 (patch) | |
| tree | 234e0c9a4ef42315a8f75339f490e56bbea2ec88 /src | |
| parent | 36e988461fed452432d3a921355b0e00b87fd82b (diff) | |
| download | emacs-a13396c934774d4687f73e4f10fdc96f91d95185.tar.gz emacs-a13396c934774d4687f73e4f10fdc96f91d95185.zip | |
(flush_stdout) [GLYPH_DEBUG]: New function.
(build_frame_matrix_from_leaf_window): Put code handling
glyph row's not being a slice of a frame row in #if 0.
(sync_window_with_frame_matrix_rows): New function.
(frame_row_to_window): New function.
(mirror_line_dance): Handle copies between windows.
Diffstat (limited to 'src')
| -rw-r--r-- | src/dispnew.c | 131 |
1 files changed, 114 insertions, 17 deletions
diff --git a/src/dispnew.c b/src/dispnew.c index 6592d703610..ebceb1178b6 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -174,6 +174,8 @@ static void adjust_frame_glyphs_for_window_redisplay P_ ((struct frame *)); | |||
| 174 | static void adjust_frame_glyphs_for_frame_redisplay P_ ((struct frame *)); | 174 | static void adjust_frame_glyphs_for_frame_redisplay P_ ((struct frame *)); |
| 175 | static void reverse_rows P_ ((struct glyph_matrix *, int, int)); | 175 | static void reverse_rows P_ ((struct glyph_matrix *, int, int)); |
| 176 | static int margin_glyphs_to_reserve P_ ((struct window *, int, Lisp_Object)); | 176 | static int margin_glyphs_to_reserve P_ ((struct window *, int, Lisp_Object)); |
| 177 | static void sync_window_with_frame_matrix_rows P_ ((struct window *)); | ||
| 178 | struct window *frame_row_to_window P_ ((struct window *, int)); | ||
| 177 | 179 | ||
| 178 | 180 | ||
| 179 | 181 | ||
| @@ -1495,6 +1497,17 @@ realloc_glyph_pool (pool, matrix_dim) | |||
| 1495 | 1497 | ||
| 1496 | #if GLYPH_DEBUG | 1498 | #if GLYPH_DEBUG |
| 1497 | 1499 | ||
| 1500 | |||
| 1501 | /* Flush standard output. This is sometimes useful to call from | ||
| 1502 | the debugger. */ | ||
| 1503 | |||
| 1504 | void | ||
| 1505 | flush_stdout () | ||
| 1506 | { | ||
| 1507 | fflush (stdout); | ||
| 1508 | } | ||
| 1509 | |||
| 1510 | |||
| 1498 | /* Check that no glyph pointers have been lost in MATRIX. If a | 1511 | /* Check that no glyph pointers have been lost in MATRIX. If a |
| 1499 | pointer has been lost, e.g. by using a structure assignment between | 1512 | pointer has been lost, e.g. by using a structure assignment between |
| 1500 | rows, at least one pointer must occur more than once in the rows of | 1513 | rows, at least one pointer must occur more than once in the rows of |
| @@ -2439,6 +2452,7 @@ build_frame_matrix_from_leaf_window (frame_matrix, w) | |||
| 2439 | SET_CHAR_GLYPH_FROM_GLYPH (*border, right_border_glyph); | 2452 | SET_CHAR_GLYPH_FROM_GLYPH (*border, right_border_glyph); |
| 2440 | } | 2453 | } |
| 2441 | 2454 | ||
| 2455 | #if 0 /* This shouldn't be necessary. Let's check it. */ | ||
| 2442 | /* Due to hooks installed, it normally doesn't happen that | 2456 | /* Due to hooks installed, it normally doesn't happen that |
| 2443 | window rows and frame rows of the same matrix are out of | 2457 | window rows and frame rows of the same matrix are out of |
| 2444 | sync, i.e. have a different understanding of where to | 2458 | sync, i.e. have a different understanding of where to |
| @@ -2459,11 +2473,12 @@ build_frame_matrix_from_leaf_window (frame_matrix, w) | |||
| 2459 | /* Exchange pointers between both rows. */ | 2473 | /* Exchange pointers between both rows. */ |
| 2460 | swap_glyph_pointers (window_row, slice_row); | 2474 | swap_glyph_pointers (window_row, slice_row); |
| 2461 | } | 2475 | } |
| 2476 | #endif | ||
| 2462 | 2477 | ||
| 2463 | /* Now, we are sure that window row window_y is a slice of | 2478 | /* Window row window_y must be a slice of frame row |
| 2464 | the frame row frame_y. But, lets check that assumption. */ | 2479 | frame_y. */ |
| 2465 | xassert (glyph_row_slice_p (window_row, frame_row)); | 2480 | xassert (glyph_row_slice_p (window_row, frame_row)); |
| 2466 | 2481 | ||
| 2467 | /* If rows are in sync, we don't have to copy glyphs because | 2482 | /* If rows are in sync, we don't have to copy glyphs because |
| 2468 | frame and window share glyphs. */ | 2483 | frame and window share glyphs. */ |
| 2469 | 2484 | ||
| @@ -2697,6 +2712,68 @@ mirrored_line_dance (matrix, unchanged_at_top, nlines, copy_from, | |||
| 2697 | } | 2712 | } |
| 2698 | 2713 | ||
| 2699 | 2714 | ||
| 2715 | /* Synchronize glyph pointers in the current matrix of window W with | ||
| 2716 | the current frame matrix. W must be full-width, and be on a tty | ||
| 2717 | frame. */ | ||
| 2718 | |||
| 2719 | static void | ||
| 2720 | sync_window_with_frame_matrix_rows (w) | ||
| 2721 | struct window *w; | ||
| 2722 | { | ||
| 2723 | struct frame *f = XFRAME (w->frame); | ||
| 2724 | struct glyph_row *window_row, *window_row_end, *frame_row; | ||
| 2725 | |||
| 2726 | /* Preconditions: W must be a leaf window and full-width. Its frame | ||
| 2727 | must have a frame matrix. */ | ||
| 2728 | xassert (NILP (w->hchild) && NILP (w->vchild)); | ||
| 2729 | xassert (WINDOW_FULL_WIDTH_P (w)); | ||
| 2730 | xassert (!FRAME_WINDOW_P (f)); | ||
| 2731 | |||
| 2732 | /* If W is a full-width window, glyph pointers in W's current matrix | ||
| 2733 | have, by definition, to be the same as glyph pointers in the | ||
| 2734 | corresponding frame matrix. */ | ||
| 2735 | window_row = w->current_matrix->rows; | ||
| 2736 | window_row_end = window_row + w->current_matrix->nrows; | ||
| 2737 | frame_row = f->current_matrix->rows + XFASTINT (w->top); | ||
| 2738 | while (window_row < window_row_end) | ||
| 2739 | { | ||
| 2740 | int area; | ||
| 2741 | |||
| 2742 | for (area = LEFT_MARGIN_AREA; area <= LAST_AREA; ++area) | ||
| 2743 | window_row->glyphs[area] = frame_row->glyphs[area]; | ||
| 2744 | |||
| 2745 | ++window_row, ++frame_row; | ||
| 2746 | } | ||
| 2747 | } | ||
| 2748 | |||
| 2749 | |||
| 2750 | /* Return the window in the window tree rooted in W containing frame | ||
| 2751 | row ROW. Value is null if none is found. */ | ||
| 2752 | |||
| 2753 | struct window * | ||
| 2754 | frame_row_to_window (w, row) | ||
| 2755 | struct window *w; | ||
| 2756 | int row; | ||
| 2757 | { | ||
| 2758 | struct window *found = NULL; | ||
| 2759 | |||
| 2760 | while (w && !found) | ||
| 2761 | { | ||
| 2762 | if (!NILP (w->hchild)) | ||
| 2763 | found = frame_row_to_window (XWINDOW (w->hchild), row); | ||
| 2764 | else if (!NILP (w->vchild)) | ||
| 2765 | found = frame_row_to_window (XWINDOW (w->vchild), row); | ||
| 2766 | else if (row >= XFASTINT (w->top) | ||
| 2767 | && row < XFASTINT (w->top) + XFASTINT (w->height)) | ||
| 2768 | found = w; | ||
| 2769 | |||
| 2770 | w = NILP (w->next) ? 0 : XWINDOW (w->next); | ||
| 2771 | } | ||
| 2772 | |||
| 2773 | return found; | ||
| 2774 | } | ||
| 2775 | |||
| 2776 | |||
| 2700 | /* Perform a line dance in the window tree rooted at W, after | 2777 | /* Perform a line dance in the window tree rooted at W, after |
| 2701 | scrolling a frame matrix in mirrored_line_dance. | 2778 | scrolling a frame matrix in mirrored_line_dance. |
| 2702 | 2779 | ||
| @@ -2728,9 +2805,7 @@ mirror_line_dance (w, unchanged_at_top, nlines, copy_from, retained_p) | |||
| 2728 | /* W is a leaf window, and we are working on its current | 2805 | /* W is a leaf window, and we are working on its current |
| 2729 | matrix m. */ | 2806 | matrix m. */ |
| 2730 | struct glyph_matrix *m = w->current_matrix; | 2807 | struct glyph_matrix *m = w->current_matrix; |
| 2731 | 2808 | int i, sync_p = 0; | |
| 2732 | int i; | ||
| 2733 | |||
| 2734 | struct glyph_row *old_rows; | 2809 | struct glyph_row *old_rows; |
| 2735 | 2810 | ||
| 2736 | /* Make a copy of the original rows of matrix m. */ | 2811 | /* Make a copy of the original rows of matrix m. */ |
| @@ -2755,21 +2830,15 @@ mirror_line_dance (w, unchanged_at_top, nlines, copy_from, retained_p) | |||
| 2755 | int from_inside_window_p | 2830 | int from_inside_window_p |
| 2756 | = window_from >= 0 && window_from < m->matrix_h; | 2831 | = window_from >= 0 && window_from < m->matrix_h; |
| 2757 | 2832 | ||
| 2758 | if (from_inside_window_p) | 2833 | /* Is assigned to line inside window? */ |
| 2834 | int to_inside_window_p | ||
| 2835 | = window_to >= 0 && window_to < m->matrix_h; | ||
| 2836 | |||
| 2837 | if (from_inside_window_p && to_inside_window_p) | ||
| 2759 | { | 2838 | { |
| 2760 | #if GLYPH_DEBUG | ||
| 2761 | /* Is assigned to line inside window? */ | ||
| 2762 | int to_inside_window_p | ||
| 2763 | = window_to >= 0 && window_to < m->matrix_h; | ||
| 2764 | #endif | ||
| 2765 | |||
| 2766 | /* Enabled setting before assignment. */ | 2839 | /* Enabled setting before assignment. */ |
| 2767 | int enabled_before_p; | 2840 | int enabled_before_p; |
| 2768 | 2841 | ||
| 2769 | /* If not both lines inside the window, we have a | ||
| 2770 | serious problem. */ | ||
| 2771 | xassert (to_inside_window_p); | ||
| 2772 | |||
| 2773 | /* Do the assignment. The enabled_p flag is saved | 2842 | /* Do the assignment. The enabled_p flag is saved |
| 2774 | over the assignment because the old redisplay did | 2843 | over the assignment because the old redisplay did |
| 2775 | that. */ | 2844 | that. */ |
| @@ -2781,7 +2850,35 @@ mirror_line_dance (w, unchanged_at_top, nlines, copy_from, retained_p) | |||
| 2781 | if (!retained_p[copy_from[i]]) | 2850 | if (!retained_p[copy_from[i]]) |
| 2782 | m->rows[window_to].enabled_p = 0; | 2851 | m->rows[window_to].enabled_p = 0; |
| 2783 | } | 2852 | } |
| 2853 | else if (to_inside_window_p) | ||
| 2854 | { | ||
| 2855 | /* A copy between windows. This is an infrequent | ||
| 2856 | case not worth optimizing. */ | ||
| 2857 | struct frame *f = XFRAME (w->frame); | ||
| 2858 | struct window *root = XWINDOW (FRAME_ROOT_WINDOW (f)); | ||
| 2859 | struct window *w2; | ||
| 2860 | struct glyph_matrix *m2; | ||
| 2861 | int m2_from; | ||
| 2862 | |||
| 2863 | w2 = frame_row_to_window (root, frame_to); | ||
| 2864 | m2 = w2->current_matrix; | ||
| 2865 | m2_from = frame_from - m2->matrix_y; | ||
| 2866 | copy_row_except_pointers (m->rows + window_to, | ||
| 2867 | m2->rows + m2_from); | ||
| 2868 | |||
| 2869 | /* If frame line is empty, window line is empty, too. */ | ||
| 2870 | if (!retained_p[copy_from[i]]) | ||
| 2871 | m->rows[window_to].enabled_p = 0; | ||
| 2872 | sync_p = 1; | ||
| 2873 | } | ||
| 2874 | else if (from_inside_window_p) | ||
| 2875 | sync_p = 1; | ||
| 2784 | } | 2876 | } |
| 2877 | |||
| 2878 | /* If there was a copy between windows, make sure glyph | ||
| 2879 | pointers are in sync with the frame matrix. */ | ||
| 2880 | if (sync_p) | ||
| 2881 | sync_window_with_frame_matrix_rows (w); | ||
| 2785 | 2882 | ||
| 2786 | /* Check that no pointers are lost. */ | 2883 | /* Check that no pointers are lost. */ |
| 2787 | CHECK_MATRIX (m); | 2884 | CHECK_MATRIX (m); |