Mercurial > emacs
comparison src/dispnew.c @ 51193:d47b56221a15
Make (many) trivial substitutions for renamed and
new macros in dispextern.h, frame.h and window.h.
(mode_line_string): No need to adjust width for mode lines, as it
is already adjusted by the caller.
(marginal_area_string): Handle fringes inside/outside margins.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Sat, 24 May 2003 21:57:05 +0000 |
parents | cf8d9d62ba1e |
children | 07dc24e888c8 |
comparison
equal
deleted
inserted
replaced
51192:e7a9fef91d7d | 51193:d47b56221a15 |
---|---|
426 } | 426 } |
427 | 427 |
428 | 428 |
429 #else /* GLYPH_DEBUG == 0 */ | 429 #else /* GLYPH_DEBUG == 0 */ |
430 | 430 |
431 #define WINDOW_TO_FRAME_VPOS(W, VPOS) ((VPOS) + XFASTINT ((W)->top)) | 431 #define WINDOW_TO_FRAME_VPOS(W, VPOS) ((VPOS) + WINDOW_TOP_EDGE_LINE (W)) |
432 #define WINDOW_TO_FRAME_HPOS(W, HPOS) ((HPOS) + XFASTINT ((W)->left)) | 432 #define WINDOW_TO_FRAME_HPOS(W, HPOS) ((HPOS) + WINDOW_LEFT_EDGE_COL (W)) |
433 | 433 |
434 #endif /* GLYPH_DEBUG == 0 */ | 434 #endif /* GLYPH_DEBUG == 0 */ |
435 | 435 |
436 | 436 |
437 /* Like bcopy except never gets confused by overlap. Let this be the | 437 /* Like bcopy except never gets confused by overlap. Let this be the |
574 { | 574 { |
575 int n; | 575 int n; |
576 | 576 |
577 if (NUMBERP (margin)) | 577 if (NUMBERP (margin)) |
578 { | 578 { |
579 int width = XFASTINT (w->width); | 579 int width = XFASTINT (w->total_cols); |
580 double d = max (0, XFLOATINT (margin)); | 580 double d = max (0, XFLOATINT (margin)); |
581 d = min (width / 2 - 1, d); | 581 d = min (width / 2 - 1, d); |
582 n = (int) ((double) total_glyphs / width * d); | 582 n = (int) ((double) total_glyphs / width * d); |
583 } | 583 } |
584 else | 584 else |
621 int new_rows; | 621 int new_rows; |
622 int marginal_areas_changed_p = 0; | 622 int marginal_areas_changed_p = 0; |
623 int header_line_changed_p = 0; | 623 int header_line_changed_p = 0; |
624 int header_line_p = 0; | 624 int header_line_p = 0; |
625 int left = -1, right = -1; | 625 int left = -1, right = -1; |
626 int window_x, window_y, window_width = -1, window_height; | 626 int window_width = -1, window_height; |
627 | 627 |
628 /* See if W had a header line that has disappeared now, or vice versa. */ | 628 /* See if W had a header line that has disappeared now, or vice versa. */ |
629 if (w) | 629 if (w) |
630 { | 630 { |
631 header_line_p = WINDOW_WANTS_HEADER_LINE_P (w); | 631 header_line_p = WINDOW_WANTS_HEADER_LINE_P (w); |
636 /* Do nothing if MATRIX' size, position, vscroll, and marginal areas | 636 /* Do nothing if MATRIX' size, position, vscroll, and marginal areas |
637 haven't changed. This optimization is important because preserving | 637 haven't changed. This optimization is important because preserving |
638 the matrix means preventing redisplay. */ | 638 the matrix means preventing redisplay. */ |
639 if (matrix->pool == NULL) | 639 if (matrix->pool == NULL) |
640 { | 640 { |
641 window_box (w, -1, &window_x, &window_y, &window_width, &window_height); | 641 window_box (w, -1, 0, 0, &window_width, &window_height); |
642 left = margin_glyphs_to_reserve (w, dim.width, w->left_margin_width); | 642 left = margin_glyphs_to_reserve (w, dim.width, w->left_margin_cols); |
643 right = margin_glyphs_to_reserve (w, dim.width, w->right_margin_width); | 643 right = margin_glyphs_to_reserve (w, dim.width, w->right_margin_cols); |
644 xassert (left >= 0 && right >= 0); | 644 xassert (left >= 0 && right >= 0); |
645 marginal_areas_changed_p = (left != matrix->left_margin_glyphs | 645 marginal_areas_changed_p = (left != matrix->left_margin_glyphs |
646 || right != matrix->right_margin_glyphs); | 646 || right != matrix->right_margin_glyphs); |
647 | 647 |
648 if (!marginal_areas_changed_p | 648 if (!marginal_areas_changed_p |
649 && !fonts_changed_p | 649 && !fonts_changed_p |
650 && !header_line_changed_p | 650 && !header_line_changed_p |
651 && matrix->window_left_x == XFASTINT (w->left) | 651 && matrix->window_left_col == WINDOW_LEFT_EDGE_COL (w) |
652 && matrix->window_top_y == XFASTINT (w->top) | 652 && matrix->window_top_line == WINDOW_TOP_EDGE_LINE (w) |
653 && matrix->window_height == window_height | 653 && matrix->window_height == window_height |
654 && matrix->window_vscroll == w->vscroll | 654 && matrix->window_vscroll == w->vscroll |
655 && matrix->window_width == window_width) | 655 && matrix->window_width == window_width) |
656 return; | 656 return; |
657 } | 657 } |
677 xassert (matrix->pool->glyphs); | 677 xassert (matrix->pool->glyphs); |
678 | 678 |
679 if (w) | 679 if (w) |
680 { | 680 { |
681 left = margin_glyphs_to_reserve (w, dim.width, | 681 left = margin_glyphs_to_reserve (w, dim.width, |
682 w->left_margin_width); | 682 w->left_margin_cols); |
683 right = margin_glyphs_to_reserve (w, dim.width, | 683 right = margin_glyphs_to_reserve (w, dim.width, |
684 w->right_margin_width); | 684 w->right_margin_cols); |
685 } | 685 } |
686 else | 686 else |
687 left = right = 0; | 687 left = right = 0; |
688 | 688 |
689 for (i = 0; i < dim.height; ++i) | 689 for (i = 0; i < dim.height; ++i) |
788 of the window. */ | 788 of the window. */ |
789 if (!marginal_areas_changed_p | 789 if (!marginal_areas_changed_p |
790 && !header_line_changed_p | 790 && !header_line_changed_p |
791 && new_rows == 0 | 791 && new_rows == 0 |
792 && dim.width == matrix->matrix_w | 792 && dim.width == matrix->matrix_w |
793 && matrix->window_left_x == XFASTINT (w->left) | 793 && matrix->window_left_col == WINDOW_LEFT_EDGE_COL (w) |
794 && matrix->window_top_y == XFASTINT (w->top) | 794 && matrix->window_top_line == WINDOW_TOP_EDGE_LINE (w) |
795 && matrix->window_width == window_width) | 795 && matrix->window_width == window_width) |
796 { | 796 { |
797 /* Find the last row in the window. */ | 797 /* Find the last row in the window. */ |
798 for (i = 0; i < matrix->nrows && matrix->rows[i].enabled_p; ++i) | 798 for (i = 0; i < matrix->nrows && matrix->rows[i].enabled_p; ++i) |
799 if (MATRIX_ROW_BOTTOM_Y (matrix->rows + i) >= window_height) | 799 if (MATRIX_ROW_BOTTOM_Y (matrix->rows + i) >= window_height) |
837 | 837 |
838 /* Record the top y location and height of W at the time the matrix | 838 /* Record the top y location and height of W at the time the matrix |
839 was last adjusted. This is used to optimize redisplay above. */ | 839 was last adjusted. This is used to optimize redisplay above. */ |
840 if (w) | 840 if (w) |
841 { | 841 { |
842 matrix->window_left_x = XFASTINT (w->left); | 842 matrix->window_left_col = WINDOW_LEFT_EDGE_COL (w); |
843 matrix->window_top_y = XFASTINT (w->top); | 843 matrix->window_top_line = WINDOW_TOP_EDGE_LINE (w); |
844 matrix->window_height = window_height; | 844 matrix->window_height = window_height; |
845 matrix->window_width = window_width; | 845 matrix->window_width = window_width; |
846 matrix->window_vscroll = w->vscroll; | 846 matrix->window_vscroll = w->vscroll; |
847 } | 847 } |
848 } | 848 } |
981 | 981 |
982 xassert (start <= end); | 982 xassert (start <= end); |
983 xassert (start >= 0 && start < matrix->nrows); | 983 xassert (start >= 0 && start < matrix->nrows); |
984 xassert (end >= 0 && end <= matrix->nrows); | 984 xassert (end >= 0 && end <= matrix->nrows); |
985 | 985 |
986 min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); | 986 min_y = WINDOW_HEADER_LINE_HEIGHT (w); |
987 max_y = WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE (w); | 987 max_y = WINDOW_BOX_HEIGHT_NO_MODE_LINE (w); |
988 | 988 |
989 for (; start < end; ++start) | 989 for (; start < end; ++start) |
990 { | 990 { |
991 struct glyph_row *row = &matrix->rows[start]; | 991 struct glyph_row *row = &matrix->rows[start]; |
992 | 992 |
1141 struct glyph_row *row; | 1141 struct glyph_row *row; |
1142 int y; | 1142 int y; |
1143 { | 1143 { |
1144 int min_y, max_y; | 1144 int min_y, max_y; |
1145 | 1145 |
1146 min_y = WINDOW_DISPLAY_HEADER_LINE_HEIGHT (w); | 1146 min_y = WINDOW_HEADER_LINE_HEIGHT (w); |
1147 max_y = WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE (w); | 1147 max_y = WINDOW_BOX_HEIGHT_NO_MODE_LINE (w); |
1148 | 1148 |
1149 clear_glyph_row (row); | 1149 clear_glyph_row (row); |
1150 row->y = y; | 1150 row->y = y; |
1151 row->ascent = row->phys_ascent = 0; | 1151 row->ascent = row->phys_ascent = 0; |
1152 row->height = row->phys_height = CANON_Y_UNIT (XFRAME (w->frame)); | 1152 row->height = row->phys_height = FRAME_LINE_HEIGHT (XFRAME (w->frame)); |
1153 row->visible_height = row->height; | 1153 row->visible_height = row->height; |
1154 | 1154 |
1155 if (row->y < min_y) | 1155 if (row->y < min_y) |
1156 row->visible_height -= min_y - row->y; | 1156 row->visible_height -= min_y - row->y; |
1157 if (row->y + row->height > max_y) | 1157 if (row->y + row->height > max_y) |
1903 if (x != w->desired_matrix->matrix_x | 1903 if (x != w->desired_matrix->matrix_x |
1904 || y != w->desired_matrix->matrix_y | 1904 || y != w->desired_matrix->matrix_y |
1905 || dim.width != w->desired_matrix->matrix_w | 1905 || dim.width != w->desired_matrix->matrix_w |
1906 || dim.height != w->desired_matrix->matrix_h | 1906 || dim.height != w->desired_matrix->matrix_h |
1907 || (margin_glyphs_to_reserve (w, dim.width, | 1907 || (margin_glyphs_to_reserve (w, dim.width, |
1908 w->right_margin_width) | 1908 w->right_margin_cols) |
1909 != w->desired_matrix->left_margin_glyphs) | 1909 != w->desired_matrix->left_margin_glyphs) |
1910 || (margin_glyphs_to_reserve (w, dim.width, | 1910 || (margin_glyphs_to_reserve (w, dim.width, |
1911 w->left_margin_width) | 1911 w->left_margin_cols) |
1912 != w->desired_matrix->right_margin_glyphs)) | 1912 != w->desired_matrix->right_margin_glyphs)) |
1913 *window_change_flags |= CHANGED_LEAF_MATRIX; | 1913 *window_change_flags |= CHANGED_LEAF_MATRIX; |
1914 | 1914 |
1915 /* Actually change matrices, if allowed. Do not consider | 1915 /* Actually change matrices, if allowed. Do not consider |
1916 CHANGED_LEAF_MATRIX computed above here because the pool | 1916 CHANGED_LEAF_MATRIX computed above here because the pool |
1983 /* 2 for header and mode line. */ | 1983 /* 2 for header and mode line. */ |
1984 + 2); | 1984 + 2); |
1985 } | 1985 } |
1986 #endif /* HAVE_WINDOW_SYSTEM */ | 1986 #endif /* HAVE_WINDOW_SYSTEM */ |
1987 | 1987 |
1988 return XINT (w->height); | 1988 return WINDOW_TOTAL_LINES (w); |
1989 } | 1989 } |
1990 | 1990 |
1991 | 1991 |
1992 /* Return the required width of glyph matrices for window W. */ | 1992 /* Return the required width of glyph matrices for window W. */ |
1993 | 1993 |
1998 #ifdef HAVE_WINDOW_SYSTEM | 1998 #ifdef HAVE_WINDOW_SYSTEM |
1999 struct frame *f = XFRAME (w->frame); | 1999 struct frame *f = XFRAME (w->frame); |
2000 if (FRAME_WINDOW_P (f)) | 2000 if (FRAME_WINDOW_P (f)) |
2001 { | 2001 { |
2002 int ch_width = FRAME_SMALLEST_CHAR_WIDTH (f); | 2002 int ch_width = FRAME_SMALLEST_CHAR_WIDTH (f); |
2003 int window_pixel_width = XFLOATINT (w->width) * CANON_X_UNIT (f); | 2003 int window_pixel_width = WINDOW_TOTAL_WIDTH (w); |
2004 | 2004 |
2005 /* Compute number of glyphs needed in a glyph row. */ | 2005 /* Compute number of glyphs needed in a glyph row. */ |
2006 return (((window_pixel_width + ch_width - 1) | 2006 return (((window_pixel_width + ch_width - 1) |
2007 / ch_width) | 2007 / ch_width) |
2008 /* 2 partially visible columns in the text area. */ | 2008 /* 2 partially visible columns in the text area. */ |
2011 edge of each marginal area. */ | 2011 edge of each marginal area. */ |
2012 + 1 + 1); | 2012 + 1 + 1); |
2013 } | 2013 } |
2014 #endif /* HAVE_WINDOW_SYSTEM */ | 2014 #endif /* HAVE_WINDOW_SYSTEM */ |
2015 | 2015 |
2016 return XINT (w->width); | 2016 return XINT (w->total_cols); |
2017 } | 2017 } |
2018 | 2018 |
2019 | 2019 |
2020 /* Allocate window matrices for window-based redisplay. W is the | 2020 /* Allocate window matrices for window-based redisplay. W is the |
2021 window whose matrices must be allocated/reallocated. CH_DIM is the | 2021 window whose matrices must be allocated/reallocated. CH_DIM is the |
2096 adjust_frame_glyphs_initially () | 2096 adjust_frame_glyphs_initially () |
2097 { | 2097 { |
2098 struct frame *sf = SELECTED_FRAME (); | 2098 struct frame *sf = SELECTED_FRAME (); |
2099 struct window *root = XWINDOW (sf->root_window); | 2099 struct window *root = XWINDOW (sf->root_window); |
2100 struct window *mini = XWINDOW (root->next); | 2100 struct window *mini = XWINDOW (root->next); |
2101 int frame_height = FRAME_HEIGHT (sf); | 2101 int frame_lines = FRAME_LINES (sf); |
2102 int frame_width = FRAME_WIDTH (sf); | 2102 int frame_cols = FRAME_COLS (sf); |
2103 int top_margin = FRAME_TOP_MARGIN (sf); | 2103 int top_margin = FRAME_TOP_MARGIN (sf); |
2104 | 2104 |
2105 /* Do it for the root window. */ | 2105 /* Do it for the root window. */ |
2106 XSETFASTINT (root->top, top_margin); | 2106 XSETFASTINT (root->top_line, top_margin); |
2107 XSETFASTINT (root->width, frame_width); | 2107 XSETFASTINT (root->total_cols, frame_cols); |
2108 set_window_height (sf->root_window, frame_height - 1 - top_margin, 0); | 2108 set_window_height (sf->root_window, frame_lines - 1 - top_margin, 0); |
2109 | 2109 |
2110 /* Do it for the mini-buffer window. */ | 2110 /* Do it for the mini-buffer window. */ |
2111 XSETFASTINT (mini->top, frame_height - 1); | 2111 XSETFASTINT (mini->top_line, frame_lines - 1); |
2112 XSETFASTINT (mini->width, frame_width); | 2112 XSETFASTINT (mini->total_cols, frame_cols); |
2113 set_window_height (root->next, 1, 0); | 2113 set_window_height (root->next, 1, 0); |
2114 | 2114 |
2115 adjust_frame_glyphs (sf); | 2115 adjust_frame_glyphs (sf); |
2116 glyphs_initialized_initially_p = 1; | 2116 glyphs_initialized_initially_p = 1; |
2117 } | 2117 } |
2159 int i; | 2159 int i; |
2160 struct frame *f = XFRAME (w->frame); | 2160 struct frame *f = XFRAME (w->frame); |
2161 struct glyph_matrix *m = w->current_matrix; | 2161 struct glyph_matrix *m = w->current_matrix; |
2162 struct glyph_matrix *fm = f->current_matrix; | 2162 struct glyph_matrix *fm = f->current_matrix; |
2163 | 2163 |
2164 xassert (m->matrix_h == XFASTINT (w->height)); | 2164 xassert (m->matrix_h == WINDOW_TOTAL_LINES (w)); |
2165 xassert (m->matrix_w == XFASTINT (w->width)); | 2165 xassert (m->matrix_w == WINDOW_TOTAL_COLS (w)); |
2166 | 2166 |
2167 for (i = 0; i < m->matrix_h; ++i) | 2167 for (i = 0; i < m->matrix_h; ++i) |
2168 { | 2168 { |
2169 struct glyph_row *r = m->rows + i; | 2169 struct glyph_row *r = m->rows + i; |
2170 struct glyph_row *fr = fm->rows + i + XFASTINT (w->top); | 2170 struct glyph_row *fr = fm->rows + i + WINDOW_TOP_EDGE_LINE (w); |
2171 | 2171 |
2172 xassert (r->glyphs[TEXT_AREA] >= fr->glyphs[TEXT_AREA] | 2172 xassert (r->glyphs[TEXT_AREA] >= fr->glyphs[TEXT_AREA] |
2173 && r->glyphs[LAST_AREA] <= fr->glyphs[LAST_AREA]); | 2173 && r->glyphs[LAST_AREA] <= fr->glyphs[LAST_AREA]); |
2174 | 2174 |
2175 r->enabled_p = fr->enabled_p; | 2175 r->enabled_p = fr->enabled_p; |
2311 &window_change_flags); | 2311 &window_change_flags); |
2312 | 2312 |
2313 /* Size of frame matrices must equal size of frame. Note | 2313 /* Size of frame matrices must equal size of frame. Note |
2314 that we are called for X frames with window widths NOT equal | 2314 that we are called for X frames with window widths NOT equal |
2315 to the frame width (from CHANGE_FRAME_SIZE_1). */ | 2315 to the frame width (from CHANGE_FRAME_SIZE_1). */ |
2316 xassert (matrix_dim.width == FRAME_WIDTH (f) | 2316 xassert (matrix_dim.width == FRAME_COLS (f) |
2317 && matrix_dim.height == FRAME_HEIGHT (f)); | 2317 && matrix_dim.height == FRAME_LINES (f)); |
2318 | 2318 |
2319 /* Pointers to glyph memory in glyph rows are exchanged during | 2319 /* Pointers to glyph memory in glyph rows are exchanged during |
2320 the update phase of redisplay, which means in general that a | 2320 the update phase of redisplay, which means in general that a |
2321 frame's current matrix consists of pointers into both the | 2321 frame's current matrix consists of pointers into both the |
2322 desired and current glyph pool of the frame. Adjusting a | 2322 desired and current glyph pool of the frame. Adjusting a |
2384 else | 2384 else |
2385 w = XWINDOW (f->menu_bar_window); | 2385 w = XWINDOW (f->menu_bar_window); |
2386 | 2386 |
2387 /* Set window dimensions to frame dimensions and allocate or | 2387 /* Set window dimensions to frame dimensions and allocate or |
2388 adjust glyph matrices of W. */ | 2388 adjust glyph matrices of W. */ |
2389 XSETFASTINT (w->top, 0); | 2389 XSETFASTINT (w->top_line, 0); |
2390 XSETFASTINT (w->left, 0); | 2390 XSETFASTINT (w->left_col, 0); |
2391 XSETFASTINT (w->height, FRAME_MENU_BAR_LINES (f)); | 2391 XSETFASTINT (w->total_lines, FRAME_MENU_BAR_LINES (f)); |
2392 XSETFASTINT (w->width, FRAME_WINDOW_WIDTH (f)); | 2392 XSETFASTINT (w->total_cols, FRAME_TOTAL_COLS (f)); |
2393 allocate_matrices_for_window_redisplay (w); | 2393 allocate_matrices_for_window_redisplay (w); |
2394 } | 2394 } |
2395 #endif /* not USE_X_TOOLKIT */ | 2395 #endif /* not USE_X_TOOLKIT */ |
2396 | 2396 |
2397 #ifndef USE_GTK | 2397 #ifndef USE_GTK |
2405 w->pseudo_window_p = 1; | 2405 w->pseudo_window_p = 1; |
2406 } | 2406 } |
2407 else | 2407 else |
2408 w = XWINDOW (f->tool_bar_window); | 2408 w = XWINDOW (f->tool_bar_window); |
2409 | 2409 |
2410 XSETFASTINT (w->top, FRAME_MENU_BAR_LINES (f)); | 2410 XSETFASTINT (w->top_line, FRAME_MENU_BAR_LINES (f)); |
2411 XSETFASTINT (w->left, 0); | 2411 XSETFASTINT (w->left_col, 0); |
2412 XSETFASTINT (w->height, FRAME_TOOL_BAR_LINES (f)); | 2412 XSETFASTINT (w->total_lines, FRAME_TOOL_BAR_LINES (f)); |
2413 XSETFASTINT (w->width, FRAME_WINDOW_WIDTH (f)); | 2413 XSETFASTINT (w->total_cols, FRAME_TOTAL_COLS (f)); |
2414 allocate_matrices_for_window_redisplay (w); | 2414 allocate_matrices_for_window_redisplay (w); |
2415 #endif | 2415 #endif |
2416 } | 2416 } |
2417 | 2417 |
2418 | 2418 |
3020 | 3020 |
3021 /* Preconditions: W must be a leaf window on a tty frame. */ | 3021 /* Preconditions: W must be a leaf window on a tty frame. */ |
3022 xassert (NILP (w->hchild) && NILP (w->vchild)); | 3022 xassert (NILP (w->hchild) && NILP (w->vchild)); |
3023 xassert (!FRAME_WINDOW_P (f)); | 3023 xassert (!FRAME_WINDOW_P (f)); |
3024 | 3024 |
3025 left = margin_glyphs_to_reserve (w, 1, w->left_margin_width); | 3025 left = margin_glyphs_to_reserve (w, 1, w->left_margin_cols); |
3026 right = margin_glyphs_to_reserve (w, 1, w->right_margin_width); | 3026 right = margin_glyphs_to_reserve (w, 1, w->right_margin_cols); |
3027 x = w->current_matrix->matrix_x; | 3027 x = w->current_matrix->matrix_x; |
3028 width = w->current_matrix->matrix_w; | 3028 width = w->current_matrix->matrix_w; |
3029 | 3029 |
3030 window_row = w->current_matrix->rows; | 3030 window_row = w->current_matrix->rows; |
3031 window_row_end = window_row + w->current_matrix->nrows; | 3031 window_row_end = window_row + w->current_matrix->nrows; |
3032 frame_row = f->current_matrix->rows + XFASTINT (w->top); | 3032 frame_row = f->current_matrix->rows + WINDOW_TOP_EDGE_LINE (w); |
3033 | 3033 |
3034 for (; window_row < window_row_end; ++window_row, ++frame_row) | 3034 for (; window_row < window_row_end; ++window_row, ++frame_row) |
3035 { | 3035 { |
3036 window_row->glyphs[LEFT_MARGIN_AREA] | 3036 window_row->glyphs[LEFT_MARGIN_AREA] |
3037 = frame_row->glyphs[0] + x; | 3037 = frame_row->glyphs[0] + x; |
3059 { | 3059 { |
3060 if (!NILP (w->hchild)) | 3060 if (!NILP (w->hchild)) |
3061 found = frame_row_to_window (XWINDOW (w->hchild), row); | 3061 found = frame_row_to_window (XWINDOW (w->hchild), row); |
3062 else if (!NILP (w->vchild)) | 3062 else if (!NILP (w->vchild)) |
3063 found = frame_row_to_window (XWINDOW (w->vchild), row); | 3063 found = frame_row_to_window (XWINDOW (w->vchild), row); |
3064 else if (row >= XFASTINT (w->top) | 3064 else if (row >= WINDOW_TOP_EDGE_LINE (w) |
3065 && row < XFASTINT (w->top) + XFASTINT (w->height)) | 3065 && row < WINDOW_BOTTOM_EDGE_LINE (w)) |
3066 found = w; | 3066 found = w; |
3067 | 3067 |
3068 w = NILP (w->next) ? 0 : XWINDOW (w->next); | 3068 w = NILP (w->next) ? 0 : XWINDOW (w->next); |
3069 } | 3069 } |
3070 | 3070 |
3265 { | 3265 { |
3266 struct frame *f = XFRAME (w->frame); | 3266 struct frame *f = XFRAME (w->frame); |
3267 | 3267 |
3268 xassert (!FRAME_WINDOW_P (f)); | 3268 xassert (!FRAME_WINDOW_P (f)); |
3269 xassert (vpos >= 0 && vpos <= w->desired_matrix->nrows); | 3269 xassert (vpos >= 0 && vpos <= w->desired_matrix->nrows); |
3270 vpos += XFASTINT (w->top); | 3270 vpos += WINDOW_TOP_EDGE_LINE (w); |
3271 xassert (vpos >= 0 && vpos <= FRAME_HEIGHT (f)); | 3271 xassert (vpos >= 0 && vpos <= FRAME_LINES (f)); |
3272 return vpos; | 3272 return vpos; |
3273 } | 3273 } |
3274 | 3274 |
3275 | 3275 |
3276 /* Translate horizontal position HPOS which is relative to window W to | 3276 /* Translate horizontal position HPOS which is relative to window W to |
3282 int hpos; | 3282 int hpos; |
3283 { | 3283 { |
3284 struct frame *f = XFRAME (w->frame); | 3284 struct frame *f = XFRAME (w->frame); |
3285 | 3285 |
3286 xassert (!FRAME_WINDOW_P (f)); | 3286 xassert (!FRAME_WINDOW_P (f)); |
3287 hpos += XFASTINT (w->left); | 3287 hpos += WINDOW_LEFT_EDGE_COL (w); |
3288 return hpos; | 3288 return hpos; |
3289 } | 3289 } |
3290 | 3290 |
3291 #endif /* GLYPH_DEBUG */ | 3291 #endif /* GLYPH_DEBUG */ |
3292 | 3292 |
3642 w->cursor.y, w->cursor.x); | 3642 w->cursor.y, w->cursor.x); |
3643 else | 3643 else |
3644 { | 3644 { |
3645 int x, y; | 3645 int x, y; |
3646 x = (WINDOW_TO_FRAME_HPOS (w, w->cursor.hpos) | 3646 x = (WINDOW_TO_FRAME_HPOS (w, w->cursor.hpos) |
3647 + (INTEGERP (w->left_margin_width) | 3647 + (INTEGERP (w->left_margin_cols) |
3648 ? XFASTINT (w->left_margin_width) | 3648 ? XFASTINT (w->left_margin_cols) |
3649 : 0)); | 3649 : 0)); |
3650 y = WINDOW_TO_FRAME_VPOS (w, w->cursor.vpos); | 3650 y = WINDOW_TO_FRAME_VPOS (w, w->cursor.vpos); |
3651 cursor_to (y, x); | 3651 cursor_to (y, x); |
3652 } | 3652 } |
3653 | 3653 |
3737 w->cursor.y, w->cursor.x); | 3737 w->cursor.y, w->cursor.x); |
3738 else | 3738 else |
3739 { | 3739 { |
3740 int x, y; | 3740 int x, y; |
3741 x = (WINDOW_TO_FRAME_HPOS (w, w->cursor.hpos) | 3741 x = (WINDOW_TO_FRAME_HPOS (w, w->cursor.hpos) |
3742 + (INTEGERP (w->left_margin_width) | 3742 + (INTEGERP (w->left_margin_cols) |
3743 ? XFASTINT (w->left_margin_width) | 3743 ? XFASTINT (w->left_margin_cols) |
3744 : 0)); | 3744 : 0)); |
3745 y = WINDOW_TO_FRAME_VPOS (w, w->cursor.vpos); | 3745 y = WINDOW_TO_FRAME_VPOS (w, w->cursor.vpos); |
3746 cursor_to (y, x); | 3746 cursor_to (y, x); |
3747 } | 3747 } |
3748 | 3748 |
4478 { | 4478 { |
4479 xassert (desired_row->enabled_p); | 4479 xassert (desired_row->enabled_p); |
4480 | 4480 |
4481 /* Update display of the left margin area, if there is one. */ | 4481 /* Update display of the left margin area, if there is one. */ |
4482 if (!desired_row->full_width_p | 4482 if (!desired_row->full_width_p |
4483 && !NILP (w->left_margin_width)) | 4483 && !NILP (w->left_margin_cols)) |
4484 { | 4484 { |
4485 changed_p = 1; | 4485 changed_p = 1; |
4486 update_marginal_area (w, LEFT_MARGIN_AREA, vpos); | 4486 update_marginal_area (w, LEFT_MARGIN_AREA, vpos); |
4487 } | 4487 } |
4488 | 4488 |
4494 *mouse_face_overwritten_p = 1; | 4494 *mouse_face_overwritten_p = 1; |
4495 } | 4495 } |
4496 | 4496 |
4497 /* Update display of the right margin area, if there is one. */ | 4497 /* Update display of the right margin area, if there is one. */ |
4498 if (!desired_row->full_width_p | 4498 if (!desired_row->full_width_p |
4499 && !NILP (w->right_margin_width)) | 4499 && !NILP (w->right_margin_cols)) |
4500 { | 4500 { |
4501 changed_p = 1; | 4501 changed_p = 1; |
4502 update_marginal_area (w, RIGHT_MARGIN_AREA, vpos); | 4502 update_marginal_area (w, RIGHT_MARGIN_AREA, vpos); |
4503 } | 4503 } |
4504 | 4504 |
5124 | 5124 |
5125 update_frame_line (f, i); | 5125 update_frame_line (f, i); |
5126 } | 5126 } |
5127 } | 5127 } |
5128 | 5128 |
5129 pause = (i < FRAME_HEIGHT (f) - 1) ? i : 0; | 5129 pause = (i < FRAME_LINES (f) - 1) ? i : 0; |
5130 | 5130 |
5131 /* Now just clean up termcap drivers and set cursor, etc. */ | 5131 /* Now just clean up termcap drivers and set cursor, etc. */ |
5132 if (!pause) | 5132 if (!pause) |
5133 { | 5133 { |
5134 if ((cursor_in_echo_area | 5134 if ((cursor_in_echo_area |
5141 /* These cases apply only to the frame that contains | 5141 /* These cases apply only to the frame that contains |
5142 the active mini-buffer window. */ | 5142 the active mini-buffer window. */ |
5143 && FRAME_HAS_MINIBUF_P (f) | 5143 && FRAME_HAS_MINIBUF_P (f) |
5144 && EQ (FRAME_MINIBUF_WINDOW (f), echo_area_window)) | 5144 && EQ (FRAME_MINIBUF_WINDOW (f), echo_area_window)) |
5145 { | 5145 { |
5146 int top = XINT (XWINDOW (FRAME_MINIBUF_WINDOW (f))->top); | 5146 int top = WINDOW_TOP_EDGE_LINE (XWINDOW (FRAME_MINIBUF_WINDOW (f))); |
5147 int row, col; | 5147 int row, col; |
5148 | 5148 |
5149 if (cursor_in_echo_area < 0) | 5149 if (cursor_in_echo_area < 0) |
5150 { | 5150 { |
5151 /* Negative value of cursor_in_echo_area means put | 5151 /* Negative value of cursor_in_echo_area means put |
5157 { | 5157 { |
5158 /* Positive value of cursor_in_echo_area means put | 5158 /* Positive value of cursor_in_echo_area means put |
5159 cursor at the end of the prompt. If the mini-buffer | 5159 cursor at the end of the prompt. If the mini-buffer |
5160 is several lines high, find the last line that has | 5160 is several lines high, find the last line that has |
5161 any text on it. */ | 5161 any text on it. */ |
5162 row = FRAME_HEIGHT (f); | 5162 row = FRAME_LINES (f); |
5163 do | 5163 do |
5164 { | 5164 { |
5165 --row; | 5165 --row; |
5166 col = 0; | 5166 col = 0; |
5167 | 5167 |
5185 | 5185 |
5186 /* Make sure COL is not out of range. */ | 5186 /* Make sure COL is not out of range. */ |
5187 if (col >= FRAME_CURSOR_X_LIMIT (f)) | 5187 if (col >= FRAME_CURSOR_X_LIMIT (f)) |
5188 { | 5188 { |
5189 /* If we have another row, advance cursor into it. */ | 5189 /* If we have another row, advance cursor into it. */ |
5190 if (row < FRAME_HEIGHT (f) - 1) | 5190 if (row < FRAME_LINES (f) - 1) |
5191 { | 5191 { |
5192 col = FRAME_LEFT_SCROLL_BAR_WIDTH (f); | 5192 col = FRAME_LEFT_SCROLL_BAR_COLS (f); |
5193 row++; | 5193 row++; |
5194 } | 5194 } |
5195 /* Otherwise move it back in range. */ | 5195 /* Otherwise move it back in range. */ |
5196 else | 5196 else |
5197 col = FRAME_CURSOR_X_LIMIT (f) - 1; | 5197 col = FRAME_CURSOR_X_LIMIT (f) - 1; |
5209 /* The cursor vpos may be temporarily out of bounds | 5209 /* The cursor vpos may be temporarily out of bounds |
5210 in the following situation: There is one window, | 5210 in the following situation: There is one window, |
5211 with the cursor in the lower half of it. The window | 5211 with the cursor in the lower half of it. The window |
5212 is split, and a message causes a redisplay before | 5212 is split, and a message causes a redisplay before |
5213 a new cursor position has been computed. */ | 5213 a new cursor position has been computed. */ |
5214 && w->cursor.vpos < XFASTINT (w->height)) | 5214 && w->cursor.vpos < WINDOW_TOTAL_LINES (w)) |
5215 { | 5215 { |
5216 int x = WINDOW_TO_FRAME_HPOS (w, w->cursor.hpos); | 5216 int x = WINDOW_TO_FRAME_HPOS (w, w->cursor.hpos); |
5217 int y = WINDOW_TO_FRAME_VPOS (w, w->cursor.vpos); | 5217 int y = WINDOW_TO_FRAME_VPOS (w, w->cursor.vpos); |
5218 | 5218 |
5219 if (INTEGERP (w->left_margin_width)) | 5219 if (INTEGERP (w->left_margin_cols)) |
5220 x += XFASTINT (w->left_margin_width); | 5220 x += XFASTINT (w->left_margin_cols); |
5221 | 5221 |
5222 /* x = max (min (x, FRAME_WINDOW_WIDTH (f) - 1), 0); */ | 5222 /* x = max (min (x, FRAME_TOTAL_COLS (f) - 1), 0); */ |
5223 cursor_to (y, x); | 5223 cursor_to (y, x); |
5224 } | 5224 } |
5225 } | 5225 } |
5226 } | 5226 } |
5227 | 5227 |
5239 struct frame *frame; | 5239 struct frame *frame; |
5240 { | 5240 { |
5241 int unchanged_at_top, unchanged_at_bottom; | 5241 int unchanged_at_top, unchanged_at_bottom; |
5242 int window_size; | 5242 int window_size; |
5243 int changed_lines; | 5243 int changed_lines; |
5244 int *old_hash = (int *) alloca (FRAME_HEIGHT (frame) * sizeof (int)); | 5244 int *old_hash = (int *) alloca (FRAME_LINES (frame) * sizeof (int)); |
5245 int *new_hash = (int *) alloca (FRAME_HEIGHT (frame) * sizeof (int)); | 5245 int *new_hash = (int *) alloca (FRAME_LINES (frame) * sizeof (int)); |
5246 int *draw_cost = (int *) alloca (FRAME_HEIGHT (frame) * sizeof (int)); | 5246 int *draw_cost = (int *) alloca (FRAME_LINES (frame) * sizeof (int)); |
5247 int *old_draw_cost = (int *) alloca (FRAME_HEIGHT (frame) * sizeof (int)); | 5247 int *old_draw_cost = (int *) alloca (FRAME_LINES (frame) * sizeof (int)); |
5248 register int i; | 5248 register int i; |
5249 int free_at_end_vpos = FRAME_HEIGHT (frame); | 5249 int free_at_end_vpos = FRAME_LINES (frame); |
5250 struct glyph_matrix *current_matrix = frame->current_matrix; | 5250 struct glyph_matrix *current_matrix = frame->current_matrix; |
5251 struct glyph_matrix *desired_matrix = frame->desired_matrix; | 5251 struct glyph_matrix *desired_matrix = frame->desired_matrix; |
5252 | 5252 |
5253 if (!current_matrix) | 5253 if (!current_matrix) |
5254 abort (); | 5254 abort (); |
5256 /* Compute hash codes of all the lines. Also calculate number of | 5256 /* Compute hash codes of all the lines. Also calculate number of |
5257 changed lines, number of unchanged lines at the beginning, and | 5257 changed lines, number of unchanged lines at the beginning, and |
5258 number of unchanged lines at the end. */ | 5258 number of unchanged lines at the end. */ |
5259 changed_lines = 0; | 5259 changed_lines = 0; |
5260 unchanged_at_top = 0; | 5260 unchanged_at_top = 0; |
5261 unchanged_at_bottom = FRAME_HEIGHT (frame); | 5261 unchanged_at_bottom = FRAME_LINES (frame); |
5262 for (i = 0; i < FRAME_HEIGHT (frame); i++) | 5262 for (i = 0; i < FRAME_LINES (frame); i++) |
5263 { | 5263 { |
5264 /* Give up on this scrolling if some old lines are not enabled. */ | 5264 /* Give up on this scrolling if some old lines are not enabled. */ |
5265 if (!MATRIX_ROW_ENABLED_P (current_matrix, i)) | 5265 if (!MATRIX_ROW_ENABLED_P (current_matrix, i)) |
5266 return 0; | 5266 return 0; |
5267 old_hash[i] = line_hash_code (MATRIX_ROW (current_matrix, i)); | 5267 old_hash[i] = line_hash_code (MATRIX_ROW (current_matrix, i)); |
5279 } | 5279 } |
5280 | 5280 |
5281 if (old_hash[i] != new_hash[i]) | 5281 if (old_hash[i] != new_hash[i]) |
5282 { | 5282 { |
5283 changed_lines++; | 5283 changed_lines++; |
5284 unchanged_at_bottom = FRAME_HEIGHT (frame) - i - 1; | 5284 unchanged_at_bottom = FRAME_LINES (frame) - i - 1; |
5285 } | 5285 } |
5286 else if (i == unchanged_at_top) | 5286 else if (i == unchanged_at_top) |
5287 unchanged_at_top++; | 5287 unchanged_at_top++; |
5288 old_draw_cost[i] = line_draw_cost (current_matrix, i); | 5288 old_draw_cost[i] = line_draw_cost (current_matrix, i); |
5289 } | 5289 } |
5290 | 5290 |
5291 /* If changed lines are few, don't allow preemption, don't scroll. */ | 5291 /* If changed lines are few, don't allow preemption, don't scroll. */ |
5292 if ((!scroll_region_ok && changed_lines < baud_rate / 2400) | 5292 if ((!scroll_region_ok && changed_lines < baud_rate / 2400) |
5293 || unchanged_at_bottom == FRAME_HEIGHT (frame)) | 5293 || unchanged_at_bottom == FRAME_LINES (frame)) |
5294 return 1; | 5294 return 1; |
5295 | 5295 |
5296 window_size = (FRAME_HEIGHT (frame) - unchanged_at_top | 5296 window_size = (FRAME_LINES (frame) - unchanged_at_top |
5297 - unchanged_at_bottom); | 5297 - unchanged_at_bottom); |
5298 | 5298 |
5299 if (scroll_region_ok) | 5299 if (scroll_region_ok) |
5300 free_at_end_vpos -= unchanged_at_bottom; | 5300 free_at_end_vpos -= unchanged_at_bottom; |
5301 else if (memory_below_frame) | 5301 else if (memory_below_frame) |
5304 /* If large window, fast terminal and few lines in common between | 5304 /* If large window, fast terminal and few lines in common between |
5305 current frame and desired frame, don't bother with i/d calc. */ | 5305 current frame and desired frame, don't bother with i/d calc. */ |
5306 if (!scroll_region_ok && window_size >= 18 && baud_rate > 2400 | 5306 if (!scroll_region_ok && window_size >= 18 && baud_rate > 2400 |
5307 && (window_size >= | 5307 && (window_size >= |
5308 10 * scrolling_max_lines_saved (unchanged_at_top, | 5308 10 * scrolling_max_lines_saved (unchanged_at_top, |
5309 FRAME_HEIGHT (frame) - unchanged_at_bottom, | 5309 FRAME_LINES (frame) - unchanged_at_bottom, |
5310 old_hash, new_hash, draw_cost))) | 5310 old_hash, new_hash, draw_cost))) |
5311 return 0; | 5311 return 0; |
5312 | 5312 |
5313 if (window_size < 2) | 5313 if (window_size < 2) |
5314 return 0; | 5314 return 0; |
5363 | 5363 |
5364 | 5364 |
5365 /* Char insertion/deletion cost vector, from term.c */ | 5365 /* Char insertion/deletion cost vector, from term.c */ |
5366 | 5366 |
5367 extern int *char_ins_del_vector; | 5367 extern int *char_ins_del_vector; |
5368 #define char_ins_del_cost(f) (&char_ins_del_vector[FRAME_WINDOW_WIDTH((f))]) | 5368 #define char_ins_del_cost(f) (&char_ins_del_vector[FRAME_TOTAL_COLS((f))]) |
5369 | 5369 |
5370 | 5370 |
5371 /* Perform a frame-based update on line VPOS in frame FRAME. */ | 5371 /* Perform a frame-based update on line VPOS in frame FRAME. */ |
5372 | 5372 |
5373 static void | 5373 static void |
5439 } | 5439 } |
5440 | 5440 |
5441 /* Don't call clear_end_of_line if we already wrote the whole | 5441 /* Don't call clear_end_of_line if we already wrote the whole |
5442 line. The cursor will not be at the right margin in that | 5442 line. The cursor will not be at the right margin in that |
5443 case but in the line below. */ | 5443 case but in the line below. */ |
5444 if (nlen < FRAME_WINDOW_WIDTH (f)) | 5444 if (nlen < FRAME_TOTAL_COLS (f)) |
5445 { | 5445 { |
5446 cursor_to (vpos, nlen); | 5446 cursor_to (vpos, nlen); |
5447 clear_end_of_line (FRAME_WINDOW_WIDTH (f)); | 5447 clear_end_of_line (FRAME_TOTAL_COLS (f)); |
5448 } | 5448 } |
5449 else | 5449 else |
5450 /* Make sure we are in the right row, otherwise cursor movement | 5450 /* Make sure we are in the right row, otherwise cursor movement |
5451 with cmgoto might use `ch' in the wrong row. */ | 5451 with cmgoto might use `ch' in the wrong row. */ |
5452 cursor_to (vpos, 0); | 5452 cursor_to (vpos, 0); |
5613 { | 5613 { |
5614 /* If new text being written reaches right margin, there is | 5614 /* If new text being written reaches right margin, there is |
5615 no need to do clear-to-eol at the end of this function | 5615 no need to do clear-to-eol at the end of this function |
5616 (and it would not be safe, since cursor is not going to | 5616 (and it would not be safe, since cursor is not going to |
5617 be "at the margin" after the text is done). */ | 5617 be "at the margin" after the text is done). */ |
5618 if (nlen == FRAME_WINDOW_WIDTH (f)) | 5618 if (nlen == FRAME_TOTAL_COLS (f)) |
5619 olen = 0; | 5619 olen = 0; |
5620 | 5620 |
5621 /* Function write_glyphs is prepared to do nothing | 5621 /* Function write_glyphs is prepared to do nothing |
5622 if passed a length <= 0. Check it here to avoid | 5622 if passed a length <= 0. Check it here to avoid |
5623 unnecessary cursor movement. */ | 5623 unnecessary cursor movement. */ |
5703 SET_TEXT_POS_FROM_MARKER (startp, w->start); | 5703 SET_TEXT_POS_FROM_MARKER (startp, w->start); |
5704 CHARPOS (startp) = min (ZV, max (BEGV, CHARPOS (startp))); | 5704 CHARPOS (startp) = min (ZV, max (BEGV, CHARPOS (startp))); |
5705 BYTEPOS (startp) = min (ZV_BYTE, max (BEGV_BYTE, BYTEPOS (startp))); | 5705 BYTEPOS (startp) = min (ZV_BYTE, max (BEGV_BYTE, BYTEPOS (startp))); |
5706 start_display (&it, w, startp); | 5706 start_display (&it, w, startp); |
5707 | 5707 |
5708 left_area_width = WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH (w); | 5708 left_area_width = WINDOW_LEFT_MARGIN_WIDTH (w); |
5709 move_it_to (&it, -1, *x + it.first_visible_x - left_area_width, *y, -1, | 5709 move_it_to (&it, -1, *x + it.first_visible_x - left_area_width, *y, -1, |
5710 MOVE_TO_X | MOVE_TO_Y); | 5710 MOVE_TO_X | MOVE_TO_Y); |
5711 | 5711 |
5712 *x = it.current_x - it.first_visible_x + left_area_width; | 5712 *x = it.current_x - it.first_visible_x + left_area_width; |
5713 *y = it.current_y; | 5713 *y = it.current_y; |
5741 else | 5741 else |
5742 row = MATRIX_HEADER_LINE_ROW (w->current_matrix); | 5742 row = MATRIX_HEADER_LINE_ROW (w->current_matrix); |
5743 | 5743 |
5744 if (row->mode_line_p && row->enabled_p) | 5744 if (row->mode_line_p && row->enabled_p) |
5745 { | 5745 { |
5746 /* The mode lines are displayed over scroll bars and fringes, | |
5747 and X is window-relative. Correct X by the scroll bar | |
5748 and fringe width. */ | |
5749 if (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (f)) | |
5750 x += FRAME_SCROLL_BAR_COLS (f) * CANON_X_UNIT (f); | |
5751 x += FRAME_LEFT_FRINGE_WIDTH (f); | |
5752 | |
5753 /* Find the glyph under X. If we find one with a string object, | 5746 /* Find the glyph under X. If we find one with a string object, |
5754 it's the one we were looking for. */ | 5747 it's the one we were looking for. */ |
5755 glyph = row->glyphs[TEXT_AREA]; | 5748 glyph = row->glyphs[TEXT_AREA]; |
5756 end = glyph + row->used[TEXT_AREA]; | 5749 end = glyph + row->used[TEXT_AREA]; |
5757 for (x0 = 0; glyph < end; x0 += glyph->pixel_width, ++glyph) | 5750 for (x0 = 0; glyph < end; x0 += glyph->pixel_width, ++glyph) |
5799 { | 5792 { |
5800 /* Find the glyph under X. If we find one with a string object, | 5793 /* Find the glyph under X. If we find one with a string object, |
5801 it's the one we were looking for. */ | 5794 it's the one we were looking for. */ |
5802 glyph = row->glyphs[area]; | 5795 glyph = row->glyphs[area]; |
5803 end = glyph + row->used[area]; | 5796 end = glyph + row->used[area]; |
5797 | |
5804 if (area == RIGHT_MARGIN_AREA) | 5798 if (area == RIGHT_MARGIN_AREA) |
5805 x0 = (window_box_width (w, TEXT_AREA) | 5799 x0 = ((WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) |
5806 + window_box_width (w, LEFT_MARGIN_AREA)); | 5800 ? WINDOW_LEFT_FRINGE_WIDTH (w) |
5801 : WINDOW_TOTAL_FRINGE_WIDTH (w)) | |
5802 + window_box_width (w, LEFT_MARGIN_AREA) | |
5803 + window_box_width (w, TEXT_AREA)); | |
5807 else | 5804 else |
5808 x0 = 0; | 5805 x0 = (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) |
5806 ? WINDOW_LEFT_FRINGE_WIDTH (w) | |
5807 : 0); | |
5808 | |
5809 for (; glyph < end; x0 += glyph->pixel_width, ++glyph) | 5809 for (; glyph < end; x0 += glyph->pixel_width, ++glyph) |
5810 if (x >= x0 && x < x0 + glyph->pixel_width) | 5810 if (x >= x0 && x < x0 + glyph->pixel_width) |
5811 { | 5811 { |
5812 string = glyph->object; | 5812 string = glyph->object; |
5813 *charpos = glyph->charpos; | 5813 *charpos = glyph->charpos; |
5883 | 5883 |
5884 FOR_EACH_FRAME (tail, frame) | 5884 FOR_EACH_FRAME (tail, frame) |
5885 { | 5885 { |
5886 struct frame *f = XFRAME (frame); | 5886 struct frame *f = XFRAME (frame); |
5887 | 5887 |
5888 int height = FRAME_NEW_HEIGHT (f); | 5888 if (f->new_text_lines != 0 || f->new_text_cols != 0) |
5889 int width = FRAME_NEW_WIDTH (f); | 5889 change_frame_size (f, f->new_text_lines, f->new_text_cols, |
5890 | 5890 0, 0, safe); |
5891 if (height != 0 || width != 0) | |
5892 change_frame_size (f, height, width, 0, 0, safe); | |
5893 } | 5891 } |
5894 } | 5892 } |
5895 } | 5893 } |
5896 | 5894 |
5897 | 5895 |
5929 static void | 5927 static void |
5930 change_frame_size_1 (f, newheight, newwidth, pretend, delay, safe) | 5928 change_frame_size_1 (f, newheight, newwidth, pretend, delay, safe) |
5931 register struct frame *f; | 5929 register struct frame *f; |
5932 int newheight, newwidth, pretend, delay, safe; | 5930 int newheight, newwidth, pretend, delay, safe; |
5933 { | 5931 { |
5934 int new_frame_window_width; | 5932 int new_frame_total_cols; |
5935 int count = SPECPDL_INDEX (); | 5933 int count = SPECPDL_INDEX (); |
5936 | 5934 |
5937 /* If we can't deal with the change now, queue it for later. */ | 5935 /* If we can't deal with the change now, queue it for later. */ |
5938 if (delay || (redisplaying_p && !safe)) | 5936 if (delay || (redisplaying_p && !safe)) |
5939 { | 5937 { |
5940 FRAME_NEW_HEIGHT (f) = newheight; | 5938 f->new_text_lines = newheight; |
5941 FRAME_NEW_WIDTH (f) = newwidth; | 5939 f->new_text_cols = newwidth; |
5942 delayed_size_change = 1; | 5940 delayed_size_change = 1; |
5943 return; | 5941 return; |
5944 } | 5942 } |
5945 | 5943 |
5946 /* This size-change overrides any pending one for this frame. */ | 5944 /* This size-change overrides any pending one for this frame. */ |
5947 FRAME_NEW_HEIGHT (f) = 0; | 5945 f->new_text_lines = 0; |
5948 FRAME_NEW_WIDTH (f) = 0; | 5946 f->new_text_cols = 0; |
5949 | 5947 |
5950 /* If an argument is zero, set it to the current value. */ | 5948 /* If an argument is zero, set it to the current value. */ |
5951 if (newheight == 0) | 5949 if (newheight == 0) |
5952 newheight = FRAME_HEIGHT (f); | 5950 newheight = FRAME_LINES (f); |
5953 if (newwidth == 0) | 5951 if (newwidth == 0) |
5954 newwidth = FRAME_WIDTH (f); | 5952 newwidth = FRAME_COLS (f); |
5955 | 5953 |
5956 /* Compute width of windows in F. | 5954 /* Compute width of windows in F. |
5957 This is the width of the frame without vertical scroll bars. */ | 5955 This is the width of the frame without vertical scroll bars. */ |
5958 new_frame_window_width = FRAME_WINDOW_WIDTH_ARG (f, newwidth); | 5956 new_frame_total_cols = FRAME_TOTAL_COLS_ARG (f, newwidth); |
5959 | 5957 |
5960 /* Round up to the smallest acceptable size. */ | 5958 /* Round up to the smallest acceptable size. */ |
5961 check_frame_size (f, &newheight, &newwidth); | 5959 check_frame_size (f, &newheight, &newwidth); |
5962 | 5960 |
5963 /* If we're not changing the frame size, quit now. */ | 5961 /* If we're not changing the frame size, quit now. */ |
5964 if (newheight == FRAME_HEIGHT (f) | 5962 if (newheight == FRAME_LINES (f) |
5965 && new_frame_window_width == FRAME_WINDOW_WIDTH (f)) | 5963 && new_frame_total_cols == FRAME_TOTAL_COLS (f)) |
5966 return; | 5964 return; |
5967 | 5965 |
5968 BLOCK_INPUT; | 5966 BLOCK_INPUT; |
5969 | 5967 |
5970 #ifdef MSDOS | 5968 #ifdef MSDOS |
5972 by our video hardware. Try to find the smallest size greater | 5970 by our video hardware. Try to find the smallest size greater |
5973 or equal to the requested dimensions. */ | 5971 or equal to the requested dimensions. */ |
5974 dos_set_window_size (&newheight, &newwidth); | 5972 dos_set_window_size (&newheight, &newwidth); |
5975 #endif | 5973 #endif |
5976 | 5974 |
5977 if (newheight != FRAME_HEIGHT (f)) | 5975 if (newheight != FRAME_LINES (f)) |
5978 { | 5976 { |
5979 if (FRAME_HAS_MINIBUF_P (f) && !FRAME_MINIBUF_ONLY_P (f)) | 5977 if (FRAME_HAS_MINIBUF_P (f) && !FRAME_MINIBUF_ONLY_P (f)) |
5980 { | 5978 { |
5981 /* Frame has both root and mini-buffer. */ | 5979 /* Frame has both root and mini-buffer. */ |
5982 XSETFASTINT (XWINDOW (FRAME_ROOT_WINDOW (f))->top, | 5980 XSETFASTINT (XWINDOW (FRAME_ROOT_WINDOW (f))->top_line, |
5983 FRAME_TOP_MARGIN (f)); | 5981 FRAME_TOP_MARGIN (f)); |
5984 set_window_height (FRAME_ROOT_WINDOW (f), | 5982 set_window_height (FRAME_ROOT_WINDOW (f), |
5985 (newheight | 5983 (newheight |
5986 - 1 | 5984 - 1 |
5987 - FRAME_TOP_MARGIN (f)), | 5985 - FRAME_TOP_MARGIN (f)), |
5988 0); | 5986 0); |
5989 XSETFASTINT (XWINDOW (FRAME_MINIBUF_WINDOW (f))->top, | 5987 XSETFASTINT (XWINDOW (FRAME_MINIBUF_WINDOW (f))->top_line, |
5990 newheight - 1); | 5988 newheight - 1); |
5991 set_window_height (FRAME_MINIBUF_WINDOW (f), 1, 0); | 5989 set_window_height (FRAME_MINIBUF_WINDOW (f), 1, 0); |
5992 } | 5990 } |
5993 else | 5991 else |
5994 /* Frame has just one top-level window. */ | 5992 /* Frame has just one top-level window. */ |
5997 | 5995 |
5998 if (FRAME_TERMCAP_P (f) && !pretend) | 5996 if (FRAME_TERMCAP_P (f) && !pretend) |
5999 FrameRows = newheight; | 5997 FrameRows = newheight; |
6000 } | 5998 } |
6001 | 5999 |
6002 if (new_frame_window_width != FRAME_WINDOW_WIDTH (f)) | 6000 if (new_frame_total_cols != FRAME_TOTAL_COLS (f)) |
6003 { | 6001 { |
6004 set_window_width (FRAME_ROOT_WINDOW (f), new_frame_window_width, 0); | 6002 set_window_width (FRAME_ROOT_WINDOW (f), new_frame_total_cols, 0); |
6005 if (FRAME_HAS_MINIBUF_P (f)) | 6003 if (FRAME_HAS_MINIBUF_P (f)) |
6006 set_window_width (FRAME_MINIBUF_WINDOW (f), new_frame_window_width, 0); | 6004 set_window_width (FRAME_MINIBUF_WINDOW (f), new_frame_total_cols, 0); |
6007 | 6005 |
6008 if (FRAME_TERMCAP_P (f) && !pretend) | 6006 if (FRAME_TERMCAP_P (f) && !pretend) |
6009 FrameCols = newwidth; | 6007 FrameCols = newwidth; |
6010 | 6008 |
6011 if (WINDOWP (f->tool_bar_window)) | 6009 if (WINDOWP (f->tool_bar_window)) |
6012 XSETFASTINT (XWINDOW (f->tool_bar_window)->width, newwidth); | 6010 XSETFASTINT (XWINDOW (f->tool_bar_window)->total_cols, newwidth); |
6013 } | 6011 } |
6014 | 6012 |
6015 FRAME_HEIGHT (f) = newheight; | 6013 FRAME_LINES (f) = newheight; |
6016 SET_FRAME_WIDTH (f, newwidth); | 6014 SET_FRAME_COLS (f, newwidth); |
6017 | 6015 |
6018 { | 6016 { |
6019 struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f)); | 6017 struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f)); |
6020 int text_area_x, text_area_y, text_area_width, text_area_height; | 6018 int text_area_x, text_area_y, text_area_width, text_area_height; |
6021 | 6019 |
6036 | 6034 |
6037 record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); | 6035 record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); |
6038 | 6036 |
6039 /* This isn't quite a no-op: it runs window-configuration-change-hook. */ | 6037 /* This isn't quite a no-op: it runs window-configuration-change-hook. */ |
6040 Fset_window_buffer (FRAME_SELECTED_WINDOW (f), | 6038 Fset_window_buffer (FRAME_SELECTED_WINDOW (f), |
6041 XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer); | 6039 XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer, Qt); |
6042 | 6040 |
6043 unbind_to (count, Qnil); | 6041 unbind_to (count, Qnil); |
6044 } | 6042 } |
6045 | 6043 |
6046 | 6044 |
6535 | 6533 |
6536 term_init (terminal_type); | 6534 term_init (terminal_type); |
6537 | 6535 |
6538 { | 6536 { |
6539 struct frame *sf = SELECTED_FRAME (); | 6537 struct frame *sf = SELECTED_FRAME (); |
6540 int width = FRAME_WINDOW_WIDTH (sf); | 6538 int width = FRAME_TOTAL_COLS (sf); |
6541 int height = FRAME_HEIGHT (sf); | 6539 int height = FRAME_LINES (sf); |
6542 | 6540 |
6543 unsigned int total_glyphs = height * (width + 2) * sizeof (struct glyph); | 6541 unsigned int total_glyphs = height * (width + 2) * sizeof (struct glyph); |
6544 | 6542 |
6545 /* If these sizes are so big they cause overflow, just ignore the | 6543 /* If these sizes are so big they cause overflow, just ignore the |
6546 change. It's not clear what better we could do. */ | 6544 change. It's not clear what better we could do. */ |