X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/226c3633fdc0a259aa73aa9e6555cd42dd9f168c..cbcc70072ca522afbf01a6bcd0890a5ffaa730aa:/src/dispnew.c diff --git a/src/dispnew.c b/src/dispnew.c index 5c6ea0123b..10206ecd43 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -18,6 +18,9 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ #include + +#define DISPEXTERN_INLINE EXTERN_INLINE + #include #include #include @@ -65,28 +68,29 @@ along with GNU Emacs. If not, see . */ /* Get number of chars of output now in the buffer of a stdio stream. This ought to be built in stdio, but it isn't. Some s- files override this because their stdio internals differ. */ - #ifdef __GNU_LIBRARY__ /* The s- file might have overridden the definition with one that works for the system's C library. But we are using the GNU C library, so this is the right definition for every system. */ - #ifdef GNU_LIBRARY_PENDING_OUTPUT_COUNT #define PENDING_OUTPUT_COUNT GNU_LIBRARY_PENDING_OUTPUT_COUNT #else #undef PENDING_OUTPUT_COUNT #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->__bufp - (FILE)->__buffer) #endif -#else /* not __GNU_LIBRARY__ */ -#if !defined (PENDING_OUTPUT_COUNT) && HAVE_STDIO_EXT_H && HAVE___FPENDING + +/* not __GNU_LIBRARY__ and no PENDING_OUTPUT_COUNT defined */ +#elif !defined (PENDING_OUTPUT_COUNT) + +#if HAVE_STDIO_EXT_H && HAVE___FPENDING #include #define PENDING_OUTPUT_COUNT(FILE) __fpending (FILE) -#endif -#ifndef PENDING_OUTPUT_COUNT +#else #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_ptr - (FILE)->_base) #endif -#endif /* not __GNU_LIBRARY__ */ + +#endif /* not __GNU_LIBRARY__ and no PENDING_OUTPUT_COUNT defined */ #if defined (HAVE_TERM_H) && defined (GNU_LINUX) #include /* for tgetent */ @@ -264,9 +268,9 @@ add_window_display_history (struct window *w, const char *msg, int paused_p) "%"pMu": window %p (`%s')%s\n%s", history_tick++, w, - ((BUFFERP (w->buffer) - && STRINGP (BVAR (XBUFFER (w->buffer), name))) - ? SSDATA (BVAR (XBUFFER (w->buffer), name)) + ((BUFFERP (WGET (w, buffer)) + && STRINGP (BVAR (XBUFFER (WGET (w, buffer)), name))) + ? SSDATA (BVAR (XBUFFER (WGET (w, buffer)), name)) : "???"), paused_p ? " ***paused***" : "", msg); @@ -404,7 +408,7 @@ margin_glyphs_to_reserve (struct window *w, int total_glyphs, Lisp_Object margin if (NUMBERP (margin)) { - int width = XFASTINT (w->total_cols); + int width = XFASTINT (WGET (w, total_cols)); double d = max (0, XFLOATINT (margin)); d = min (width / 2 - 1, d); n = (int) ((double) total_glyphs / width * d); @@ -474,8 +478,8 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y the matrix means preventing redisplay. */ if (matrix->pool == NULL) { - left = margin_glyphs_to_reserve (w, dim.width, w->left_margin_cols); - right = margin_glyphs_to_reserve (w, dim.width, w->right_margin_cols); + left = margin_glyphs_to_reserve (w, dim.width, WGET (w, left_margin_cols)); + right = margin_glyphs_to_reserve (w, dim.width, WGET (w, right_margin_cols)); eassert (left >= 0 && right >= 0); marginal_areas_changed_p = (left != matrix->left_margin_glyphs || right != matrix->right_margin_glyphs); @@ -514,9 +518,9 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y if (w) { left = margin_glyphs_to_reserve (w, dim.width, - w->left_margin_cols); + WGET (w, left_margin_cols)); right = margin_glyphs_to_reserve (w, dim.width, - w->right_margin_cols); + WGET (w, right_margin_cols)); } else left = right = 0; @@ -639,9 +643,9 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y /* Window end is invalid, if inside of the rows that are invalidated below. */ - if (INTEGERP (w->window_end_vpos) - && XFASTINT (w->window_end_vpos) >= i) - w->window_end_valid = Qnil; + if (INTEGERP (WGET (w, window_end_vpos)) + && XFASTINT (WGET (w, window_end_vpos)) >= i) + WSET (w, window_end_valid, Qnil); while (i < matrix->nrows) matrix->rows[i++].enabled_p = 0; @@ -840,12 +844,12 @@ clear_current_matrices (register struct frame *f) /* Clear the matrix of the menu bar window, if such a window exists. The menu bar window is currently used to display menus on X when no toolkit support is compiled in. */ - if (WINDOWP (f->menu_bar_window)) - clear_glyph_matrix (XWINDOW (f->menu_bar_window)->current_matrix); + if (WINDOWP (FGET (f, menu_bar_window))) + clear_glyph_matrix (XWINDOW (FGET (f, menu_bar_window))->current_matrix); /* Clear the matrix of the tool-bar window, if any. */ - if (WINDOWP (f->tool_bar_window)) - clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix); + if (WINDOWP (FGET (f, tool_bar_window))) + clear_glyph_matrix (XWINDOW (FGET (f, tool_bar_window))->current_matrix); /* Clear current window matrices. */ eassert (WINDOWP (FRAME_ROOT_WINDOW (f))); @@ -861,11 +865,11 @@ clear_desired_matrices (register struct frame *f) if (f->desired_matrix) clear_glyph_matrix (f->desired_matrix); - if (WINDOWP (f->menu_bar_window)) - clear_glyph_matrix (XWINDOW (f->menu_bar_window)->desired_matrix); + if (WINDOWP (FGET (f, menu_bar_window))) + clear_glyph_matrix (XWINDOW (FGET (f, menu_bar_window))->desired_matrix); - if (WINDOWP (f->tool_bar_window)) - clear_glyph_matrix (XWINDOW (f->tool_bar_window)->desired_matrix); + if (WINDOWP (FGET (f, tool_bar_window))) + clear_glyph_matrix (XWINDOW (FGET (f, tool_bar_window))->desired_matrix); /* Do it for window matrices. */ eassert (WINDOWP (FRAME_ROOT_WINDOW (f))); @@ -881,15 +885,15 @@ clear_window_matrices (struct window *w, int desired_p) { while (w) { - if (!NILP (w->hchild)) + if (!NILP (WGET (w, hchild))) { - eassert (WINDOWP (w->hchild)); - clear_window_matrices (XWINDOW (w->hchild), desired_p); + eassert (WINDOWP (WGET (w, hchild))); + clear_window_matrices (XWINDOW (WGET (w, hchild)), desired_p); } - else if (!NILP (w->vchild)) + else if (!NILP (WGET (w, vchild))) { - eassert (WINDOWP (w->vchild)); - clear_window_matrices (XWINDOW (w->vchild), desired_p); + eassert (WINDOWP (WGET (w, vchild))); + clear_window_matrices (XWINDOW (WGET (w, vchild)), desired_p); } else { @@ -898,11 +902,11 @@ clear_window_matrices (struct window *w, int desired_p) else { clear_glyph_matrix (w->current_matrix); - w->window_end_valid = Qnil; + WSET (w, window_end_valid, Qnil); } } - w = NILP (w->next) ? 0 : XWINDOW (w->next); + w = NILP (WGET (w, next)) ? 0 : XWINDOW (WGET (w, next)); } } @@ -966,7 +970,7 @@ blank_row (struct window *w, struct glyph_row *row, int y) clear_glyph_row (row); row->y = y; row->ascent = row->phys_ascent = 0; - row->height = row->phys_height = FRAME_LINE_HEIGHT (XFRAME (w->frame)); + row->height = row->phys_height = FRAME_LINE_HEIGHT (XFRAME (WGET (w, frame))); row->visible_height = row->height; if (row->y < min_y) @@ -1512,7 +1516,7 @@ check_matrix_invariants (struct window *w) struct glyph_row *row = matrix->rows; struct glyph_row *last_text_row = NULL; struct buffer *saved = current_buffer; - struct buffer *buffer = XBUFFER (w->buffer); + struct buffer *buffer = XBUFFER (WGET (w, buffer)); int c; /* This can sometimes happen for a fresh window. */ @@ -1675,8 +1679,8 @@ allocate_matrices_for_frame_redisplay (Lisp_Object window, int x, int y, points to the mini-buffer window, if any, which is arranged vertically below other windows. */ in_horz_combination_p - = (!NILP (XWINDOW (window)->parent) - && !NILP (XWINDOW (XWINDOW (window)->parent)->hchild)); + = (!NILP (WGET (XWINDOW (window), parent)) + && !NILP (WGET (XWINDOW (WGET (XWINDOW (window), parent)), hchild))); /* For WINDOW and all windows on the same level. */ do @@ -1685,12 +1689,12 @@ allocate_matrices_for_frame_redisplay (Lisp_Object window, int x, int y, /* Get the dimension of the window sub-matrix for W, depending on whether this is a combination or a leaf window. */ - if (!NILP (w->hchild)) - dim = allocate_matrices_for_frame_redisplay (w->hchild, x, y, + if (!NILP (WGET (w, hchild))) + dim = allocate_matrices_for_frame_redisplay (WGET (w, hchild), x, y, dim_only_p, window_change_flags); - else if (!NILP (w->vchild)) - dim = allocate_matrices_for_frame_redisplay (w->vchild, x, y, + else if (!NILP (WGET (w, vchild))) + dim = allocate_matrices_for_frame_redisplay (WGET (w, vchild), x, y, dim_only_p, window_change_flags); else @@ -1714,10 +1718,10 @@ allocate_matrices_for_frame_redisplay (Lisp_Object window, int x, int y, || dim.width != w->desired_matrix->matrix_w || dim.height != w->desired_matrix->matrix_h || (margin_glyphs_to_reserve (w, dim.width, - w->left_margin_cols) + WGET (w, left_margin_cols)) != w->desired_matrix->left_margin_glyphs) || (margin_glyphs_to_reserve (w, dim.width, - w->right_margin_cols) + WGET (w, right_margin_cols)) != w->desired_matrix->right_margin_glyphs)) *window_change_flags |= CHANGED_LEAF_MATRIX; @@ -1746,7 +1750,7 @@ allocate_matrices_for_frame_redisplay (Lisp_Object window, int x, int y, hmax = max (hmax, dim.height); /* Next window on same level. */ - window = w->next; + window = WGET (w, next); } while (!NILP (window)); @@ -1777,7 +1781,7 @@ static int required_matrix_height (struct window *w) { #ifdef HAVE_WINDOW_SYSTEM - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WGET (w, frame)); if (FRAME_WINDOW_P (f)) { @@ -1803,7 +1807,7 @@ static int required_matrix_width (struct window *w) { #ifdef HAVE_WINDOW_SYSTEM - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WGET (w, frame)); if (FRAME_WINDOW_P (f)) { int ch_width = FRAME_SMALLEST_CHAR_WIDTH (f); @@ -1820,7 +1824,7 @@ required_matrix_width (struct window *w) } #endif /* HAVE_WINDOW_SYSTEM */ - return XINT (w->total_cols); + return XINT (WGET (w, total_cols)); } @@ -1832,10 +1836,10 @@ allocate_matrices_for_window_redisplay (struct window *w) { while (w) { - if (!NILP (w->vchild)) - allocate_matrices_for_window_redisplay (XWINDOW (w->vchild)); - else if (!NILP (w->hchild)) - allocate_matrices_for_window_redisplay (XWINDOW (w->hchild)); + if (!NILP (WGET (w, vchild))) + allocate_matrices_for_window_redisplay (XWINDOW (WGET (w, vchild))); + else if (!NILP (WGET (w, hchild))) + allocate_matrices_for_window_redisplay (XWINDOW (WGET (w, hchild))); else { /* W is a leaf window. */ @@ -1854,7 +1858,7 @@ allocate_matrices_for_window_redisplay (struct window *w) adjust_glyph_matrix (w, w->current_matrix, 0, 0, dim); } - w = NILP (w->next) ? NULL : XWINDOW (w->next); + w = NILP (WGET (w, next)) ? NULL : XWINDOW (WGET (w, next)); } } @@ -1900,21 +1904,21 @@ static void adjust_frame_glyphs_initially (void) { struct frame *sf = SELECTED_FRAME (); - struct window *root = XWINDOW (sf->root_window); - struct window *mini = XWINDOW (root->next); + struct window *root = XWINDOW (FGET (sf, root_window)); + struct window *mini = XWINDOW (WGET (root, next)); int frame_lines = FRAME_LINES (sf); int frame_cols = FRAME_COLS (sf); int top_margin = FRAME_TOP_MARGIN (sf); /* Do it for the root window. */ - XSETFASTINT (root->top_line, top_margin); - XSETFASTINT (root->total_lines, frame_lines - 1 - top_margin); - XSETFASTINT (root->total_cols, frame_cols); + WSET (root, top_line, make_number (top_margin)); + WSET (root, total_lines, make_number (frame_lines - 1 - top_margin)); + WSET (root, total_cols, make_number (frame_cols)); /* Do it for the mini-buffer window. */ - XSETFASTINT (mini->top_line, frame_lines - 1); - XSETFASTINT (mini->total_lines, 1); - XSETFASTINT (mini->total_cols, frame_cols); + WSET (mini, top_line, make_number (frame_lines - 1)); + WSET (mini, total_lines, make_number (1)); + WSET (mini, total_cols, make_number (frame_cols)); adjust_frame_glyphs (sf); glyphs_initialized_initially_p = 1; @@ -1946,21 +1950,21 @@ showing_window_margins_p (struct window *w) { while (w) { - if (!NILP (w->hchild)) + if (!NILP (WGET (w, hchild))) { - if (showing_window_margins_p (XWINDOW (w->hchild))) + if (showing_window_margins_p (XWINDOW (WGET (w, hchild)))) return 1; } - else if (!NILP (w->vchild)) + else if (!NILP (WGET (w, vchild))) { - if (showing_window_margins_p (XWINDOW (w->vchild))) + if (showing_window_margins_p (XWINDOW (WGET (w, vchild)))) return 1; } - else if (!NILP (w->left_margin_cols) - || !NILP (w->right_margin_cols)) + else if (!NILP (WGET (w, left_margin_cols)) + || !NILP (WGET (w, right_margin_cols))) return 1; - w = NILP (w->next) ? 0 : XWINDOW (w->next); + w = NILP (WGET (w, next)) ? 0 : XWINDOW (WGET (w, next)); } return 0; } @@ -1974,18 +1978,18 @@ fake_current_matrices (Lisp_Object window) { struct window *w; - for (; !NILP (window); window = w->next) + for (; !NILP (window); window = WGET (w, next)) { w = XWINDOW (window); - if (!NILP (w->hchild)) - fake_current_matrices (w->hchild); - else if (!NILP (w->vchild)) - fake_current_matrices (w->vchild); + if (!NILP (WGET (w, hchild))) + fake_current_matrices (WGET (w, hchild)); + else if (!NILP (WGET (w, vchild))) + fake_current_matrices (WGET (w, vchild)); else { int i; - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WGET (w, frame)); struct glyph_matrix *m = w->current_matrix; struct glyph_matrix *fm = f->current_matrix; @@ -2183,22 +2187,24 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f) { /* Allocate a dummy window if not already done. */ struct window *w; - if (NILP (f->menu_bar_window)) + if (NILP (FGET (f, menu_bar_window))) { - f->menu_bar_window = make_window (); - w = XWINDOW (f->menu_bar_window); - XSETFRAME (w->frame, f); + Lisp_Object frame; + FSET (f, menu_bar_window, make_window ()); + w = XWINDOW (FGET (f, menu_bar_window)); + XSETFRAME (frame, f); + WSET (w, frame, frame); w->pseudo_window_p = 1; } else - w = XWINDOW (f->menu_bar_window); + w = XWINDOW (FGET (f, menu_bar_window)); /* Set window dimensions to frame dimensions and allocate or adjust glyph matrices of W. */ - XSETFASTINT (w->top_line, 0); - XSETFASTINT (w->left_col, 0); - XSETFASTINT (w->total_lines, FRAME_MENU_BAR_LINES (f)); - XSETFASTINT (w->total_cols, FRAME_TOTAL_COLS (f)); + WSET (w, top_line, make_number (0)); + WSET (w, left_col, make_number (0)); + WSET (w, total_lines, make_number (FRAME_MENU_BAR_LINES (f))); + WSET (w, total_cols, make_number (FRAME_TOTAL_COLS (f))); allocate_matrices_for_window_redisplay (w); } #endif /* not USE_X_TOOLKIT && not USE_GTK */ @@ -2209,20 +2215,22 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f) /* Allocate/ reallocate matrices of the tool bar window. If we don't have a tool bar window yet, make one. */ struct window *w; - if (NILP (f->tool_bar_window)) + if (NILP (FGET (f, tool_bar_window))) { - f->tool_bar_window = make_window (); - w = XWINDOW (f->tool_bar_window); - XSETFRAME (w->frame, f); + Lisp_Object frame; + FSET (f, tool_bar_window, make_window ()); + w = XWINDOW (FGET (f, tool_bar_window)); + XSETFRAME (frame, f); + WSET (w, frame, frame); w->pseudo_window_p = 1; } else - w = XWINDOW (f->tool_bar_window); + w = XWINDOW (FGET (f, tool_bar_window)); - XSETFASTINT (w->top_line, FRAME_MENU_BAR_LINES (f)); - XSETFASTINT (w->left_col, 0); - XSETFASTINT (w->total_lines, FRAME_TOOL_BAR_LINES (f)); - XSETFASTINT (w->total_cols, FRAME_TOTAL_COLS (f)); + WSET (w, top_line, make_number (FRAME_MENU_BAR_LINES (f))); + WSET (w, left_col, make_number (0)); + WSET (w, total_lines, make_number (FRAME_TOOL_BAR_LINES (f))); + WSET (w, total_cols, make_number (FRAME_TOTAL_COLS (f))); allocate_matrices_for_window_redisplay (w); } #endif @@ -2277,28 +2285,28 @@ free_glyphs (struct frame *f) f->glyphs_initialized_p = 0; /* Release window sub-matrices. */ - if (!NILP (f->root_window)) - free_window_matrices (XWINDOW (f->root_window)); + if (!NILP (FGET (f, root_window))) + free_window_matrices (XWINDOW (FGET (f, root_window))); /* Free the dummy window for menu bars without X toolkit and its glyph matrices. */ - if (!NILP (f->menu_bar_window)) + if (!NILP (FGET (f, menu_bar_window))) { - struct window *w = XWINDOW (f->menu_bar_window); + struct window *w = XWINDOW (FGET (f, menu_bar_window)); free_glyph_matrix (w->desired_matrix); free_glyph_matrix (w->current_matrix); w->desired_matrix = w->current_matrix = NULL; - f->menu_bar_window = Qnil; + FSET (f, menu_bar_window, Qnil); } /* Free the tool bar window and its glyph matrices. */ - if (!NILP (f->tool_bar_window)) + if (!NILP (FGET (f, tool_bar_window))) { - struct window *w = XWINDOW (f->tool_bar_window); + struct window *w = XWINDOW (FGET (f, tool_bar_window)); free_glyph_matrix (w->desired_matrix); free_glyph_matrix (w->current_matrix); w->desired_matrix = w->current_matrix = NULL; - f->tool_bar_window = Qnil; + FSET (f, tool_bar_window, Qnil); } /* Release frame glyph matrices. Reset fields to zero in @@ -2332,10 +2340,10 @@ free_window_matrices (struct window *w) { while (w) { - if (!NILP (w->hchild)) - free_window_matrices (XWINDOW (w->hchild)); - else if (!NILP (w->vchild)) - free_window_matrices (XWINDOW (w->vchild)); + if (!NILP (WGET (w, hchild))) + free_window_matrices (XWINDOW (WGET (w, hchild))); + else if (!NILP (WGET (w, vchild))) + free_window_matrices (XWINDOW (WGET (w, vchild))); else { /* This is a leaf window. Free its memory and reset fields @@ -2347,7 +2355,7 @@ free_window_matrices (struct window *w) } /* Next window on same level. */ - w = NILP (w->next) ? 0 : XWINDOW (w->next); + w = NILP (WGET (w, next)) ? 0 : XWINDOW (WGET (w, next)); } } @@ -2468,14 +2476,14 @@ build_frame_matrix_from_window_tree (struct glyph_matrix *matrix, struct window { while (w) { - if (!NILP (w->hchild)) - build_frame_matrix_from_window_tree (matrix, XWINDOW (w->hchild)); - else if (!NILP (w->vchild)) - build_frame_matrix_from_window_tree (matrix, XWINDOW (w->vchild)); + if (!NILP (WGET (w, hchild))) + build_frame_matrix_from_window_tree (matrix, XWINDOW (WGET (w, hchild))); + else if (!NILP (WGET (w, vchild))) + build_frame_matrix_from_window_tree (matrix, XWINDOW (WGET (w, vchild))); else build_frame_matrix_from_leaf_window (matrix, w); - w = NILP (w->next) ? 0 : XWINDOW (w->next); + w = NILP (WGET (w, next)) ? 0 : XWINDOW (WGET (w, next)); } } @@ -2614,7 +2622,7 @@ spec_glyph_lookup_face (struct window *w, GLYPH *glyph) /* Convert the glyph's specified face to a realized (cache) face. */ if (lface_id > 0) { - int face_id = merge_faces (XFRAME (w->frame), + int face_id = merge_faces (XFRAME (WGET (w, frame)), Qt, lface_id, DEFAULT_FACE_ID); SET_GLYPH_FACE (*glyph, face_id); } @@ -2721,7 +2729,7 @@ make_current (struct glyph_matrix *desired_matrix, struct glyph_matrix *current_ /* If we are called on frame matrices, perform analogous operations for window matrices. */ if (frame_matrix_frame) - mirror_make_current (XWINDOW (frame_matrix_frame->root_window), row); + mirror_make_current (XWINDOW (FGET (frame_matrix_frame, root_window)), row); } @@ -2735,10 +2743,10 @@ mirror_make_current (struct window *w, int frame_row) { while (w) { - if (!NILP (w->hchild)) - mirror_make_current (XWINDOW (w->hchild), frame_row); - else if (!NILP (w->vchild)) - mirror_make_current (XWINDOW (w->vchild), frame_row); + if (!NILP (WGET (w, hchild))) + mirror_make_current (XWINDOW (WGET (w, hchild)), frame_row); + else if (!NILP (WGET (w, vchild))) + mirror_make_current (XWINDOW (WGET (w, vchild)), frame_row); else { /* Row relative to window W. Don't use FRAME_TO_WINDOW_VPOS @@ -2771,7 +2779,7 @@ mirror_make_current (struct window *w, int frame_row) } } - w = NILP (w->next) ? 0 : XWINDOW (w->next); + w = NILP (WGET (w, next)) ? 0 : XWINDOW (WGET (w, next)); } } @@ -2819,7 +2827,7 @@ mirrored_line_dance (struct glyph_matrix *matrix, int unchanged_at_top, int nlin /* Do the same for window matrices, if MATRIX is a frame matrix. */ if (frame_matrix_frame) - mirror_line_dance (XWINDOW (frame_matrix_frame->root_window), + mirror_line_dance (XWINDOW (FGET (frame_matrix_frame, root_window)), unchanged_at_top, nlines, copy_from, retained_p); } @@ -2830,16 +2838,16 @@ mirrored_line_dance (struct glyph_matrix *matrix, int unchanged_at_top, int nlin static void sync_window_with_frame_matrix_rows (struct window *w) { - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WGET (w, frame)); struct glyph_row *window_row, *window_row_end, *frame_row; int left, right, x, width; /* Preconditions: W must be a leaf window on a tty frame. */ - eassert (NILP (w->hchild) && NILP (w->vchild)); + eassert (NILP (WGET (w, hchild)) && NILP (WGET (w, vchild))); eassert (!FRAME_WINDOW_P (f)); - left = margin_glyphs_to_reserve (w, 1, w->left_margin_cols); - right = margin_glyphs_to_reserve (w, 1, w->right_margin_cols); + left = margin_glyphs_to_reserve (w, 1, WGET (w, left_margin_cols)); + right = margin_glyphs_to_reserve (w, 1, WGET (w, right_margin_cols)); x = w->current_matrix->matrix_x; width = w->current_matrix->matrix_w; @@ -2871,15 +2879,15 @@ frame_row_to_window (struct window *w, int row) while (w && !found) { - if (!NILP (w->hchild)) - found = frame_row_to_window (XWINDOW (w->hchild), row); - else if (!NILP (w->vchild)) - found = frame_row_to_window (XWINDOW (w->vchild), row); + if (!NILP (WGET (w, hchild))) + found = frame_row_to_window (XWINDOW (WGET (w, hchild)), row); + else if (!NILP (WGET (w, vchild))) + found = frame_row_to_window (XWINDOW (WGET (w, vchild)), row); else if (row >= WINDOW_TOP_EDGE_LINE (w) && row < WINDOW_BOTTOM_EDGE_LINE (w)) found = w; - w = NILP (w->next) ? 0 : XWINDOW (w->next); + w = NILP (WGET (w, next)) ? 0 : XWINDOW (WGET (w, next)); } return found; @@ -2902,11 +2910,11 @@ mirror_line_dance (struct window *w, int unchanged_at_top, int nlines, int *copy { while (w) { - if (!NILP (w->hchild)) - mirror_line_dance (XWINDOW (w->hchild), unchanged_at_top, + if (!NILP (WGET (w, hchild))) + mirror_line_dance (XWINDOW (WGET (w, hchild)), unchanged_at_top, nlines, copy_from, retained_p); - else if (!NILP (w->vchild)) - mirror_line_dance (XWINDOW (w->vchild), unchanged_at_top, + else if (!NILP (WGET (w, vchild))) + mirror_line_dance (XWINDOW (WGET (w, vchild)), unchanged_at_top, nlines, copy_from, retained_p); else { @@ -2962,7 +2970,7 @@ mirror_line_dance (struct window *w, int unchanged_at_top, int nlines, int *copy { /* A copy between windows. This is an infrequent case not worth optimizing. */ - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WGET (w, frame)); struct window *root = XWINDOW (FRAME_ROOT_WINDOW (f)); struct window *w2; struct glyph_matrix *m2; @@ -2999,7 +3007,7 @@ mirror_line_dance (struct window *w, int unchanged_at_top, int nlines, int *copy } /* Next window on same level. */ - w = NILP (w->next) ? 0 : XWINDOW (w->next); + w = NILP (WGET (w, next)) ? 0 : XWINDOW (WGET (w, next)); } } @@ -3017,18 +3025,18 @@ check_window_matrix_pointers (struct window *w) { while (w) { - if (!NILP (w->hchild)) - check_window_matrix_pointers (XWINDOW (w->hchild)); - else if (!NILP (w->vchild)) - check_window_matrix_pointers (XWINDOW (w->vchild)); + if (!NILP (WGET (w, hchild))) + check_window_matrix_pointers (XWINDOW (WGET (w, hchild))); + else if (!NILP (WGET (w, vchild))) + check_window_matrix_pointers (XWINDOW (WGET (w, vchild))); else { - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WGET (w, frame)); check_matrix_pointers (w->desired_matrix, f->desired_matrix); check_matrix_pointers (w->current_matrix, f->current_matrix); } - w = NILP (w->next) ? 0 : XWINDOW (w->next); + w = NILP (WGET (w, next)) ? 0 : XWINDOW (WGET (w, next)); } } @@ -3076,10 +3084,10 @@ check_matrix_pointers (struct glyph_matrix *window_matrix, static int window_to_frame_vpos (struct window *w, int vpos) { - eassert (!FRAME_WINDOW_P (XFRAME (w->frame))); + eassert (!FRAME_WINDOW_P (XFRAME (WGET (w, frame)))); eassert (vpos >= 0 && vpos <= w->desired_matrix->nrows); vpos += WINDOW_TOP_EDGE_LINE (w); - eassert (vpos >= 0 && vpos <= FRAME_LINES (XFRAME (w->frame))); + eassert (vpos >= 0 && vpos <= FRAME_LINES (XFRAME (WGET (w, frame)))); return vpos; } @@ -3090,7 +3098,7 @@ window_to_frame_vpos (struct window *w, int vpos) static int window_to_frame_hpos (struct window *w, int hpos) { - eassert (!FRAME_WINDOW_P (XFRAME (w->frame))); + eassert (!FRAME_WINDOW_P (XFRAME (WGET (w, frame)))); hpos += WINDOW_LEFT_EDGE_COL (w); return hpos; } @@ -3182,7 +3190,7 @@ update_frame (struct frame *f, int force_p, int inhibit_hairy_id_p) { /* 1 means display has been paused because of pending input. */ int paused_p; - struct window *root_window = XWINDOW (f->root_window); + struct window *root_window = XWINDOW (FGET (f, root_window)); if (redisplay_dont_pause) force_p = 1; @@ -3190,7 +3198,6 @@ update_frame (struct frame *f, int force_p, int inhibit_hairy_id_p) force_p = 1; else if (!force_p && NUMBERP (Vredisplay_preemption_period)) { - EMACS_TIME tm; double p = XFLOATINT (Vredisplay_preemption_period); if (detect_input_pending_ignore_squeezables ()) @@ -3199,9 +3206,9 @@ update_frame (struct frame *f, int force_p, int inhibit_hairy_id_p) goto do_pause; } - EMACS_GET_TIME (tm); preemption_period = EMACS_TIME_FROM_DOUBLE (p); - EMACS_ADD_TIME (preemption_next_check, tm, preemption_period); + preemption_next_check = add_emacs_time (current_emacs_time (), + preemption_period); } if (FRAME_WINDOW_P (f)) @@ -3218,13 +3225,13 @@ update_frame (struct frame *f, int force_p, int inhibit_hairy_id_p) /* Update the menu bar on X frames that don't have toolkit support. */ - if (WINDOWP (f->menu_bar_window)) - update_window (XWINDOW (f->menu_bar_window), 1); + if (WINDOWP (FGET (f, menu_bar_window))) + update_window (XWINDOW (FGET (f, menu_bar_window)), 1); /* Update the tool-bar window, if present. */ - if (WINDOWP (f->tool_bar_window)) + if (WINDOWP (FGET (f, tool_bar_window))) { - struct window *w = XWINDOW (f->tool_bar_window); + struct window *w = XWINDOW (FGET (f, tool_bar_window)); /* Update tool-bar window. */ if (w->must_be_updated_p) @@ -3236,9 +3243,10 @@ update_frame (struct frame *f, int force_p, int inhibit_hairy_id_p) /* Swap tool-bar strings. We swap because we want to reuse strings. */ - tem = f->current_tool_bar_string; - f->current_tool_bar_string = f->desired_tool_bar_string; - f->desired_tool_bar_string = tem; + tem = FGET (f, current_tool_bar_string); + FSET (f, current_tool_bar_string, + FGET (f, desired_tool_bar_string)); + FSET (f, desired_tool_bar_string, tem); } } @@ -3310,14 +3318,14 @@ update_window_tree (struct window *w, int force_p) while (w && !paused_p) { - if (!NILP (w->hchild)) - paused_p |= update_window_tree (XWINDOW (w->hchild), force_p); - else if (!NILP (w->vchild)) - paused_p |= update_window_tree (XWINDOW (w->vchild), force_p); + if (!NILP (WGET (w, hchild))) + paused_p |= update_window_tree (XWINDOW (WGET (w, hchild)), force_p); + else if (!NILP (WGET (w, vchild))) + paused_p |= update_window_tree (XWINDOW (WGET (w, vchild)), force_p); else if (w->must_be_updated_p) paused_p |= update_window (w, force_p); - w = NILP (w->next) ? 0 : XWINDOW (w->next); + w = NILP (WGET (w, next)) ? 0 : XWINDOW (WGET (w, next)); } return paused_p; @@ -3343,12 +3351,10 @@ update_single_window (struct window *w, int force_p) force_p = 1; else if (!force_p && NUMBERP (Vredisplay_preemption_period)) { - EMACS_TIME tm; double p = XFLOATINT (Vredisplay_preemption_period); - - EMACS_GET_TIME (tm); preemption_period = EMACS_TIME_FROM_DOUBLE (p); - EMACS_ADD_TIME (preemption_next_check, tm, preemption_period); + preemption_next_check = add_emacs_time (current_emacs_time (), + preemption_period); } /* Update W. */ @@ -3595,11 +3601,11 @@ update_window (struct window *w, int force_p) #if PERIODIC_PREEMPTION_CHECKING if (!force_p) { - EMACS_TIME tm; - EMACS_GET_TIME (tm); + EMACS_TIME tm = current_emacs_time (); if (EMACS_TIME_LT (preemption_next_check, tm)) { - EMACS_ADD_TIME (preemption_next_check, tm, preemption_period); + preemption_next_check = add_emacs_time (tm, + preemption_period); if (detect_input_pending_ignore_squeezables ()) break; } @@ -3807,7 +3813,7 @@ update_text_area (struct window *w, int vpos) struct glyph *glyph = ¤t_row->glyphs[TEXT_AREA][i - 1]; int left, right; - rif->get_glyph_overhangs (glyph, XFRAME (w->frame), + rif->get_glyph_overhangs (glyph, XFRAME (WGET (w, frame)), &left, &right); can_skip_p = (right == 0 && !abort_skipping); } @@ -3839,7 +3845,8 @@ update_text_area (struct window *w, int vpos) { int left, right; - rif->get_glyph_overhangs (current_glyph, XFRAME (w->frame), + rif->get_glyph_overhangs (current_glyph, + XFRAME (WGET (w, frame)), &left, &right); while (left > 0 && i > 0) { @@ -3982,7 +3989,7 @@ update_window_line (struct window *w, int vpos, int *mouse_face_overwritten_p) /* Update display of the left margin area, if there is one. */ if (!desired_row->full_width_p - && !NILP (w->left_margin_cols)) + && !NILP (WGET (w, left_margin_cols))) { changed_p = 1; update_marginal_area (w, LEFT_MARGIN_AREA, vpos); @@ -3998,7 +4005,7 @@ update_window_line (struct window *w, int vpos, int *mouse_face_overwritten_p) /* Update display of the right margin area, if there is one. */ if (!desired_row->full_width_p - && !NILP (w->right_margin_cols)) + && !NILP (WGET (w, right_margin_cols))) { changed_p = 1; update_marginal_area (w, RIGHT_MARGIN_AREA, vpos); @@ -4031,7 +4038,7 @@ update_window_line (struct window *w, int vpos, int *mouse_face_overwritten_p) static void set_window_cursor_after_update (struct window *w) { - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WGET (w, frame)); struct redisplay_interface *rif = FRAME_RIF (f); int cx, cy, vpos, hpos; @@ -4117,14 +4124,14 @@ set_window_update_flags (struct window *w, int on_p) { while (w) { - if (!NILP (w->hchild)) - set_window_update_flags (XWINDOW (w->hchild), on_p); - else if (!NILP (w->vchild)) - set_window_update_flags (XWINDOW (w->vchild), on_p); + if (!NILP (WGET (w, hchild))) + set_window_update_flags (XWINDOW (WGET (w, hchild)), on_p); + else if (!NILP (WGET (w, vchild))) + set_window_update_flags (XWINDOW (WGET (w, vchild)), on_p); else w->must_be_updated_p = on_p; - w = NILP (w->next) ? 0 : XWINDOW (w->next); + w = NILP (WGET (w, next)) ? 0 : XWINDOW (WGET (w, next)); } } @@ -4700,11 +4707,10 @@ update_frame_1 (struct frame *f, int force_p, int inhibit_id_p) #if PERIODIC_PREEMPTION_CHECKING if (!force_p) { - EMACS_TIME tm; - EMACS_GET_TIME (tm); + EMACS_TIME tm = current_emacs_time (); if (EMACS_TIME_LT (preemption_next_check, tm)) { - EMACS_ADD_TIME (preemption_next_check, tm, preemption_period); + preemption_next_check = add_emacs_time (tm, preemption_period); if (detect_input_pending_ignore_squeezables ()) break; } @@ -4808,8 +4814,8 @@ update_frame_1 (struct frame *f, int force_p, int inhibit_id_p) int x = WINDOW_TO_FRAME_HPOS (w, w->cursor.hpos); int y = WINDOW_TO_FRAME_VPOS (w, w->cursor.vpos); - if (INTEGERP (w->left_margin_cols)) - x += XFASTINT (w->left_margin_cols); + if (INTEGERP (WGET (w, left_margin_cols))) + x += XFASTINT (WGET (w, left_margin_cols)); /* x = max (min (x, FRAME_TOTAL_COLS (f) - 1), 0); */ cursor_to (f, y, x); @@ -5299,9 +5305,9 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p /* We used to set current_buffer directly here, but that does the wrong thing with `face-remapping-alist' (bug#2044). */ - Fset_buffer (w->buffer); + Fset_buffer (WGET (w, buffer)); itdata = bidi_shelve_cache (); - SET_TEXT_POS_FROM_MARKER (startp, w->start); + SET_TEXT_POS_FROM_MARKER (startp, WGET (w, start)); CHARPOS (startp) = min (ZV, max (BEGV, CHARPOS (startp))); BYTEPOS (startp) = min (ZV_BYTE, max (BEGV_BYTE, BYTEPOS (startp))); start_display (&it, w, startp); @@ -5345,7 +5351,7 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p *dx = x0 + it.first_visible_x - it.current_x; *dy = *y - it.current_y; - string = w->buffer; + string = WGET (w, buffer); if (STRINGP (it.string)) string = it.string; *pos = it.current; @@ -5363,7 +5369,7 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p if (STRINGP (it.string)) BYTEPOS (pos->pos) = string_char_to_byte (string, CHARPOS (pos->pos)); else - BYTEPOS (pos->pos) = buf_charpos_to_bytepos (XBUFFER (w->buffer), + BYTEPOS (pos->pos) = buf_charpos_to_bytepos (XBUFFER (WGET (w, buffer)), CHARPOS (pos->pos)); } @@ -5762,8 +5768,9 @@ change_frame_size_1 (register struct frame *f, int newheight, int newwidth, int if ((FRAME_TERMCAP_P (f) && !pretend) || FRAME_MSDOS_P (f)) FrameCols (FRAME_TTY (f)) = newwidth; - if (WINDOWP (f->tool_bar_window)) - XSETFASTINT (XWINDOW (f->tool_bar_window)->total_cols, newwidth); + if (WINDOWP (FGET (f, tool_bar_window))) + WSET (XWINDOW (FGET (f, tool_bar_window)), + total_cols, make_number (newwidth)); } FRAME_LINES (f) = newheight; @@ -6087,7 +6094,7 @@ pass nil for VARIABLE. */) goto changed; if (vecp == end) goto changed; - if (!EQ (*vecp++, XFRAME (frame)->name)) + if (!EQ (*vecp++, FGET (XFRAME (frame), name))) goto changed; } /* Check that the buffer info matches. */ @@ -6144,7 +6151,7 @@ pass nil for VARIABLE. */) FOR_EACH_FRAME (tail, frame) { *vecp++ = frame; - *vecp++ = XFRAME (frame)->name; + *vecp++ = FGET (XFRAME (frame), name); } for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail)) {