From 3a45383a47009a5e6a15a4005ad95ecf63539182 Mon Sep 17 00:00:00 2001 From: Dmitry Antipov Date: Wed, 1 Aug 2012 09:11:36 +0400 Subject: [PATCH] Use INTERNAL_FIELD for windows. * src/window.h (WVAR): New macro. (struct window): Change Lisp_Object members to INTERNAL_FIELD. * src/alloc.c, src/buffer.c, src/composite.c, src/dispextern.h: * src/dispnew.c, src/editfns.c, src/fileio.c, src/font.c, src/fontset.c: * src/frame.c, src/frame.h, src/fringe.c, src/indent.c, src/insdel.c: * src/keyboard.c, src/keymap.c, src/lisp.h, src/minibuf.c, src/nsterm.m: * src/print.c, src/textprop.c, src/w32fns.c, src/w32menu.c, src/w32term.c: * src/window.c, src/xdisp.c, src/xfaces.c, src/xfns.c, src/xmenu.c: * src/xterm.c: Users changed. * admin/coccinelle/window.cocci: Semantic patch to replace direct access to Lisp_Object members of struct window to WVAR. --- admin/ChangeLog | 5 + admin/coccinelle/window.cocci | 242 +++++++ src/ChangeLog | 17 +- src/alloc.c | 3 +- src/buffer.c | 19 +- src/composite.c | 4 +- src/dispextern.h | 15 +- src/dispnew.c | 261 +++---- src/editfns.c | 8 +- src/fileio.c | 4 +- src/font.c | 4 +- src/fontset.c | 2 +- src/frame.c | 64 +- src/frame.h | 2 +- src/fringe.c | 14 +- src/indent.c | 31 +- src/insdel.c | 2 +- src/keyboard.c | 32 +- src/keymap.c | 6 +- src/lisp.h | 3 +- src/minibuf.c | 8 +- src/nsterm.m | 6 +- src/print.c | 5 +- src/textprop.c | 2 +- src/w32fns.c | 16 +- src/w32menu.c | 2 +- src/w32term.c | 30 +- src/window.c | 1203 +++++++++++++++++---------------- src/window.h | 142 ++-- src/xdisp.c | 660 +++++++++--------- src/xfaces.c | 12 +- src/xfns.c | 18 +- src/xmenu.c | 2 +- src/xterm.c | 42 +- 34 files changed, 1594 insertions(+), 1292 deletions(-) create mode 100644 admin/coccinelle/window.cocci diff --git a/admin/ChangeLog b/admin/ChangeLog index 9495d5e9a3..0837552867 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog @@ -1,3 +1,8 @@ +2012-08-01 Dmitry Antipov + + * coccinelle/window.cocci: Semantic patch to replace direct + access to Lisp_Object members of struct window to WVAR. + 2012-07-31 Dmitry Antipov * coccinelle/frame.cocci: Semantic patch to replace direct diff --git a/admin/coccinelle/window.cocci b/admin/coccinelle/window.cocci new file mode 100644 index 0000000000..1448febfcc --- /dev/null +++ b/admin/coccinelle/window.cocci @@ -0,0 +1,242 @@ +// Change direct access to Lisp_Object fields of struct window to WVAR. +@@ +struct window *W; +Lisp_Object O; +@@ +( +- W->frame ++ WVAR (W, frame) +| +- W->next ++ WVAR (W, next) +| +- W->prev ++ WVAR (W, prev) +| +- W->hchild ++ WVAR (W, hchild) +| +- W->vchild ++ WVAR (W, vchild) +| +- W->parent ++ WVAR (W, parent) +| +- W->left_col ++ WVAR (W, left_col) +| +- W->top_line ++ WVAR (W, top_line) +| +- W->total_lines ++ WVAR (W, total_lines) +| +- W->total_cols ++ WVAR (W, total_cols) +| +- W->normal_lines ++ WVAR (W, normal_lines) +| +- W->normal_cols ++ WVAR (W, normal_cols) +| +- W->new_total ++ WVAR (W, new_total) +| +- W->new_normal ++ WVAR (W, new_normal) +| +- W->buffer ++ WVAR (W, buffer) +| +- W->start ++ WVAR (W, start) +| +- W->pointm ++ WVAR (W, pointm) +| +- W->temslot ++ WVAR (W, temslot) +| +- W->vertical_scroll_bar ++ WVAR (W, vertical_scroll_bar) +| +- W->left_margin_cols ++ WVAR (W, left_margin_cols) +| +- W->right_margin_cols ++ WVAR (W, right_margin_cols) +| +- W->left_fringe_width ++ WVAR (W, left_fringe_width) +| +- W->right_fringe_width ++ WVAR (W, right_fringe_width) +| +- W->scroll_bar_width ++ WVAR (W, scroll_bar_width) +| +- W->vertical_scroll_bar_type ++ WVAR (W, vertical_scroll_bar_type) +| +- W->window_end_pos ++ WVAR (W, window_end_pos) +| +- W->window_end_vpos ++ WVAR (W, window_end_vpos) +| +- W->window_end_valid ++ WVAR (W, window_end_valid) +| +- W->display_table ++ WVAR (W, display_table) +| +- W->dedicated ++ WVAR (W, dedicated) +| +- W->base_line_number ++ WVAR (W, base_line_number) +| +- W->base_line_pos ++ WVAR (W, base_line_pos) +| +- W->region_showing ++ WVAR (W, region_showing) +| +- W->column_number_displayed ++ WVAR (W, column_number_displayed) +| +- W->redisplay_end_trigger ++ WVAR (W, redisplay_end_trigger) +| +- W->combination_limit ++ WVAR (W, combination_limit) +| +- W->prev_buffers ++ WVAR (W, prev_buffers) +| +- W->next_buffers ++ WVAR (W, next_buffers) +| +- W->window_parameters ++ WVAR (W, window_parameters) + +| + +- XWINDOW (O)->frame ++ WVAR (XWINDOW (O), frame) +| +- XWINDOW (O)->next ++ WVAR (XWINDOW (O), next) +| +- XWINDOW (O)->prev ++ WVAR (XWINDOW (O), prev) +| +- XWINDOW (O)->hchild ++ WVAR (XWINDOW (O), hchild) +| +- XWINDOW (O)->vchild ++ WVAR (XWINDOW (O), vchild) +| +- XWINDOW (O)->parent ++ WVAR (XWINDOW (O), parent) +| +- XWINDOW (O)->left_col ++ WVAR (XWINDOW (O), left_col) +| +- XWINDOW (O)->top_line ++ WVAR (XWINDOW (O), top_line) +| +- XWINDOW (O)->total_lines ++ WVAR (XWINDOW (O), total_lines) +| +- XWINDOW (O)->total_cols ++ WVAR (XWINDOW (O), total_cols) +| +- XWINDOW (O)->normal_lines ++ WVAR (XWINDOW (O), normal_lines) +| +- XWINDOW (O)->normal_cols ++ WVAR (XWINDOW (O), normal_cols) +| +- XWINDOW (O)->new_total ++ WVAR (XWINDOW (O), new_total) +| +- XWINDOW (O)->new_normal ++ WVAR (XWINDOW (O), new_normal) +| +- XWINDOW (O)->buffer ++ WVAR (XWINDOW (O), buffer) +| +- XWINDOW (O)->start ++ WVAR (XWINDOW (O), start) +| +- XWINDOW (O)->pointm ++ WVAR (XWINDOW (O), pointm) +| +- XWINDOW (O)->temslot ++ WVAR (XWINDOW (O), temslot) +| +- XWINDOW (O)->vertical_scroll_bar ++ WVAR (XWINDOW (O), vertical_scroll_bar) +| +- XWINDOW (O)->left_margin_cols ++ WVAR (XWINDOW (O), left_margin_cols) +| +- XWINDOW (O)->right_margin_cols ++ WVAR (XWINDOW (O), right_margin_cols) +| +- XWINDOW (O)->left_fringe_width ++ WVAR (XWINDOW (O), left_fringe_width) +| +- XWINDOW (O)->right_fringe_width ++ WVAR (XWINDOW (O), right_fringe_width) +| +- XWINDOW (O)->scroll_bar_width ++ WVAR (XWINDOW (O), scroll_bar_width) +| +- XWINDOW (O)->vertical_scroll_bar_type ++ WVAR (XWINDOW (O), vertical_scroll_bar_type) +| +- XWINDOW (O)->window_end_pos ++ WVAR (XWINDOW (O), window_end_pos) +| +- XWINDOW (O)->window_end_vpos ++ WVAR (XWINDOW (O), window_end_vpos) +| +- XWINDOW (O)->window_end_valid ++ WVAR (XWINDOW (O), window_end_valid) +| +- XWINDOW (O)->display_table ++ WVAR (XWINDOW (O), display_table) +| +- XWINDOW (O)->dedicated ++ WVAR (XWINDOW (O), dedicated) +| +- XWINDOW (O)->base_line_number ++ WVAR (XWINDOW (O), base_line_number) +| +- XWINDOW (O)->base_line_pos ++ WVAR (XWINDOW (O), base_line_pos) +| +- XWINDOW (O)->region_showing ++ WVAR (XWINDOW (O), region_showing) +| +- XWINDOW (O)->column_number_displayed ++ WVAR (XWINDOW (O), column_number_displayed) +| +- XWINDOW (O)->redisplay_end_trigger ++ WVAR (XWINDOW (O), redisplay_end_trigger) +| +- XWINDOW (O)->combination_limit ++ WVAR (XWINDOW (O), combination_limit) +| +- XWINDOW (O)->prev_buffers ++ WVAR (XWINDOW (O), prev_buffers) +| +- XWINDOW (O)->next_buffers ++ WVAR (XWINDOW (O), next_buffers) +| +- XWINDOW (O)->window_parameters ++ WVAR (XWINDOW (O), window_parameters) +) diff --git a/src/ChangeLog b/src/ChangeLog index 6c4e57e690..c82dfd6060 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,14 @@ +2012-08-01 Dmitry Antipov + + Use INTERNAL_FIELD for windows. + * window.h (WVAR): New macro. + (struct window): Change Lisp_Object members to INTERNAL_FIELD. + * alloc.c, buffer.c, composite.c, dispextern.h, dispnew.c, editfns.c: + * fileio.c, font.c, fontset.c, frame.c, frame.h, fringe.c, indent.c: + * insdel.c, keyboard.c, keymap.c, lisp.h, minibuf.c, nsterm.m, print.c: + * textprop.c, w32fns.c, w32menu.c, w32term.c, window.c, xdisp.c: + * xfaces.c, xfns.c, xmenu.c, xterm.c: Users changed. + 2012-08-01 Paul Eggert * coding.h (CODING_ATTR_FLUSHING): Remove; unused and wouldn't work. @@ -63,9 +74,9 @@ (KVAR): Change to use INTERNAL_FIELD. * frame.h (FVAR): New macro. (struct frame): Use INTERNAL_FIELD for all Lisp_Object fields. - * alloc.c, buffer.c, data.c, dispnew.c, dosfns.c, eval.c, frame.c - * fringe.c, gtkutil.c, minibuf.c, nsfns.m, nsterm.m, print.c - * term.c, w32fns.c, w32menu.c, w32term.c, window.c, window.h, + * alloc.c, buffer.c, data.c, dispnew.c, dosfns.c, eval.c, frame.c: + * fringe.c, gtkutil.c, minibuf.c, nsfns.m, nsterm.m, print.c: + * term.c, w32fns.c, w32menu.c, w32term.c, window.c, window.h: * xdisp.c, xfaces.c, xfns.c, xmenu.c, xterm.c: Users changed. 2012-07-31 Dmitry Antipov diff --git a/src/alloc.c b/src/alloc.c index f04f3c0513..d824a6a491 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -6020,7 +6020,8 @@ mark_object (Lisp_Object arg) /* Mark glyphs for leaf windows. Marking window matrices is sufficient because frame matrices use the same glyph memory. */ - if (NILP (w->hchild) && NILP (w->vchild) && w->current_matrix) + if (NILP (WVAR (w, hchild)) && NILP (WVAR (w, vchild)) + && w->current_matrix) { mark_glyph_matrix (w->current_matrix); mark_glyph_matrix (w->desired_matrix); diff --git a/src/buffer.c b/src/buffer.c index 4168fa8f02..e70360f517 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1557,7 +1557,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) since anything can happen within do_yes_or_no_p. */ /* Don't kill the minibuffer now current. */ - if (EQ (buffer, XWINDOW (minibuf_window)->buffer)) + if (EQ (buffer, WVAR (XWINDOW (minibuf_window), buffer))) return Qnil; /* When we kill an ordinary buffer which shares it's buffer text @@ -1608,7 +1608,7 @@ cleaning up all windows currently displaying the buffer to be killed. */) /* If the buffer now current is shown in the minibuffer and our buffer is the sole other buffer give up. */ XSETBUFFER (tem, current_buffer); - if (EQ (tem, XWINDOW (minibuf_window)->buffer) + if (EQ (tem, WVAR (XWINDOW (minibuf_window), buffer)) && EQ (buffer, Fother_buffer (buffer, Qnil, Qnil))) return Qnil; @@ -2190,12 +2190,13 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, while (NILP (Fmemq (w, ws))) { ws = Fcons (w, ws); - if (MARKERP (XWINDOW (w)->pointm) - && (EQ (XWINDOW (w)->buffer, buf1) - || EQ (XWINDOW (w)->buffer, buf2))) - Fset_marker (XWINDOW (w)->pointm, - make_number (BUF_BEGV (XBUFFER (XWINDOW (w)->buffer))), - XWINDOW (w)->buffer); + if (MARKERP (WVAR (XWINDOW (w), pointm)) + && (EQ (WVAR (XWINDOW (w), buffer), buf1) + || EQ (WVAR (XWINDOW (w), buffer), buf2))) + Fset_marker (WVAR (XWINDOW (w), pointm), + make_number + (BUF_BEGV (XBUFFER (WVAR (XWINDOW (w), buffer)))), + WVAR (XWINDOW (w), buffer)); w = Fnext_window (w, Qt, Qt); } } @@ -3671,7 +3672,7 @@ modify_overlay (struct buffer *buf, ptrdiff_t start, ptrdiff_t end) /* If this is a buffer not in the selected window, we must do other windows. */ - if (buf != XBUFFER (XWINDOW (selected_window)->buffer)) + if (buf != XBUFFER (WVAR (XWINDOW (selected_window), buffer))) windows_or_buffers_changed = 1; /* If multiple windows show this buffer, we must do other windows. */ else if (buffer_shared > 1) diff --git a/src/composite.c b/src/composite.c index 62ab3d0494..485e51467c 100644 --- a/src/composite.c +++ b/src/composite.c @@ -906,7 +906,7 @@ static Lisp_Object autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t limit, struct window *win, struct face *face, Lisp_Object string) { ptrdiff_t count = SPECPDL_INDEX (); - FRAME_PTR f = XFRAME (win->frame); + FRAME_PTR f = XFRAME (WVAR (win, frame)); Lisp_Object pos = make_number (charpos); ptrdiff_t to; ptrdiff_t pt = PT, pt_byte = PT_BYTE; @@ -942,7 +942,7 @@ autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t } else #endif /* not HAVE_WINDOW_SYSTEM */ - font_object = win->frame; + font_object = WVAR (win, frame); lgstring = Fcomposition_get_gstring (pos, make_number (to), font_object, string); if (NILP (LGSTRING_ID (lgstring))) diff --git a/src/dispextern.h b/src/dispextern.h index 5bdf943466..add228e008 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -1374,7 +1374,7 @@ struct glyph_string ? current_mode_line_height \ : (MATRIX_MODE_LINE_HEIGHT ((W)->current_matrix) \ ? MATRIX_MODE_LINE_HEIGHT ((W)->current_matrix) \ - : estimate_mode_line_height (XFRAME ((W)->frame), \ + : estimate_mode_line_height (XFRAME (WVAR (W, frame)), \ CURRENT_MODE_LINE_FACE_ID (W)))) /* Return the current height of the header line of window W. If not @@ -1387,7 +1387,7 @@ struct glyph_string ? current_header_line_height \ : (MATRIX_HEADER_LINE_HEIGHT ((W)->current_matrix) \ ? MATRIX_HEADER_LINE_HEIGHT ((W)->current_matrix) \ - : estimate_mode_line_height (XFRAME ((W)->frame), \ + : estimate_mode_line_height (XFRAME (WVAR (W, frame)),\ HEADER_LINE_FACE_ID))) /* Return the height of the desired mode line of window W. */ @@ -1406,8 +1406,8 @@ struct glyph_string (!MINI_WINDOW_P ((W)) \ && !(W)->pseudo_window_p \ && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \ - && BUFFERP ((W)->buffer) \ - && !NILP (BVAR (XBUFFER ((W)->buffer), mode_line_format)) \ + && BUFFERP (WVAR (W, buffer)) \ + && !NILP (BVAR (XBUFFER (WVAR (W, buffer)), mode_line_format)) \ && WINDOW_TOTAL_LINES (W) > 1) /* Value is non-zero if window W wants a header line. */ @@ -1416,9 +1416,10 @@ struct glyph_string (!MINI_WINDOW_P ((W)) \ && !(W)->pseudo_window_p \ && FRAME_WANTS_MODELINE_P (XFRAME (WINDOW_FRAME ((W)))) \ - && BUFFERP ((W)->buffer) \ - && !NILP (BVAR (XBUFFER ((W)->buffer), header_line_format)) \ - && WINDOW_TOTAL_LINES (W) > 1 + !NILP (BVAR (XBUFFER ((W)->buffer), mode_line_format))) + && BUFFERP (WVAR (W, buffer)) \ + && !NILP (BVAR (XBUFFER (WVAR (W, buffer)), header_line_format)) \ + && WINDOW_TOTAL_LINES (W) > 1 \ + + !NILP (BVAR (XBUFFER (WVAR (W, buffer)), mode_line_format))) /* Return proper value to be used as baseline offset of font that has diff --git a/src/dispnew.c b/src/dispnew.c index af3e0981d5..f6b5e42607 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -265,9 +265,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 (WVAR (w, buffer)) + && STRINGP (BVAR (XBUFFER (WVAR (w, buffer)), name))) + ? SSDATA (BVAR (XBUFFER (WVAR (w, buffer)), name)) : "???"), paused_p ? " ***paused***" : "", msg); @@ -405,7 +405,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 (WVAR (w, total_cols)); double d = max (0, XFLOATINT (margin)); d = min (width / 2 - 1, d); n = (int) ((double) total_glyphs / width * d); @@ -475,8 +475,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, WVAR (w, left_margin_cols)); + right = margin_glyphs_to_reserve (w, dim.width, WVAR (w, right_margin_cols)); eassert (left >= 0 && right >= 0); marginal_areas_changed_p = (left != matrix->left_margin_glyphs || right != matrix->right_margin_glyphs); @@ -515,9 +515,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); + WVAR (w, left_margin_cols)); right = margin_glyphs_to_reserve (w, dim.width, - w->right_margin_cols); + WVAR (w, right_margin_cols)); } else left = right = 0; @@ -640,9 +640,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 (WVAR (w, window_end_vpos)) + && XFASTINT (WVAR (w, window_end_vpos)) >= i) + WVAR (w, window_end_valid) = Qnil; while (i < matrix->nrows) matrix->rows[i++].enabled_p = 0; @@ -882,15 +882,15 @@ clear_window_matrices (struct window *w, int desired_p) { while (w) { - if (!NILP (w->hchild)) + if (!NILP (WVAR (w, hchild))) { - eassert (WINDOWP (w->hchild)); - clear_window_matrices (XWINDOW (w->hchild), desired_p); + eassert (WINDOWP (WVAR (w, hchild))); + clear_window_matrices (XWINDOW (WVAR (w, hchild)), desired_p); } - else if (!NILP (w->vchild)) + else if (!NILP (WVAR (w, vchild))) { - eassert (WINDOWP (w->vchild)); - clear_window_matrices (XWINDOW (w->vchild), desired_p); + eassert (WINDOWP (WVAR (w, vchild))); + clear_window_matrices (XWINDOW (WVAR (w, vchild)), desired_p); } else { @@ -899,11 +899,11 @@ clear_window_matrices (struct window *w, int desired_p) else { clear_glyph_matrix (w->current_matrix); - w->window_end_valid = Qnil; + WVAR (w, window_end_valid) = Qnil; } } - w = NILP (w->next) ? 0 : XWINDOW (w->next); + w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next)); } } @@ -967,7 +967,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 (WVAR (w, frame))); row->visible_height = row->height; if (row->y < min_y) @@ -1513,7 +1513,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 (WVAR (w, buffer)); int c; /* This can sometimes happen for a fresh window. */ @@ -1676,8 +1676,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 (WVAR (XWINDOW (window), parent)) + && !NILP (WVAR (XWINDOW (WVAR (XWINDOW (window), parent)), hchild))); /* For WINDOW and all windows on the same level. */ do @@ -1686,12 +1686,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 (WVAR (w, hchild))) + dim = allocate_matrices_for_frame_redisplay (WVAR (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 (WVAR (w, vchild))) + dim = allocate_matrices_for_frame_redisplay (WVAR (w, vchild), x, y, dim_only_p, window_change_flags); else @@ -1715,10 +1715,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) + WVAR (w, left_margin_cols)) != w->desired_matrix->left_margin_glyphs) || (margin_glyphs_to_reserve (w, dim.width, - w->right_margin_cols) + WVAR (w, right_margin_cols)) != w->desired_matrix->right_margin_glyphs)) *window_change_flags |= CHANGED_LEAF_MATRIX; @@ -1747,7 +1747,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 = WVAR (w, next); } while (!NILP (window)); @@ -1778,7 +1778,7 @@ static int required_matrix_height (struct window *w) { #ifdef HAVE_WINDOW_SYSTEM - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); if (FRAME_WINDOW_P (f)) { @@ -1804,7 +1804,7 @@ static int required_matrix_width (struct window *w) { #ifdef HAVE_WINDOW_SYSTEM - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); if (FRAME_WINDOW_P (f)) { int ch_width = FRAME_SMALLEST_CHAR_WIDTH (f); @@ -1821,7 +1821,7 @@ required_matrix_width (struct window *w) } #endif /* HAVE_WINDOW_SYSTEM */ - return XINT (w->total_cols); + return XINT (WVAR (w, total_cols)); } @@ -1833,10 +1833,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 (WVAR (w, vchild))) + allocate_matrices_for_window_redisplay (XWINDOW (WVAR (w, vchild))); + else if (!NILP (WVAR (w, hchild))) + allocate_matrices_for_window_redisplay (XWINDOW (WVAR (w, hchild))); else { /* W is a leaf window. */ @@ -1855,7 +1855,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 (WVAR (w, next)) ? NULL : XWINDOW (WVAR (w, next)); } } @@ -1902,20 +1902,20 @@ adjust_frame_glyphs_initially (void) { struct frame *sf = SELECTED_FRAME (); struct window *root = XWINDOW (FVAR (sf, root_window)); - struct window *mini = XWINDOW (root->next); + struct window *mini = XWINDOW (WVAR (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); + XSETFASTINT (WVAR (root, top_line), top_margin); + XSETFASTINT (WVAR (root, total_lines), frame_lines - 1 - top_margin); + XSETFASTINT (WVAR (root, total_cols), 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); + XSETFASTINT (WVAR (mini, top_line), frame_lines - 1); + XSETFASTINT (WVAR (mini, total_lines), 1); + XSETFASTINT (WVAR (mini, total_cols), frame_cols); adjust_frame_glyphs (sf); glyphs_initialized_initially_p = 1; @@ -1947,21 +1947,21 @@ showing_window_margins_p (struct window *w) { while (w) { - if (!NILP (w->hchild)) + if (!NILP (WVAR (w, hchild))) { - if (showing_window_margins_p (XWINDOW (w->hchild))) + if (showing_window_margins_p (XWINDOW (WVAR (w, hchild)))) return 1; } - else if (!NILP (w->vchild)) + else if (!NILP (WVAR (w, vchild))) { - if (showing_window_margins_p (XWINDOW (w->vchild))) + if (showing_window_margins_p (XWINDOW (WVAR (w, vchild)))) return 1; } - else if (!NILP (w->left_margin_cols) - || !NILP (w->right_margin_cols)) + else if (!NILP (WVAR (w, left_margin_cols)) + || !NILP (WVAR (w, right_margin_cols))) return 1; - w = NILP (w->next) ? 0 : XWINDOW (w->next); + w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next)); } return 0; } @@ -1975,18 +1975,18 @@ fake_current_matrices (Lisp_Object window) { struct window *w; - for (; !NILP (window); window = w->next) + for (; !NILP (window); window = WVAR (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 (WVAR (w, hchild))) + fake_current_matrices (WVAR (w, hchild)); + else if (!NILP (WVAR (w, vchild))) + fake_current_matrices (WVAR (w, vchild)); else { int i; - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); struct glyph_matrix *m = w->current_matrix; struct glyph_matrix *fm = f->current_matrix; @@ -2188,7 +2188,7 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f) { FVAR (f, menu_bar_window) = make_window (); w = XWINDOW (FVAR (f, menu_bar_window)); - XSETFRAME (w->frame, f); + XSETFRAME (WVAR (w, frame), f); w->pseudo_window_p = 1; } else @@ -2196,10 +2196,10 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f) /* 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)); + XSETFASTINT (WVAR (w, top_line), 0); + XSETFASTINT (WVAR (w, left_col), 0); + XSETFASTINT (WVAR (w, total_lines), FRAME_MENU_BAR_LINES (f)); + XSETFASTINT (WVAR (w, total_cols), FRAME_TOTAL_COLS (f)); allocate_matrices_for_window_redisplay (w); } #endif /* not USE_X_TOOLKIT && not USE_GTK */ @@ -2214,16 +2214,16 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f) { FVAR (f, tool_bar_window) = make_window (); w = XWINDOW (FVAR (f, tool_bar_window)); - XSETFRAME (w->frame, f); + XSETFRAME (WVAR (w, frame), f); w->pseudo_window_p = 1; } else w = XWINDOW (FVAR (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)); + XSETFASTINT (WVAR (w, top_line), FRAME_MENU_BAR_LINES (f)); + XSETFASTINT (WVAR (w, left_col), 0); + XSETFASTINT (WVAR (w, total_lines), FRAME_TOOL_BAR_LINES (f)); + XSETFASTINT (WVAR (w, total_cols), FRAME_TOTAL_COLS (f)); allocate_matrices_for_window_redisplay (w); } #endif @@ -2333,10 +2333,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 (WVAR (w, hchild))) + free_window_matrices (XWINDOW (WVAR (w, hchild))); + else if (!NILP (WVAR (w, vchild))) + free_window_matrices (XWINDOW (WVAR (w, vchild))); else { /* This is a leaf window. Free its memory and reset fields @@ -2348,7 +2348,7 @@ free_window_matrices (struct window *w) } /* Next window on same level. */ - w = NILP (w->next) ? 0 : XWINDOW (w->next); + w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next)); } } @@ -2469,14 +2469,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 (WVAR (w, hchild))) + build_frame_matrix_from_window_tree (matrix, XWINDOW (WVAR (w, hchild))); + else if (!NILP (WVAR (w, vchild))) + build_frame_matrix_from_window_tree (matrix, XWINDOW (WVAR (w, vchild))); else build_frame_matrix_from_leaf_window (matrix, w); - w = NILP (w->next) ? 0 : XWINDOW (w->next); + w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next)); } } @@ -2615,7 +2615,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 (WVAR (w, frame)), Qt, lface_id, DEFAULT_FACE_ID); SET_GLYPH_FACE (*glyph, face_id); } @@ -2736,10 +2736,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 (WVAR (w, hchild))) + mirror_make_current (XWINDOW (WVAR (w, hchild)), frame_row); + else if (!NILP (WVAR (w, vchild))) + mirror_make_current (XWINDOW (WVAR (w, vchild)), frame_row); else { /* Row relative to window W. Don't use FRAME_TO_WINDOW_VPOS @@ -2772,7 +2772,7 @@ mirror_make_current (struct window *w, int frame_row) } } - w = NILP (w->next) ? 0 : XWINDOW (w->next); + w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next)); } } @@ -2831,16 +2831,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 (WVAR (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 (WVAR (w, hchild)) && NILP (WVAR (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, WVAR (w, left_margin_cols)); + right = margin_glyphs_to_reserve (w, 1, WVAR (w, right_margin_cols)); x = w->current_matrix->matrix_x; width = w->current_matrix->matrix_w; @@ -2872,15 +2872,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 (WVAR (w, hchild))) + found = frame_row_to_window (XWINDOW (WVAR (w, hchild)), row); + else if (!NILP (WVAR (w, vchild))) + found = frame_row_to_window (XWINDOW (WVAR (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 (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next)); } return found; @@ -2903,11 +2903,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 (WVAR (w, hchild))) + mirror_line_dance (XWINDOW (WVAR (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 (WVAR (w, vchild))) + mirror_line_dance (XWINDOW (WVAR (w, vchild)), unchanged_at_top, nlines, copy_from, retained_p); else { @@ -2963,7 +2963,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 (WVAR (w, frame)); struct window *root = XWINDOW (FRAME_ROOT_WINDOW (f)); struct window *w2; struct glyph_matrix *m2; @@ -3000,7 +3000,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 (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next)); } } @@ -3018,18 +3018,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 (WVAR (w, hchild))) + check_window_matrix_pointers (XWINDOW (WVAR (w, hchild))); + else if (!NILP (WVAR (w, vchild))) + check_window_matrix_pointers (XWINDOW (WVAR (w, vchild))); else { - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (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 (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next)); } } @@ -3077,10 +3077,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 (WVAR (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 (WVAR (w, frame)))); return vpos; } @@ -3091,7 +3091,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 (WVAR (w, frame)))); hpos += WINDOW_LEFT_EDGE_COL (w); return hpos; } @@ -3311,14 +3311,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 (WVAR (w, hchild))) + paused_p |= update_window_tree (XWINDOW (WVAR (w, hchild)), force_p); + else if (!NILP (WVAR (w, vchild))) + paused_p |= update_window_tree (XWINDOW (WVAR (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 (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next)); } return paused_p; @@ -3806,7 +3806,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 (WVAR (w, frame)), &left, &right); can_skip_p = (right == 0 && !abort_skipping); } @@ -3838,7 +3838,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 (WVAR (w, frame)), &left, &right); while (left > 0 && i > 0) { @@ -3981,7 +3982,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 (WVAR (w, left_margin_cols))) { changed_p = 1; update_marginal_area (w, LEFT_MARGIN_AREA, vpos); @@ -3997,7 +3998,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 (WVAR (w, right_margin_cols))) { changed_p = 1; update_marginal_area (w, RIGHT_MARGIN_AREA, vpos); @@ -4030,7 +4031,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 (WVAR (w, frame)); struct redisplay_interface *rif = FRAME_RIF (f); int cx, cy, vpos, hpos; @@ -4116,14 +4117,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 (WVAR (w, hchild))) + set_window_update_flags (XWINDOW (WVAR (w, hchild)), on_p); + else if (!NILP (WVAR (w, vchild))) + set_window_update_flags (XWINDOW (WVAR (w, vchild)), on_p); else w->must_be_updated_p = on_p; - w = NILP (w->next) ? 0 : XWINDOW (w->next); + w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next)); } } @@ -4806,8 +4807,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 (WVAR (w, left_margin_cols))) + x += XFASTINT (WVAR (w, left_margin_cols)); /* x = max (min (x, FRAME_TOTAL_COLS (f) - 1), 0); */ cursor_to (f, y, x); @@ -5297,9 +5298,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 (WVAR (w, buffer)); itdata = bidi_shelve_cache (); - SET_TEXT_POS_FROM_MARKER (startp, w->start); + SET_TEXT_POS_FROM_MARKER (startp, WVAR (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); @@ -5343,7 +5344,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 = WVAR (w, buffer); if (STRINGP (it.string)) string = it.string; *pos = it.current; @@ -5361,7 +5362,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 (WVAR (w, buffer)), CHARPOS (pos->pos)); } @@ -5761,7 +5762,7 @@ change_frame_size_1 (register struct frame *f, int newheight, int newwidth, int FrameCols (FRAME_TTY (f)) = newwidth; if (WINDOWP (FVAR (f, tool_bar_window))) - XSETFASTINT (XWINDOW (FVAR (f, tool_bar_window))->total_cols, newwidth); + XSETFASTINT (WVAR (XWINDOW (FVAR (f, tool_bar_window)), total_cols), newwidth); } FRAME_LINES (f) = newheight; diff --git a/src/editfns.c b/src/editfns.c index dda6371369..e657b3ec53 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -366,7 +366,7 @@ get_pos_property (Lisp_Object position, register Lisp_Object prop, Lisp_Object o if (NILP (object)) XSETBUFFER (object, current_buffer); else if (WINDOWP (object)) - object = XWINDOW (object)->buffer; + object = WVAR (XWINDOW (object), buffer); if (!BUFFERP (object)) /* pos-property only makes sense in buffers right now, since strings @@ -821,7 +821,7 @@ This function does not move point. */) Lisp_Object save_excursion_save (void) { - int visible = (XBUFFER (XWINDOW (selected_window)->buffer) + int visible = (XBUFFER (WVAR (XWINDOW (selected_window), buffer)) == current_buffer); return Fcons (Fpoint_marker (), @@ -874,7 +874,7 @@ save_excursion_restore (Lisp_Object info) and cleaner never to alter the window/buffer connections. */ tem1 = Fcar (tem); if (!NILP (tem1) - && current_buffer != XBUFFER (XWINDOW (selected_window)->buffer)) + && current_buffer != XBUFFER (WVAR (XWINDOW (selected_window), buffer))) Fswitch_to_buffer (Fcurrent_buffer (), Qnil); #endif /* 0 */ @@ -907,7 +907,7 @@ save_excursion_restore (Lisp_Object info) tem = XCDR (info); if (visible_p && !EQ (tem, selected_window) - && (tem1 = XWINDOW (tem)->buffer, + && (tem1 = WVAR (XWINDOW (tem), buffer), (/* Window is live... */ BUFFERP (tem1) /* ...and it shows the current buffer. */ diff --git a/src/fileio.c b/src/fileio.c index a13fe94e41..4471032319 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -3731,7 +3731,7 @@ variable `last-coding-system-used' to the coding system actually used. */) /* If display currently starts at beginning of line, keep it that way. */ - if (XBUFFER (XWINDOW (selected_window)->buffer) == current_buffer) + if (XBUFFER (WVAR (XWINDOW (selected_window), buffer)) == current_buffer) XWINDOW (selected_window)->start_at_line_beg = !NILP (Fbolp ()); replace_handled = 1; @@ -3888,7 +3888,7 @@ variable `last-coding-system-used' to the coding system actually used. */) /* If display currently starts at beginning of line, keep it that way. */ - if (XBUFFER (XWINDOW (selected_window)->buffer) == current_buffer) + if (XBUFFER (WVAR (XWINDOW (selected_window), buffer)) == current_buffer) XWINDOW (selected_window)->start_at_line_beg = !NILP (Fbolp ()); /* Replace the chars that we need to replace, diff --git a/src/font.c b/src/font.c index 2c0296aa8c..db454dd6a2 100644 --- a/src/font.c +++ b/src/font.c @@ -3665,7 +3665,7 @@ font_at (int c, ptrdiff_t pos, struct face *face, struct window *w, } } - f = XFRAME (w->frame); + f = XFRAME (WVAR (w, frame)); if (! FRAME_WINDOW_P (f)) return Qnil; if (! face) @@ -3723,7 +3723,7 @@ font_range (ptrdiff_t pos, ptrdiff_t *limit, struct window *w, struct face *face face_id = face_at_buffer_position (w, pos, 0, 0, &ignore, *limit, 0, -1); - face = FACE_FROM_ID (XFRAME (w->frame), face_id); + face = FACE_FROM_ID (XFRAME (WVAR (w, frame)), face_id); } } else diff --git a/src/fontset.c b/src/fontset.c index 1efcc3ee4e..858a2e3cd3 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -1841,7 +1841,7 @@ DEFUN ("internal-char-font", Finternal_char_font, Sinternal_char_font, 1, 2, 0, if (NILP (window)) return Qnil; w = XWINDOW (window); - f = XFRAME (w->frame); + f = XFRAME (WVAR (w, frame)); face_id = face_at_buffer_position (w, pos, -1, -1, &dummy, pos + 100, 0, -1); } diff --git a/src/frame.c b/src/frame.c index 9a1628e4ad..9389eccb6f 100644 --- a/src/frame.c +++ b/src/frame.c @@ -132,15 +132,15 @@ set_menu_bar_lines_1 (Lisp_Object window, int n) struct window *w = XWINDOW (window); w->last_modified = 0; - XSETFASTINT (w->top_line, XFASTINT (w->top_line) + n); - XSETFASTINT (w->total_lines, XFASTINT (w->total_lines) - n); + XSETFASTINT (WVAR (w, top_line), XFASTINT (WVAR (w, top_line)) + n); + XSETFASTINT (WVAR (w, total_lines), XFASTINT (WVAR (w, total_lines)) - n); /* Handle just the top child in a vertical split. */ - if (!NILP (w->vchild)) - set_menu_bar_lines_1 (w->vchild, n); + if (!NILP (WVAR (w, vchild))) + set_menu_bar_lines_1 (WVAR (w, vchild), n); /* Adjust all children in a horizontal split. */ - for (window = w->hchild; !NILP (window); window = w->next) + for (window = WVAR (w, hchild); !NILP (window); window = WVAR (w, next)) { w = XWINDOW (window); set_menu_bar_lines_1 (window, n); @@ -289,20 +289,20 @@ make_frame (int mini_p) if (mini_p) { mini_window = make_window (); - XWINDOW (root_window)->next = mini_window; - XWINDOW (mini_window)->prev = root_window; + WVAR (XWINDOW (root_window), next) = mini_window; + WVAR (XWINDOW (mini_window), prev) = root_window; XWINDOW (mini_window)->mini = 1; - XWINDOW (mini_window)->frame = frame; + WVAR (XWINDOW (mini_window), frame) = frame; FVAR (f, minibuffer_window) = mini_window; } else { mini_window = Qnil; - XWINDOW (root_window)->next = Qnil; + WVAR (XWINDOW (root_window), next) = Qnil; FVAR (f, minibuffer_window) = Qnil; } - XWINDOW (root_window)->frame = frame; + WVAR (XWINDOW (root_window), frame) = frame; /* 10 is arbitrary, just so that there is "something there." @@ -311,21 +311,21 @@ make_frame (int mini_p) SET_FRAME_COLS (f, 10); FRAME_LINES (f) = 10; - XSETFASTINT (XWINDOW (root_window)->total_cols, 10); - XSETFASTINT (XWINDOW (root_window)->total_lines, (mini_p ? 9 : 10)); + XSETFASTINT (WVAR (XWINDOW (root_window), total_cols), 10); + XSETFASTINT (WVAR (XWINDOW (root_window), total_lines), (mini_p ? 9 : 10)); if (mini_p) { - XSETFASTINT (XWINDOW (mini_window)->total_cols, 10); - XSETFASTINT (XWINDOW (mini_window)->top_line, 9); - XSETFASTINT (XWINDOW (mini_window)->total_lines, 1); + XSETFASTINT (WVAR (XWINDOW (mini_window), total_cols), 10); + XSETFASTINT (WVAR (XWINDOW (mini_window), top_line), 9); + XSETFASTINT (WVAR (XWINDOW (mini_window), total_lines), 1); } /* Choose a buffer for the frame's root window. */ { Lisp_Object buf; - XWINDOW (root_window)->buffer = Qt; + WVAR (XWINDOW (root_window), buffer) = Qt; buf = Fcurrent_buffer (); /* If buf is a 'hidden' buffer (i.e. one whose name starts with a space), try to find another one. */ @@ -344,7 +344,7 @@ make_frame (int mini_p) if (mini_p) { - XWINDOW (mini_window)->buffer = Qt; + WVAR (XWINDOW (mini_window), buffer) = Qt; set_window_buffer (mini_window, (NILP (Vminibuffer_list) ? get_minibuffer (0) @@ -376,7 +376,7 @@ make_frame_without_minibuffer (register Lisp_Object mini_window, KBOARD *kb, Lis CHECK_LIVE_WINDOW (mini_window); if (!NILP (mini_window) - && FRAME_KBOARD (XFRAME (XWINDOW (mini_window)->frame)) != kb) + && FRAME_KBOARD (XFRAME (WVAR (XWINDOW (mini_window), frame))) != kb) error ("Frame and minibuffer must be on the same terminal"); /* Make a frame containing just a root window. */ @@ -406,7 +406,7 @@ make_frame_without_minibuffer (register Lisp_Object mini_window, KBOARD *kb, Lis /* Make the chosen minibuffer window display the proper minibuffer, unless it is already showing a minibuffer. */ - if (NILP (Fmemq (XWINDOW (mini_window)->buffer, Vminibuffer_list))) + if (NILP (Fmemq (WVAR (XWINDOW (mini_window), buffer), Vminibuffer_list))) Fset_window_buffer (mini_window, (NILP (Vminibuffer_list) ? get_minibuffer (0) @@ -439,9 +439,9 @@ make_minibuffer_frame (void) mini_window = FVAR (f, minibuffer_window) = FVAR (f, root_window); XWINDOW (mini_window)->mini = 1; - XWINDOW (mini_window)->next = Qnil; - XWINDOW (mini_window)->prev = Qnil; - XWINDOW (mini_window)->frame = frame; + WVAR (XWINDOW (mini_window), next) = Qnil; + WVAR (XWINDOW (mini_window), prev) = Qnil; + WVAR (XWINDOW (mini_window), frame) = frame; /* Put the proper buffer in that window. */ @@ -1241,7 +1241,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) if (EQ (FVAR (f, minibuffer_window), minibuf_window)) { Fset_window_buffer (FVAR (sf, minibuffer_window), - XWINDOW (minibuf_window)->buffer, Qnil); + WVAR (XWINDOW (minibuf_window), buffer), Qnil); minibuf_window = FVAR (sf, minibuffer_window); /* If the dying minibuffer window was selected, @@ -1672,17 +1672,17 @@ make_frame_visible_1 (Lisp_Object window) { struct window *w; - for (;!NILP (window); window = w->next) + for (;!NILP (window); window = WVAR (w, next)) { w = XWINDOW (window); - if (!NILP (w->buffer)) - BVAR (XBUFFER (w->buffer), display_time) = Fcurrent_time (); + if (!NILP (WVAR (w, buffer))) + BVAR (XBUFFER (WVAR (w, buffer)), display_time) = Fcurrent_time (); - if (!NILP (w->vchild)) - make_frame_visible_1 (w->vchild); - if (!NILP (w->hchild)) - make_frame_visible_1 (w->hchild); + if (!NILP (WVAR (w, vchild))) + make_frame_visible_1 (WVAR (w, vchild)); + if (!NILP (WVAR (w, hchild))) + make_frame_visible_1 (WVAR (w, hchild)); } } @@ -1714,7 +1714,7 @@ displayed in the terminal. */) { struct frame *sf = XFRAME (selected_frame); Fset_window_buffer (FVAR (sf, minibuffer_window), - XWINDOW (minibuf_window)->buffer, Qnil); + WVAR (XWINDOW (minibuf_window), buffer), Qnil); minibuf_window = FVAR (sf, minibuffer_window); } @@ -1752,7 +1752,7 @@ If omitted, FRAME defaults to the currently selected frame. */) { struct frame *sf = XFRAME (selected_frame); Fset_window_buffer (FVAR (sf, minibuffer_window), - XWINDOW (minibuf_window)->buffer, Qnil); + WVAR (XWINDOW (minibuf_window), buffer), Qnil); minibuf_window = FVAR (sf, minibuffer_window); } diff --git a/src/frame.h b/src/frame.h index 1a1f887334..22c0125ace 100644 --- a/src/frame.h +++ b/src/frame.h @@ -511,7 +511,7 @@ typedef struct frame *FRAME_PTR; #define XSETFRAME(a, b) (XSETPSEUDOVECTOR (a, b, PVEC_FRAME)) /* Given a window, return its frame as a Lisp_Object. */ -#define WINDOW_FRAME(w) (w)->frame +#define WINDOW_FRAME(w) WVAR (w, frame) /* Test a frame for particular kinds of display methods. */ #define FRAME_INITIAL_P(f) ((f)->output_method == output_initial) diff --git a/src/fringe.c b/src/fringe.c index 8ee4ae7bf1..374522989f 100644 --- a/src/fringe.c +++ b/src/fringe.c @@ -692,7 +692,7 @@ get_logical_cursor_bitmap (struct window *w, Lisp_Object cursor) { Lisp_Object cmap, bm = Qnil; - if ((cmap = BVAR (XBUFFER (w->buffer), fringe_cursor_alist)), !NILP (cmap)) + if ((cmap = BVAR (XBUFFER (WVAR (w, buffer)), fringe_cursor_alist)), !NILP (cmap)) { bm = Fassq (cursor, cmap); if (CONSP (bm)) @@ -729,7 +729,7 @@ get_logical_fringe_bitmap (struct window *w, Lisp_Object bitmap, int right_p, in If partial, lookup partial bitmap in default value if not found here. If not partial, or no partial spec is present, use non-partial bitmap. */ - if ((cmap = BVAR (XBUFFER (w->buffer), fringe_indicator_alist)), !NILP (cmap)) + if ((cmap = BVAR (XBUFFER (WVAR (w, buffer)), fringe_indicator_alist)), !NILP (cmap)) { bm1 = Fassq (bitmap, cmap); if (CONSP (bm1)) @@ -956,7 +956,7 @@ update_window_fringes (struct window *w, int keep_current_p) return 0; if (!MINI_WINDOW_P (w) - && (ind = BVAR (XBUFFER (w->buffer), indicate_buffer_boundaries), !NILP (ind))) + && (ind = BVAR (XBUFFER (WVAR (w, buffer)), indicate_buffer_boundaries), !NILP (ind))) { if (EQ (ind, Qleft) || EQ (ind, Qright)) boundary_top = boundary_bot = arrow_top = arrow_bot = ind; @@ -997,7 +997,7 @@ update_window_fringes (struct window *w, int keep_current_p) { if (top_ind_rn < 0 && row->visible_height > 0) { - if (MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER (w->buffer)) + if (MATRIX_ROW_START_CHARPOS (row) <= BUF_BEGV (XBUFFER (WVAR (w, buffer))) && !MATRIX_ROW_PARTIALLY_VISIBLE_AT_TOP_P (w, row)) row->indicate_bob_p = !NILP (boundary_top); else @@ -1007,7 +1007,7 @@ update_window_fringes (struct window *w, int keep_current_p) if (bot_ind_rn < 0) { - if (MATRIX_ROW_END_CHARPOS (row) >= BUF_ZV (XBUFFER (w->buffer)) + if (MATRIX_ROW_END_CHARPOS (row) >= BUF_ZV (XBUFFER (WVAR (w, buffer))) && !MATRIX_ROW_PARTIALLY_VISIBLE_AT_BOTTOM_P (w, row)) row->indicate_eob_p = !NILP (boundary_bot), bot_ind_rn = rn; else if (y + row->height >= yb) @@ -1017,7 +1017,7 @@ update_window_fringes (struct window *w, int keep_current_p) } } - empty_pos = BVAR (XBUFFER (w->buffer), indicate_empty_lines); + empty_pos = BVAR (XBUFFER (WVAR (w, buffer)), indicate_empty_lines); if (!NILP (empty_pos) && !EQ (empty_pos, Qright)) empty_pos = WINDOW_LEFT_FRINGE_WIDTH (w) == 0 ? Qright : Qleft; @@ -1740,7 +1740,7 @@ Return nil if POS is not visible in WINDOW. */) else if (w == XWINDOW (selected_window)) textpos = PT; else - textpos = XMARKER (w->pointm)->charpos; + textpos = XMARKER (WVAR (w, pointm))->charpos; row = MATRIX_FIRST_TEXT_ROW (w->current_matrix); row = row_containing_pos (w, textpos, row, NULL, 0); diff --git a/src/indent.c b/src/indent.c index 38772bb384..a6a9a9a007 100644 --- a/src/indent.c +++ b/src/indent.c @@ -258,7 +258,7 @@ skip_invisible (ptrdiff_t pos, ptrdiff_t *next_boundary_p, ptrdiff_t to, Lisp_Ob the next property change */ prop = Fget_char_property (position, Qinvisible, (!NILP (window) - && EQ (XWINDOW (window)->buffer, buffer)) + && EQ (WVAR (XWINDOW (window), buffer), buffer)) ? window : buffer); inv_p = TEXT_PROP_MEANS_INVISIBLE (prop); /* When counting columns (window == nil), don't skip over ellipsis text. */ @@ -1173,14 +1173,14 @@ compute_motion (ptrdiff_t from, EMACS_INT fromvpos, EMACS_INT fromhpos, int did_ width = window_body_cols (win); /* We must make room for continuation marks if we don't have fringes. */ #ifdef HAVE_WINDOW_SYSTEM - if (!FRAME_WINDOW_P (XFRAME (win->frame))) + if (!FRAME_WINDOW_P (XFRAME (WVAR (win, frame)))) #endif width -= 1; } continuation_glyph_width = 1; #ifdef HAVE_WINDOW_SYSTEM - if (FRAME_WINDOW_P (XFRAME (win->frame))) + if (FRAME_WINDOW_P (XFRAME (WVAR (win, frame)))) continuation_glyph_width = 0; /* In the fringe. */ #endif @@ -1787,7 +1787,7 @@ visible section of the buffer, and pass LINE and COL as TOPOS. */) ? (window_body_cols (w) - ( #ifdef HAVE_WINDOW_SYSTEM - FRAME_WINDOW_P (XFRAME (w->frame)) ? 0 : + FRAME_WINDOW_P (XFRAME (WVAR (w, frame))) ? 0 : #endif 1)) : XINT (XCAR (topos))), @@ -1837,7 +1837,7 @@ vmotion (register ptrdiff_t from, register EMACS_INT vtarget, struct window *w) /* If the window contains this buffer, use it for getting text properties. Otherwise use the current buffer as arg for doing that. */ - if (EQ (w->buffer, Fcurrent_buffer ())) + if (EQ (WVAR (w, buffer), Fcurrent_buffer ())) text_prop_object = window; else text_prop_object = Fcurrent_buffer (); @@ -1998,15 +1998,15 @@ whether or not it is currently displayed in some window. */) old_buffer = Qnil; GCPRO3 (old_buffer, old_charpos, old_bytepos); - if (XBUFFER (w->buffer) != current_buffer) + if (XBUFFER (WVAR (w, buffer)) != current_buffer) { /* Set the window's buffer temporarily to the current buffer. */ - old_buffer = w->buffer; - old_charpos = XMARKER (w->pointm)->charpos; - old_bytepos = XMARKER (w->pointm)->bytepos; - XSETBUFFER (w->buffer, current_buffer); - set_marker_both - (w->pointm, w->buffer, BUF_PT (current_buffer), BUF_PT_BYTE (current_buffer)); + old_buffer = WVAR (w, buffer); + old_charpos = XMARKER (WVAR (w, pointm))->charpos; + old_bytepos = XMARKER (WVAR (w, pointm))->bytepos; + XSETBUFFER (WVAR (w, buffer), current_buffer); + set_marker_both (WVAR (w, pointm), WVAR (w, buffer), + BUF_PT (current_buffer), BUF_PT_BYTE (current_buffer)); } if (noninteractive) @@ -2137,7 +2137,7 @@ whether or not it is currently displayed in some window. */) } move_it_in_display_line (&it, ZV, - (int)(cols * FRAME_COLUMN_WIDTH (XFRAME (w->frame)) + 0.5), + (int)(cols * FRAME_COLUMN_WIDTH (XFRAME (WVAR (w, frame))) + 0.5), MOVE_TO_X); } @@ -2147,8 +2147,9 @@ whether or not it is currently displayed in some window. */) if (BUFFERP (old_buffer)) { - w->buffer = old_buffer; - set_marker_both (w->pointm, w->buffer, old_charpos, old_bytepos); + WVAR (w, buffer) = old_buffer; + set_marker_both (WVAR (w, pointm), WVAR (w, buffer), + old_charpos, old_bytepos); } RETURN_UNGCPRO (make_number (it.vpos)); diff --git a/src/insdel.c b/src/insdel.c index 9646507bc4..705cd77dc0 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -1820,7 +1820,7 @@ prepare_to_modify_buffer (ptrdiff_t start, ptrdiff_t end, /* Let redisplay consider other windows than selected_window if modifying another buffer. */ - if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) + if (XBUFFER (WVAR (XWINDOW (selected_window), buffer)) != current_buffer) ++windows_or_buffers_changed; if (BUF_INTERVALS (current_buffer) != 0) diff --git a/src/keyboard.c b/src/keyboard.c index d8533b796c..a8e7beddbc 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -800,7 +800,7 @@ This function is called by the editor initialization to begin editing. */) update_mode_lines = 1; if (command_loop_level - && current_buffer != XBUFFER (XWINDOW (selected_window)->buffer)) + && current_buffer != XBUFFER (WVAR (XWINDOW (selected_window), buffer))) buffer = Fcurrent_buffer (); else buffer = Qnil; @@ -1382,8 +1382,8 @@ command_loop_1 (void) Fkill_emacs (Qnil); /* Make sure the current window's buffer is selected. */ - if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) - set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer)); + if (XBUFFER (WVAR (XWINDOW (selected_window), buffer)) != current_buffer) + set_buffer_internal (XBUFFER (WVAR (XWINDOW (selected_window), buffer))); /* Display any malloc warning that just came out. Use while because displaying one warning can cause another. */ @@ -1452,8 +1452,8 @@ command_loop_1 (void) /* A filter may have run while we were reading the input. */ if (! FRAME_LIVE_P (XFRAME (selected_frame))) Fkill_emacs (Qnil); - if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) - set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer)); + if (XBUFFER (WVAR (XWINDOW (selected_window), buffer)) != current_buffer) + set_buffer_internal (XBUFFER (WVAR (XWINDOW (selected_window), buffer))); ++num_input_keys; @@ -1484,7 +1484,7 @@ command_loop_1 (void) { struct buffer *b; XWINDOW (selected_window)->force_start = 0; - b = XBUFFER (XWINDOW (selected_window)->buffer); + b = XBUFFER (WVAR (XWINDOW (selected_window), buffer)); BUF_BEG_UNCHANGED (b) = BUF_END_UNCHANGED (b) = 0; } @@ -5174,8 +5174,8 @@ make_lispy_position (struct frame *f, Lisp_Object x, Lisp_Object y, if (STRINGP (string)) string_info = Fcons (string, make_number (charpos)); textpos = (w == XWINDOW (selected_window) - && current_buffer == XBUFFER (w->buffer)) - ? PT : XMARKER (w->pointm)->charpos; + && current_buffer == XBUFFER (WVAR (w, buffer))) + ? PT : XMARKER (WVAR (w, pointm))->charpos; xret = wx; yret = wy; @@ -5563,7 +5563,7 @@ make_lispy_event (struct input_event *event) int fuzz; if (WINDOWP (event->frame_or_window)) - f = XFRAME (XWINDOW (event->frame_or_window)->frame); + f = XFRAME (WVAR (XWINDOW (event->frame_or_window), frame)); else if (FRAMEP (event->frame_or_window)) f = XFRAME (event->frame_or_window); else @@ -5731,7 +5731,7 @@ make_lispy_event (struct input_event *event) int is_double; if (WINDOWP (event->frame_or_window)) - fr = XFRAME (XWINDOW (event->frame_or_window)->frame); + fr = XFRAME (WVAR (XWINDOW (event->frame_or_window), frame)); else if (FRAMEP (event->frame_or_window)) fr = XFRAME (event->frame_or_window); else @@ -9395,8 +9395,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, { if (! FRAME_LIVE_P (XFRAME (selected_frame))) Fkill_emacs (Qnil); - if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) - Fset_buffer (XWINDOW (selected_window)->buffer); + if (XBUFFER (WVAR (XWINDOW (selected_window), buffer)) != current_buffer) + Fset_buffer (WVAR (XWINDOW (selected_window), buffer)); } orig_local_map = get_local_map (PT, current_buffer, Qlocal_map); @@ -9488,8 +9488,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, not the current buffer. If we're at the beginning of a key sequence, switch buffers. */ if (WINDOWP (window) - && BUFFERP (XWINDOW (window)->buffer) - && XBUFFER (XWINDOW (window)->buffer) != current_buffer) + && BUFFERP (WVAR (XWINDOW (window), buffer)) + && XBUFFER (WVAR (XWINDOW (window), buffer)) != current_buffer) { ASET (raw_keybuf, raw_keybuf_count, key); raw_keybuf_count++; @@ -9510,7 +9510,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, if (! FRAME_LIVE_P (XFRAME (selected_frame))) Fkill_emacs (Qnil); - set_buffer_internal (XBUFFER (XWINDOW (window)->buffer)); + set_buffer_internal (XBUFFER (WVAR (XWINDOW (window), buffer))); orig_local_map = get_local_map (PT, current_buffer, Qlocal_map); orig_keymap = get_local_map (PT, current_buffer, @@ -11194,7 +11194,7 @@ The `posn-' functions access elements of such lists. */) ? window_box_left_offset (w, TEXT_AREA) : 0))); XSETINT (y, WINDOW_TO_FRAME_PIXEL_Y (w, XINT (y))); - frame_or_window = w->frame; + frame_or_window = WVAR (w, frame); } CHECK_LIVE_FRAME (frame_or_window); diff --git a/src/keymap.c b/src/keymap.c index 3c5d45b068..ed8542249e 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -1560,8 +1560,8 @@ like in the respective argument of `key-binding'. */) window = POSN_WINDOW (position); if (WINDOWP (window) - && BUFFERP (XWINDOW (window)->buffer) - && XBUFFER (XWINDOW (window)->buffer) != current_buffer) + && BUFFERP (WVAR (XWINDOW (window), buffer)) + && XBUFFER (WVAR (XWINDOW (window), buffer)) != current_buffer) { /* Arrange to go back to the original buffer once we're done processing the key sequence. We don't use @@ -1573,7 +1573,7 @@ like in the respective argument of `key-binding'. */) record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); - set_buffer_internal (XBUFFER (XWINDOW (window)->buffer)); + set_buffer_internal (XBUFFER (WVAR (XWINDOW (window), buffer))); } } diff --git a/src/lisp.h b/src/lisp.h index 55f8677f9a..e1c0cc18d6 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -1748,7 +1748,8 @@ typedef struct { vchild, and hchild members are all nil. */ #define CHECK_LIVE_WINDOW(x) \ - CHECK_TYPE (WINDOWP (x) && !NILP (XWINDOW (x)->buffer), Qwindow_live_p, x) + CHECK_TYPE (WINDOWP (x) && !NILP (WVAR (XWINDOW (x), buffer)), \ + Qwindow_live_p, x) #define CHECK_PROCESS(x) \ CHECK_TYPE (PROCESSP (x), Qprocessp, x) diff --git a/src/minibuf.c b/src/minibuf.c index 5ece9d5d0d..4b9c0a32f8 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -115,7 +115,7 @@ choose_minibuf_frame (void) /* Under X, we come here with minibuf_window being the minibuffer window of the unused termcap window created in init_window_once. That window doesn't have a buffer. */ - buffer = XWINDOW (minibuf_window)->buffer; + buffer = WVAR (XWINDOW (minibuf_window), buffer); if (BUFFERP (buffer)) Fset_window_buffer (FVAR (sf, minibuffer_window), buffer, Qnil); minibuf_window = FVAR (sf, minibuffer_window); @@ -612,7 +612,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, FOR_EACH_FRAME (dummy, frame) { Lisp_Object root_window = Fframe_root_window (frame); - Lisp_Object mini_window = XWINDOW (root_window)->next; + Lisp_Object mini_window = WVAR (XWINDOW (root_window), next); if (! NILP (mini_window) && ! EQ (mini_window, minibuf_window) && !NILP (Fwindow_minibuffer_p (mini_window))) @@ -687,7 +687,7 @@ read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, XWINDOW (minibuf_window)->must_be_updated_p = 1; update_frame (XFRAME (selected_frame), 1, 1); { - struct frame *f = XFRAME (XWINDOW (minibuf_window)->frame); + struct frame *f = XFRAME (WVAR (XWINDOW (minibuf_window), frame)); struct redisplay_interface *rif = FRAME_RIF (f); if (rif && rif->flush_display) rif->flush_display (f); @@ -844,7 +844,7 @@ read_minibuf_unwind (Lisp_Object data) window = minibuf_window; /* To keep things predictable, in case it matters, let's be in the minibuffer when we reset the relevant variables. */ - Fset_buffer (XWINDOW (window)->buffer); + Fset_buffer (WVAR (XWINDOW (window), buffer)); /* Restore prompt, etc, from outer minibuffer level. */ minibuf_prompt = Fcar (minibuf_save_list); diff --git a/src/nsterm.m b/src/nsterm.m index f8557aaf3f..f13ec2795e 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -669,7 +669,7 @@ ns_update_window_end (struct window *w, int cursor_on_p, external (RIF) call; for one window called before update_end -------------------------------------------------------------------------- */ { - Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (WVAR (w, frame))); /* note: this fn is nearly identical in all terms */ if (!w->pseudo_window_p) @@ -2037,7 +2037,7 @@ ns_scroll_run (struct window *w, struct run *run) External (RIF): Insert or delete n lines at line vpos -------------------------------------------------------------------------- */ { - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); int x, y, width, height, from_y, to_y, bottom_y; NSTRACE (ns_scroll_run); @@ -2116,7 +2116,7 @@ ns_after_update_window_line (struct glyph_row *desired_row) full-width rows stays visible in the internal border. Under NS this is drawn inside the fringes. */ if (windows_or_buffers_changed - && (f = XFRAME (w->frame), + && (f = XFRAME (WVAR (w, frame)), width = FRAME_INTERNAL_BORDER_WIDTH (f), width != 0) && (height = desired_row->visible_height, diff --git a/src/print.c b/src/print.c index 0734245c24..5effec7fd4 100644 --- a/src/print.c +++ b/src/print.c @@ -1775,10 +1775,11 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag strout ("#sequence_number); strout (buf, len, len, printcharfun); - if (!NILP (XWINDOW (obj)->buffer)) + if (!NILP (WVAR (XWINDOW (obj), buffer))) { strout (" on ", -1, -1, printcharfun); - print_string (BVAR (XBUFFER (XWINDOW (obj)->buffer), name), printcharfun); + print_string (BVAR (XBUFFER (WVAR (XWINDOW (obj), buffer)), name), + printcharfun); } PRINTCHAR ('>'); } diff --git a/src/textprop.c b/src/textprop.c index 8aa52bebe5..ee5d82fa17 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -587,7 +587,7 @@ get_char_property_and_overlay (Lisp_Object position, register Lisp_Object prop, if (WINDOWP (object)) { w = XWINDOW (object); - object = w->buffer; + object = WVAR (w, buffer); } if (BUFFERP (object)) { diff --git a/src/w32fns.c b/src/w32fns.c index 57d3c73224..bbcda21ade 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -5617,7 +5617,7 @@ Text larger than the specified size is clipped. */) /* Set up the frame's root window. */ w = XWINDOW (FRAME_ROOT_WINDOW (f)); - w->left_col = w->top_line = make_number (0); + WVAR (w, left_col) = WVAR (w, top_line) = make_number (0); if (CONSP (Vx_max_tooltip_size) && INTEGERP (XCAR (Vx_max_tooltip_size)) @@ -5625,22 +5625,22 @@ Text larger than the specified size is clipped. */) && INTEGERP (XCDR (Vx_max_tooltip_size)) && XINT (XCDR (Vx_max_tooltip_size)) > 0) { - w->total_cols = XCAR (Vx_max_tooltip_size); - w->total_lines = XCDR (Vx_max_tooltip_size); + WVAR (w, total_cols) = XCAR (Vx_max_tooltip_size); + WVAR (w, total_lines) = XCDR (Vx_max_tooltip_size); } else { - w->total_cols = make_number (80); - w->total_lines = make_number (40); + WVAR (w, total_cols) = make_number (80); + WVAR (w, total_lines) = make_number (40); } - FRAME_TOTAL_COLS (f) = XINT (w->total_cols); + FRAME_TOTAL_COLS (f) = XINT (WVAR (w, total_cols)); adjust_glyphs (f); w->pseudo_window_p = 1; /* Display the tooltip text in a temporary buffer. */ old_buffer = current_buffer; - set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); + set_buffer_internal_1 (XBUFFER (WVAR (XWINDOW (FRAME_ROOT_WINDOW (f)), buffer))); BVAR (current_buffer, truncate_lines) = Qnil; clear_glyph_matrix (w->desired_matrix); clear_glyph_matrix (w->current_matrix); @@ -5702,7 +5702,7 @@ Text larger than the specified size is clipped. */) /* w->total_cols and FRAME_TOTAL_COLS want the width in columns, not in pixels. */ width /= WINDOW_FRAME_COLUMN_WIDTH (w); - w->total_cols = make_number (width); + WVAR (w, total_cols) = make_number (width); FRAME_TOTAL_COLS (f) = width; adjust_glyphs (f); w->pseudo_window_p = 1; diff --git a/src/w32menu.c b/src/w32menu.c index 193a818248..4545533c99 100644 --- a/src/w32menu.c +++ b/src/w32menu.c @@ -394,7 +394,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) if (! menubar_widget) previous_menu_items_used = 0; - buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer; + buffer = WVAR (XWINDOW (FRAME_SELECTED_WINDOW (f)), buffer); specbind (Qinhibit_quit, Qt); /* Don't let the debugger step into this code because it is not reentrant. */ diff --git a/src/w32term.c b/src/w32term.c index 9fc2cfb5ef..6b87ca4e88 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -649,7 +649,7 @@ static void x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritten_p) { - Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (WVAR (w, frame))); if (!w->pseudo_window_p) { @@ -754,7 +754,7 @@ x_after_update_window_line (struct glyph_row *desired_row) overhead is very small. */ if (windows_or_buffers_changed && desired_row->full_width_p - && (f = XFRAME (w->frame), + && (f = XFRAME (WVAR (w, frame)), width = FRAME_INTERNAL_BORDER_WIDTH (f), width != 0) && (height = desired_row->visible_height, @@ -2718,7 +2718,7 @@ x_ins_del_lines (struct frame *f, int vpos, int n) static void x_scroll_run (struct window *w, struct run *run) { - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); int x, y, width, height, from_y, to_y, bottom_y; HWND hwnd = FRAME_W32_WINDOW (f); HRGN expect_dirty; @@ -3668,7 +3668,7 @@ x_scroll_bar_remove (struct scroll_bar *bar) my_destroy_window (f, SCROLL_BAR_W32_WINDOW (bar)); /* Dissociate this scroll bar from its window. */ - XWINDOW (bar->window)->vertical_scroll_bar = Qnil; + WVAR (XWINDOW (bar->window), vertical_scroll_bar) = Qnil; UNBLOCK_INPUT; } @@ -3681,7 +3681,7 @@ static void w32_set_vertical_scroll_bar (struct window *w, int portion, int whole, int position) { - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); struct scroll_bar *bar; int top, height, left, sb_left, width, sb_width; int window_y, window_height; @@ -3721,7 +3721,7 @@ w32_set_vertical_scroll_bar (struct window *w, || WINDOW_RIGHT_MARGIN_COLS (w) == 0)); /* Does the scroll bar exist yet? */ - if (NILP (w->vertical_scroll_bar)) + if (NILP (WVAR (w, vertical_scroll_bar))) { HDC hdc; BLOCK_INPUT; @@ -3743,7 +3743,7 @@ w32_set_vertical_scroll_bar (struct window *w, /* It may just need to be moved and resized. */ HWND hwnd; - bar = XSCROLL_BAR (w->vertical_scroll_bar); + bar = XSCROLL_BAR (WVAR (w, vertical_scroll_bar)); hwnd = SCROLL_BAR_W32_WINDOW (bar); /* If already correctly positioned, do nothing. */ @@ -3805,7 +3805,7 @@ w32_set_vertical_scroll_bar (struct window *w, w32_set_scroll_bar_thumb (bar, portion, position, whole); - XSETVECTOR (w->vertical_scroll_bar, bar); + XSETVECTOR (WVAR (w, vertical_scroll_bar), bar); } @@ -3849,10 +3849,10 @@ w32_redeem_scroll_bar (struct window *window) struct frame *f; /* We can't redeem this window's scroll bar if it doesn't have one. */ - if (NILP (window->vertical_scroll_bar)) + if (NILP (WVAR (window, vertical_scroll_bar))) abort (); - bar = XSCROLL_BAR (window->vertical_scroll_bar); + bar = XSCROLL_BAR (WVAR (window, vertical_scroll_bar)); /* Unlink it from the condemned list. */ f = XFRAME (WINDOW_FRAME (window)); @@ -3860,11 +3860,11 @@ w32_redeem_scroll_bar (struct window *window) { /* If the prev pointer is nil, it must be the first in one of the lists. */ - if (EQ (FRAME_SCROLL_BARS (f), window->vertical_scroll_bar)) + if (EQ (FRAME_SCROLL_BARS (f), WVAR (window, vertical_scroll_bar))) /* It's not condemned. Everything's fine. */ return; else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f), - window->vertical_scroll_bar)) + WVAR (window, vertical_scroll_bar))) FRAME_CONDEMNED_SCROLL_BARS (f) = bar->next; else /* If its prev pointer is nil, it must be at the front of @@ -4422,8 +4422,8 @@ w32_read_socket (struct terminal *terminal, int expected, create event iff we don't leave the selected frame. */ && (focus_follows_mouse - || (EQ (XWINDOW (window)->frame, - XWINDOW (selected_window)->frame)))) + || (EQ (WVAR (XWINDOW (window), frame), + WVAR (XWINDOW (selected_window), frame))))) { inev.kind = SELECT_WINDOW_EVENT; inev.frame_or_window = window; @@ -5038,7 +5038,7 @@ static void x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text_cursor_kinds kind) { - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); struct glyph *cursor_glyph; /* If cursor is out of bounds, don't draw garbage. This can happen diff --git a/src/window.c b/src/window.c index ae0aad7084..beabc28cf6 100644 --- a/src/window.c +++ b/src/window.c @@ -178,7 +178,7 @@ DEFUN ("window-frame", Fwindow_frame, Swindow_frame, 1, 1, 0, If WINDOW is omitted or nil, it defaults to the selected window. */) (Lisp_Object window) { - return decode_any_window (window)->frame; + return WVAR (decode_any_window (window), frame); } DEFUN ("frame-root-window", Fframe_root_window, Sframe_root_window, 0, 1, 0, @@ -244,12 +244,12 @@ the first window of that frame. */) window = FVAR (XFRAME (frame_or_window), root_window); } - while (NILP (XWINDOW (window)->buffer)) + while (NILP (WVAR (XWINDOW (window), buffer))) { - if (! NILP (XWINDOW (window)->hchild)) - window = XWINDOW (window)->hchild; - else if (! NILP (XWINDOW (window)->vchild)) - window = XWINDOW (window)->vchild; + if (! NILP (WVAR (XWINDOW (window), hchild))) + window = WVAR (XWINDOW (window), hchild); + else if (! NILP (WVAR (XWINDOW (window), vchild))) + window = WVAR (XWINDOW (window), vchild); else abort (); } @@ -338,7 +338,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) if (NILP (norecord)) { w->use_time = ++window_select_count; - record_buffer (w->buffer); + record_buffer (WVAR (w, buffer)); } if (EQ (window, selected_window) && !inhibit_point_swap) @@ -366,17 +366,17 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) if (!inhibit_point_swap) { ow = XWINDOW (selected_window); - if (! NILP (ow->buffer)) - set_marker_both (ow->pointm, ow->buffer, - BUF_PT (XBUFFER (ow->buffer)), - BUF_PT_BYTE (XBUFFER (ow->buffer))); + if (! NILP (WVAR (ow, buffer))) + set_marker_both (WVAR (ow, pointm), WVAR (ow, buffer), + BUF_PT (XBUFFER (WVAR (ow, buffer))), + BUF_PT_BYTE (XBUFFER (WVAR (ow, buffer)))); } selected_window = window; - Fset_buffer (w->buffer); + Fset_buffer (WVAR (w, buffer)); - BVAR (XBUFFER (w->buffer), last_selected_window) = window; + BVAR (XBUFFER (WVAR (w, buffer)), last_selected_window) = window; /* Go to the point recorded in the window. This is important when the buffer is in more @@ -384,7 +384,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) redisplay_window has altered point after scrolling, because it makes the change only in the window. */ { - register ptrdiff_t new_point = marker_position (w->pointm); + register ptrdiff_t new_point = marker_position (WVAR (w, pointm)); if (new_point < BEGV) SET_PT (BEGV); else if (new_point > ZV) @@ -419,7 +419,7 @@ If WINDOW is omitted or nil, it defaults to the selected window. Return nil for an internal window or a deleted window. */) (Lisp_Object window) { - return decode_any_window (window)->buffer; + return WVAR (decode_any_window (window), buffer); } DEFUN ("window-parent", Fwindow_parent, Swindow_parent, 0, 1, 0, @@ -428,7 +428,7 @@ If WINDOW is omitted or nil, it defaults to the selected window. Return nil for a window with no parent (e.g. a root window). */) (Lisp_Object window) { - return decode_any_window (window)->parent; + return WVAR (decode_any_window (window), parent); } DEFUN ("window-top-child", Fwindow_top_child, Swindow_top_child, 1, 1, 0, @@ -439,7 +439,7 @@ horizontal combination. */) (Lisp_Object window) { CHECK_WINDOW (window); - return decode_any_window (window)->vchild; + return WVAR (decode_any_window (window), vchild); } DEFUN ("window-left-child", Fwindow_left_child, Swindow_left_child, 1, 1, 0, @@ -450,7 +450,7 @@ vertical combination. */) (Lisp_Object window) { CHECK_WINDOW (window); - return decode_any_window (window)->hchild; + return WVAR (decode_any_window (window), hchild); } DEFUN ("window-next-sibling", Fwindow_next_sibling, Swindow_next_sibling, 0, 1, 0, @@ -459,7 +459,7 @@ If WINDOW is omitted or nil, it defaults to the selected window. Return nil if WINDOW has no next sibling. */) (Lisp_Object window) { - return decode_any_window (window)->next; + return WVAR (decode_any_window (window), next); } DEFUN ("window-prev-sibling", Fwindow_prev_sibling, Swindow_prev_sibling, 0, 1, 0, @@ -468,7 +468,7 @@ If WINDOW is omitted or nil, it defaults to the selected window. Return nil if WINDOW has no previous sibling. */) (Lisp_Object window) { - return decode_any_window (window)->prev; + return WVAR (decode_any_window (window), prev); } DEFUN ("window-combination-limit", Fwindow_combination_limit, Swindow_combination_limit, 1, 1, 0, @@ -478,7 +478,7 @@ WINDOW's siblings. A return value of t means that child windows of WINDOW are never \(re-)combined with WINDOW's siblings. */) (Lisp_Object window) { - return decode_any_window (window)->combination_limit; + return WVAR (decode_any_window (window), combination_limit); } DEFUN ("set-window-combination-limit", Fset_window_combination_limit, Sset_window_combination_limit, 2, 2, 0, @@ -490,8 +490,8 @@ for future use. */) (Lisp_Object window, Lisp_Object limit) { register struct window *w = decode_any_window (window); - w->combination_limit = limit; - return w->combination_limit; + WVAR (w, combination_limit) = limit; + return WVAR (w, combination_limit); } DEFUN ("window-use-time", Fwindow_use_time, Swindow_use_time, 0, 1, 0, @@ -517,7 +517,7 @@ On a graphical display, this total height is reported as an integer multiple of the default character height. */) (Lisp_Object window) { - return decode_any_window (window)->total_lines; + return WVAR (decode_any_window (window), total_lines); } DEFUN ("window-total-width", Fwindow_total_width, Swindow_total_width, 0, 1, 0, @@ -532,7 +532,7 @@ On a graphical display, this total width is reported as an integer multiple of the default character width. */) (Lisp_Object window) { - return decode_any_window (window)->total_cols; + return WVAR (decode_any_window (window), total_cols); } DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0, @@ -540,7 +540,7 @@ DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0, If WINDOW is omitted or nil, it defaults to the selected window. */) (Lisp_Object window) { - return decode_any_window (window)->new_total; + return WVAR (decode_any_window (window), new_total); } DEFUN ("window-normal-size", Fwindow_normal_size, Swindow_normal_size, 0, 2, 0, @@ -550,9 +550,9 @@ If HORIZONTAL is non-nil, return the normal width of WINDOW. */) (Lisp_Object window, Lisp_Object horizontal) { if (NILP (horizontal)) - return decode_any_window (window)->normal_lines; + return WVAR (decode_any_window (window), normal_lines); else - return decode_any_window (window)->normal_cols; + return WVAR (decode_any_window (window), normal_cols); } DEFUN ("window-new-normal", Fwindow_new_normal, Swindow_new_normal, 0, 1, 0, @@ -560,7 +560,7 @@ DEFUN ("window-new-normal", Fwindow_new_normal, Swindow_new_normal, 0, 1, 0, If WINDOW is omitted or nil, it defaults to the selected window. */) (Lisp_Object window) { - return decode_any_window (window)->new_normal; + return WVAR (decode_any_window (window), new_normal); } DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0, @@ -572,7 +572,7 @@ value is 0 if there is no window to the left of WINDOW. If WINDOW is omitted or nil, it defaults to the selected window. */) (Lisp_Object window) { - return decode_any_window (window)->left_col; + return WVAR (decode_any_window (window), left_col); } DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0, @@ -584,7 +584,7 @@ there is no window above WINDOW. If WINDOW is omitted or nil, it defaults to the selected window. */) (Lisp_Object window) { - return decode_any_window (window)->top_line; + return WVAR (decode_any_window (window), top_line); } /* Return the number of lines of W's body. Don't count any mode or @@ -593,7 +593,7 @@ If WINDOW is omitted or nil, it defaults to the selected window. */) static int window_body_lines (struct window *w) { - int height = XFASTINT (w->total_lines); + int height = XFASTINT (WVAR (w, total_lines)); if (!MINI_WINDOW_P (w)) { @@ -615,7 +615,7 @@ int window_body_cols (struct window *w) { struct frame *f = XFRAME (WINDOW_FRAME (w)); - int width = XINT (w->total_cols); + int width = XINT (WVAR (w, total_cols)); if (WINDOW_HAS_VERTICAL_SCROLL_BAR (w)) /* Scroll bars occupy a few columns. */ @@ -690,7 +690,7 @@ set_window_hscroll (struct window *w, EMACS_INT hscroll) /* Prevent redisplay shortcuts when changing the hscroll. */ if (w->hscroll != new_hscroll) - XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; + XBUFFER (WVAR (w, buffer))->prevent_redisplay_optimizations_p = 1; w->hscroll = new_hscroll; return make_number (new_hscroll); @@ -719,7 +719,7 @@ WINDOW defaults to the selected window. See `set-window-redisplay-end-trigger' for more information. */) (Lisp_Object window) { - return decode_window (window)->redisplay_end_trigger; + return WVAR (decode_window (window), redisplay_end_trigger); } DEFUN ("set-window-redisplay-end-trigger", Fset_window_redisplay_end_trigger, @@ -735,7 +735,7 @@ Afterwards the end-trigger value is reset to nil. */) register struct window *w; w = decode_window (window); - w->redisplay_end_trigger = value; + WVAR (w, redisplay_end_trigger) = value; return value; } @@ -785,7 +785,7 @@ of just the text area, use `window-inside-pixel-edges'. */) static void calc_absolute_offset (struct window *w, int *add_x, int *add_y) { - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); *add_y = f->top_pos; #ifdef FRAME_MENUBAR_HEIGHT *add_y += FRAME_MENUBAR_HEIGHT (f); @@ -1095,7 +1095,7 @@ If they are in the windows's left or right marginal areas, `left-margin'\n\ CHECK_LIVE_WINDOW (window); w = XWINDOW (window); - f = XFRAME (w->frame); + f = XFRAME (WVAR (w, frame)); CHECK_CONS (coordinates); lx = Fcar (coordinates); ly = Fcdr (coordinates); @@ -1275,9 +1275,9 @@ But that is hard to define. */) register struct window *w = decode_window (window); if (w == XWINDOW (selected_window) - && current_buffer == XBUFFER (w->buffer)) + && current_buffer == XBUFFER (WVAR (w, buffer))) return Fpoint (); - return Fmarker_position (w->pointm); + return Fmarker_position (WVAR (w, pointm)); } DEFUN ("window-start", Fwindow_start, Swindow_start, 0, 1, 0, @@ -1286,7 +1286,7 @@ WINDOW must be a live window and defaults to the selected one. This is updated by redisplay or by calling `set-window-start'. */) (Lisp_Object window) { - return Fmarker_position (decode_window (window)->start); + return Fmarker_position (WVAR (decode_window (window), start)); } /* This is text temporarily removed from the doc string below. @@ -1317,7 +1317,7 @@ if it isn't already recorded. */) Lisp_Object buf; struct buffer *b; - buf = w->buffer; + buf = WVAR (w, buffer); CHECK_BUFFER (buf); b = XBUFFER (buf); @@ -1326,12 +1326,12 @@ if it isn't already recorded. */) The user can compute it with vertical-motion if he wants to. It would be nicer to do it automatically, but that's so slow that it would probably bother people. */ - if (NILP (w->window_end_valid)) + if (NILP (WVAR (w, window_end_valid))) return Qnil; #endif if (! NILP (update) - && ! (! NILP (w->window_end_valid) + && ! (! NILP (WVAR (w, window_end_valid)) && w->last_modified >= BUF_MODIFF (b) && w->last_overlay_modified >= BUF_OVERLAY_MODIFF (b)) && !noninteractive) @@ -1354,12 +1354,12 @@ if it isn't already recorded. */) `-l' containing a call to `rmail' with subsequent other commands. At the end, W->start happened to be BEG, while rmail had already narrowed the buffer. */ - if (XMARKER (w->start)->charpos < BEGV) + if (XMARKER (WVAR (w, start))->charpos < BEGV) SET_TEXT_POS (startp, BEGV, BEGV_BYTE); - else if (XMARKER (w->start)->charpos > ZV) + else if (XMARKER (WVAR (w, start))->charpos > ZV) SET_TEXT_POS (startp, ZV, ZV_BYTE); else - SET_TEXT_POS_FROM_MARKER (startp, w->start); + SET_TEXT_POS_FROM_MARKER (startp, WVAR (w, start)); itdata = bidi_shelve_cache (); start_display (&it, w, startp); @@ -1373,7 +1373,7 @@ if it isn't already recorded. */) set_buffer_internal (old_buffer); } else - XSETINT (value, BUF_Z (b) - XFASTINT (w->window_end_pos)); + XSETINT (value, BUF_Z (b) - XFASTINT (WVAR (w, window_end_pos))); return value; } @@ -1387,10 +1387,10 @@ Return POS. */) CHECK_NUMBER_COERCE_MARKER (pos); if (w == XWINDOW (selected_window) - && XBUFFER (w->buffer) == current_buffer) + && XBUFFER (WVAR (w, buffer)) == current_buffer) Fgoto_char (pos); else - set_marker_restricted (w->pointm, pos, w->buffer); + set_marker_restricted (WVAR (w, pointm), pos, WVAR (w, buffer)); /* We have to make sure that redisplay updates the window to show the new value of point. */ @@ -1410,7 +1410,7 @@ overriding motion of point in order to display at this exact start. */) register struct window *w = decode_window (window); CHECK_NUMBER_COERCE_MARKER (pos); - set_marker_restricted (w->start, pos, w->buffer); + set_marker_restricted (WVAR (w, start), pos, WVAR (w, buffer)); /* this is not right, but much easier than doing what is right. */ w->start_at_line_beg = 0; if (NILP (noforce)) @@ -1452,8 +1452,8 @@ display row, and VPOS is the row number (0-based) containing POS. */) int x, y; w = decode_window (window); - buf = XBUFFER (w->buffer); - SET_TEXT_POS_FROM_MARKER (top, w->start); + buf = XBUFFER (WVAR (w, buffer)); + SET_TEXT_POS_FROM_MARKER (top, WVAR (w, start)); if (EQ (pos, Qt)) posint = -1; @@ -1465,7 +1465,7 @@ display row, and VPOS is the row number (0-based) containing POS. */) else if (w == XWINDOW (selected_window)) posint = PT; else - posint = XMARKER (w->pointm)->charpos; + posint = XMARKER (WVAR (w, pointm))->charpos; /* If position is above window start or outside buffer boundaries, or if window start is out of range, position is not visible. */ @@ -1522,11 +1522,11 @@ Return nil if window display is not up-to-date. In that case, use if (noninteractive || w->pseudo_window_p) return Qnil; - CHECK_BUFFER (w->buffer); - b = XBUFFER (w->buffer); + CHECK_BUFFER (WVAR (w, buffer)); + b = XBUFFER (WVAR (w, buffer)); /* Fail if current matrix is not up-to-date. */ - if (NILP (w->window_end_valid) + if (NILP (WVAR (w, window_end_valid)) || current_buffer->clip_changed || current_buffer->prevent_redisplay_optimizations_p || w->last_modified < BUF_MODIFF (b) @@ -1619,7 +1619,7 @@ window, unless that window is "strongly" dedicated to its buffer, that is the value returned by `window-dedicated-p' is t. */) (Lisp_Object window) { - return decode_window (window)->dedicated; + return WVAR (decode_window (window), dedicated); } DEFUN ("set-window-dedicated-p", Fset_window_dedicated_p, @@ -1645,8 +1645,8 @@ window, it also makes sure that the window is no more dedicated. */) { register struct window *w = decode_window (window); - w->dedicated = flag; - return w->dedicated; + WVAR (w, dedicated) = flag; + return WVAR (w, dedicated); } DEFUN ("window-prev-buffers", Fwindow_prev_buffers, Swindow_prev_buffers, @@ -1659,7 +1659,7 @@ where BUFFER is a buffer, WINDOW-START is the start position of the window for that buffer, and POS is a window-specific point value. */) (Lisp_Object window) { - return decode_window (window)->prev_buffers; + return WVAR (decode_window (window), prev_buffers); } DEFUN ("set-window-prev-buffers", Fset_window_prev_buffers, @@ -1672,7 +1672,7 @@ where BUFFER is a buffer, WINDOW-START is the start position of the window for that buffer, and POS is a window-specific point value. */) (Lisp_Object window, Lisp_Object prev_buffers) { - return decode_window (window)->prev_buffers = prev_buffers; + return WVAR (decode_window (window), prev_buffers) = prev_buffers; } DEFUN ("window-next-buffers", Fwindow_next_buffers, Swindow_next_buffers, @@ -1681,7 +1681,7 @@ DEFUN ("window-next-buffers", Fwindow_next_buffers, Swindow_next_buffers, WINDOW must be a live window and defaults to the selected one. */) (Lisp_Object window) { - return decode_window (window)->next_buffers; + return WVAR (decode_window (window), next_buffers); } DEFUN ("set-window-next-buffers", Fset_window_next_buffers, @@ -1691,7 +1691,7 @@ WINDOW must be a live window and defaults to the selected one. NEXT-BUFFERS should be a list of buffers. */) (Lisp_Object window, Lisp_Object next_buffers) { - return decode_window (window)->next_buffers = next_buffers; + return WVAR (decode_window (window), next_buffers) = next_buffers; } DEFUN ("window-parameters", Fwindow_parameters, Swindow_parameters, @@ -1701,7 +1701,7 @@ WINDOW defaults to the selected window. The return value is a list of elements of the form (PARAMETER . VALUE). */) (Lisp_Object window) { - return Fcopy_alist (decode_any_window (window)->window_parameters); + return Fcopy_alist (WVAR (decode_any_window (window), window_parameters)); } DEFUN ("window-parameter", Fwindow_parameter, Swindow_parameter, @@ -1712,7 +1712,8 @@ WINDOW defaults to the selected window. */) { Lisp_Object result; - result = Fassq (parameter, decode_any_window (window)->window_parameters); + result = Fassq (parameter, WVAR (decode_any_window (window), + window_parameters)); return CDR_SAFE (result); } @@ -1725,9 +1726,10 @@ WINDOW defaults to the selected window. Return VALUE. */) register struct window *w = decode_any_window (window); Lisp_Object old_alist_elt; - old_alist_elt = Fassq (parameter, w->window_parameters); + old_alist_elt = Fassq (parameter, WVAR (w, window_parameters)); if (NILP (old_alist_elt)) - w->window_parameters = Fcons (Fcons (parameter, value), w->window_parameters); + WVAR (w, window_parameters) + = Fcons (Fcons (parameter, value), WVAR (w, window_parameters)); else Fsetcdr (old_alist_elt, value); return value; @@ -1739,7 +1741,7 @@ DEFUN ("window-display-table", Fwindow_display_table, Swindow_display_table, WINDOW defaults to the selected window. */) (Lisp_Object window) { - return decode_window (window)->display_table; + return WVAR (decode_window (window), display_table); } /* Get the display table for use on window W. This is either W's @@ -1752,11 +1754,11 @@ window_display_table (struct window *w) { struct Lisp_Char_Table *dp = NULL; - if (DISP_TABLE_P (w->display_table)) - dp = XCHAR_TABLE (w->display_table); - else if (BUFFERP (w->buffer)) + if (DISP_TABLE_P (WVAR (w, display_table))) + dp = XCHAR_TABLE (WVAR (w, display_table)); + else if (BUFFERP (WVAR (w, buffer))) { - struct buffer *b = XBUFFER (w->buffer); + struct buffer *b = XBUFFER (WVAR (w, buffer)); if (DISP_TABLE_P (BVAR (b, display_table))) dp = XCHAR_TABLE (BVAR (b, display_table)); @@ -1774,7 +1776,7 @@ DEFUN ("set-window-display-table", Fset_window_display_table, Sset_window_displa register struct window *w; w = decode_window (window); - w->display_table = table; + WVAR (w, display_table) = table; return table; } @@ -1786,14 +1788,14 @@ unshow_buffer (register struct window *w) Lisp_Object buf; struct buffer *b; - buf = w->buffer; + buf = WVAR (w, buffer); b = XBUFFER (buf); - if (b != XMARKER (w->pointm)->buffer) + if (b != XMARKER (WVAR (w, pointm))->buffer) abort (); #if 0 if (w == XWINDOW (selected_window) - || ! EQ (buf, XWINDOW (selected_window)->buffer)) + || ! EQ (buf, WVAR (XWINDOW (selected_window), buffer))) /* Do this except when the selected window's buffer is being removed from some other window. */ #endif @@ -1804,22 +1806,22 @@ unshow_buffer (register struct window *w) selected window, while last_window_start reflects another window which was recently showing the same buffer. Some people might say that might be a good thing. Let's see. */ - b->last_window_start = marker_position (w->start); + b->last_window_start = marker_position (WVAR (w, start)); /* Point in the selected window's buffer is actually stored in that buffer, and the window's pointm isn't used. So don't clobber point in that buffer. */ - if (! EQ (buf, XWINDOW (selected_window)->buffer) + if (! EQ (buf, WVAR (XWINDOW (selected_window), buffer)) /* This line helps to fix Horsley's testbug.el bug. */ && !(WINDOWP (BVAR (b, last_selected_window)) && w != XWINDOW (BVAR (b, last_selected_window)) - && EQ (buf, XWINDOW (BVAR (b, last_selected_window))->buffer))) + && EQ (buf, WVAR (XWINDOW (BVAR (b, last_selected_window)), buffer)))) temp_set_point_both (b, clip_to_bounds (BUF_BEGV (b), - XMARKER (w->pointm)->charpos, + XMARKER (WVAR (w, pointm))->charpos, BUF_ZV (b)), clip_to_bounds (BUF_BEGV_BYTE (b), - marker_byte_position (w->pointm), + marker_byte_position (WVAR (w, pointm)), BUF_ZV_BYTE (b))); if (WINDOWP (BVAR (b, last_selected_window)) @@ -1838,19 +1840,19 @@ replace_window (Lisp_Object old, Lisp_Object new, int setflag) /* If OLD is its frame's root window, then NEW is the new root window for that frame. */ - if (EQ (old, FRAME_ROOT_WINDOW (XFRAME (o->frame)))) - FRAME_ROOT_WINDOW (XFRAME (o->frame)) = new; + if (EQ (old, FRAME_ROOT_WINDOW (XFRAME (WVAR (o, frame))))) + FRAME_ROOT_WINDOW (XFRAME (WVAR (o, frame))) = new; if (setflag) { - n->left_col = o->left_col; - n->top_line = o->top_line; - n->total_cols = o->total_cols; - n->total_lines = o->total_lines; - n->normal_cols = o->normal_cols; - o->normal_cols = make_float (1.0); - n->normal_lines = o->normal_lines; - o->normal_lines = make_float (1.0); + WVAR (n, left_col) = WVAR (o, left_col); + WVAR (n, top_line) = WVAR (o, top_line); + WVAR (n, total_cols) = WVAR (o, total_cols); + WVAR (n, total_lines) = WVAR (o, total_lines); + WVAR (n, normal_cols) = WVAR (o, normal_cols); + WVAR (o, normal_cols) = make_float (1.0); + WVAR (n, normal_lines) = WVAR (o, normal_lines); + WVAR (o, normal_lines) = make_float (1.0); n->desired_matrix = n->current_matrix = 0; n->vscroll = 0; memset (&n->cursor, 0, sizeof (n->cursor)); @@ -1860,27 +1862,27 @@ replace_window (Lisp_Object old, Lisp_Object new, int setflag) n->phys_cursor_width = -1; n->must_be_updated_p = 0; n->pseudo_window_p = 0; - XSETFASTINT (n->window_end_vpos, 0); - XSETFASTINT (n->window_end_pos, 0); - n->window_end_valid = Qnil; + XSETFASTINT (WVAR (n, window_end_vpos), 0); + XSETFASTINT (WVAR (n, window_end_pos), 0); + WVAR (n, window_end_valid) = Qnil; n->frozen_window_start_p = 0; } - n->next = tem = o->next; + WVAR (n, next) = tem = WVAR (o, next); if (!NILP (tem)) - XWINDOW (tem)->prev = new; + WVAR (XWINDOW (tem), prev) = new; - n->prev = tem = o->prev; + WVAR (n, prev) = tem = WVAR (o, prev); if (!NILP (tem)) - XWINDOW (tem)->next = new; + WVAR (XWINDOW (tem), next) = new; - n->parent = tem = o->parent; + WVAR (n, parent) = tem = WVAR (o, parent); if (!NILP (tem)) { - if (EQ (XWINDOW (tem)->vchild, old)) - XWINDOW (tem)->vchild = new; - if (EQ (XWINDOW (tem)->hchild, old)) - XWINDOW (tem)->hchild = new; + if (EQ (WVAR (XWINDOW (tem), vchild), old)) + WVAR (XWINDOW (tem), vchild) = new; + if (EQ (WVAR (XWINDOW (tem), hchild), old)) + WVAR (XWINDOW (tem), hchild) = new; } } @@ -1896,64 +1898,64 @@ recombine_windows (Lisp_Object window) int horflag; w = XWINDOW (window); - parent = w->parent; - if (!NILP (parent) && NILP (w->combination_limit)) + parent = WVAR (w, parent); + if (!NILP (parent) && NILP (WVAR (w, combination_limit))) { p = XWINDOW (parent); - if (((!NILP (p->vchild) && !NILP (w->vchild)) - || (!NILP (p->hchild) && !NILP (w->hchild)))) + if (((!NILP (WVAR (p, vchild)) && !NILP (WVAR (w, vchild))) + || (!NILP (WVAR (p, hchild)) && !NILP (WVAR (w, hchild))))) /* WINDOW and PARENT are both either a vertical or a horizontal combination. */ { - horflag = NILP (w->vchild); - child = horflag ? w->hchild : w->vchild; + horflag = NILP (WVAR (w, vchild)); + child = horflag ? WVAR (w, hchild) : WVAR (w, vchild); c = XWINDOW (child); /* Splice WINDOW's children into its parent's children and assign new normal sizes. */ - if (NILP (w->prev)) + if (NILP (WVAR (w, prev))) if (horflag) - p->hchild = child; + WVAR (p, hchild) = child; else - p->vchild = child; + WVAR (p, vchild) = child; else { - c->prev = w->prev; - XWINDOW (w->prev)->next = child; + WVAR (c, prev) = WVAR (w, prev); + WVAR (XWINDOW (WVAR (w, prev)), next) = child; } while (c) { - c->parent = parent; + WVAR (c, parent) = parent; if (horflag) - c->normal_cols - = make_float (XFLOATINT (c->total_cols) - / XFLOATINT (p->total_cols)); + WVAR (c, normal_cols) + = make_float (XFLOATINT (WVAR (c, total_cols)) + / XFLOATINT (WVAR (p, total_cols))); else - c->normal_lines - = make_float (XFLOATINT (c->total_lines) - / XFLOATINT (p->total_lines)); + WVAR (c, normal_lines) + = make_float (XFLOATINT (WVAR (c, total_lines)) + / XFLOATINT (WVAR (p, total_lines))); - if (NILP (c->next)) + if (NILP (WVAR (c, next))) { - if (!NILP (w->next)) + if (!NILP (WVAR (w, next))) { - c->next = w->next; - XWINDOW (c->next)->prev = child; + WVAR (c, next) = WVAR (w, next); + WVAR (XWINDOW (WVAR (c, next)), prev) = child; } c = 0; } else { - child = c->next; + child = WVAR (c, next); c = XWINDOW (child); } } /* WINDOW can be deleted now. */ - w->vchild = w->hchild = Qnil; + WVAR (w, vchild) = WVAR (w, hchild) = Qnil; } } } @@ -2036,10 +2038,10 @@ static int candidate_window_p (Lisp_Object window, Lisp_Object owindow, Lisp_Object minibuf, Lisp_Object all_frames) { struct window *w = XWINDOW (window); - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); int candidate_p = 1; - if (!BUFFERP (w->buffer)) + if (!BUFFERP (WVAR (w, buffer))) candidate_p = 0; else if (MINI_WINDOW_P (w) && (EQ (minibuf, Qlambda) @@ -2054,13 +2056,13 @@ candidate_window_p (Lisp_Object window, Lisp_Object owindow, Lisp_Object minibuf else if (NILP (all_frames)) { eassert (WINDOWP (owindow)); - candidate_p = EQ (w->frame, XWINDOW (owindow)->frame); + candidate_p = EQ (WVAR (w, frame), WVAR (XWINDOW (owindow), frame)); } else if (EQ (all_frames, Qvisible)) { FRAME_SAMPLE_VISIBILITY (f); candidate_p = FRAME_VISIBLE_P (f) - && (FRAME_TERMINAL (XFRAME (w->frame)) + && (FRAME_TERMINAL (XFRAME (WVAR (w, frame))) == FRAME_TERMINAL (XFRAME (selected_frame))); } @@ -2079,15 +2081,15 @@ candidate_window_p (Lisp_Object window, Lisp_Object owindow, Lisp_Object minibuf && !f->output_data.x->has_been_visible) #endif ) - && (FRAME_TERMINAL (XFRAME (w->frame)) + && (FRAME_TERMINAL (XFRAME (WVAR (w, frame))) == FRAME_TERMINAL (XFRAME (selected_frame))); } else if (WINDOWP (all_frames)) candidate_p = (EQ (FRAME_MINIBUF_WINDOW (f), all_frames) - || EQ (XWINDOW (all_frames)->frame, w->frame) - || EQ (XWINDOW (all_frames)->frame, FRAME_FOCUS_FRAME (f))); + || EQ (WVAR (XWINDOW (all_frames), frame), WVAR (w, frame)) + || EQ (WVAR (XWINDOW (all_frames), frame), FRAME_FOCUS_FRAME (f))); else if (FRAMEP (all_frames)) - candidate_p = EQ (all_frames, w->frame); + candidate_p = EQ (all_frames, WVAR (w, frame)); return candidate_p; } @@ -2118,9 +2120,10 @@ decode_next_window_args (Lisp_Object *window, Lisp_Object *minibuf, Lisp_Object /* ALL_FRAMES nil doesn't specify which frames to include. */ if (NILP (*all_frames)) - *all_frames = (!EQ (*minibuf, Qlambda) - ? FRAME_MINIBUF_WINDOW (XFRAME (XWINDOW (*window)->frame)) - : Qnil); + *all_frames + = (!EQ (*minibuf, Qlambda) + ? FRAME_MINIBUF_WINDOW (XFRAME (WVAR (XWINDOW (*window), frame))) + : Qnil); else if (EQ (*all_frames, Qvisible)) ; else if (EQ (*all_frames, make_number (0))) @@ -2145,7 +2148,7 @@ next_window (Lisp_Object window, Lisp_Object minibuf, Lisp_Object all_frames, in /* If ALL_FRAMES is a frame, and WINDOW isn't on that frame, just return the first window on the frame. */ if (FRAMEP (all_frames) - && !EQ (all_frames, XWINDOW (window)->frame)) + && !EQ (all_frames, WVAR (XWINDOW (window), frame))) return Fframe_first_window (all_frames); if (next_p) @@ -2325,7 +2328,7 @@ MINIBUF neither nil nor t means never include the minibuffer window. */) if (NILP (frame)) frame = selected_frame; - if (!EQ (frame, XWINDOW (window)->frame)) + if (!EQ (frame, WVAR (XWINDOW (window), frame))) error ("Window is on a different frame"); return window_list_1 (window, minibuf, frame); @@ -2446,7 +2449,7 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame switch (type) { case GET_BUFFER_WINDOW: - if (EQ (w->buffer, obj) + if (EQ (WVAR (w, buffer), obj) /* Don't find any minibuffer window except the one that is currently in use. */ && (MINI_WINDOW_P (w) ? EQ (window, minibuf_window) : 1)) @@ -2454,7 +2457,7 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame if (EQ (window, selected_window)) /* Preferably return the selected window. */ RETURN_UNGCPRO (window); - else if (EQ (XWINDOW (window)->frame, selected_frame) + else if (EQ (WVAR (XWINDOW (window), frame), selected_frame) && !frame_best_window_flag) /* Prefer windows on the current frame (but don't choose another one if we have one already). */ @@ -2470,25 +2473,25 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame case REPLACE_BUFFER_IN_WINDOWS_SAFELY: /* We could simply check whether the buffer shown by window is live, and show another buffer in case it isn't. */ - if (EQ (w->buffer, obj)) + if (EQ (WVAR (w, buffer), obj)) { /* Undedicate WINDOW. */ - w->dedicated = Qnil; + WVAR (w, dedicated) = Qnil; /* Make WINDOW show the buffer returned by other_buffer_safely, don't run any hooks. */ set_window_buffer - (window, other_buffer_safely (w->buffer), 0, 0); + (window, other_buffer_safely (WVAR (w, buffer)), 0, 0); /* If WINDOW is the selected window, make its buffer current. But do so only if the window shows the current buffer (Bug#6454). */ if (EQ (window, selected_window) - && XBUFFER (w->buffer) == current_buffer) - Fset_buffer (w->buffer); + && XBUFFER (WVAR (w, buffer)) == current_buffer) + Fset_buffer (WVAR (w, buffer)); } break; case REDISPLAY_BUFFER_WINDOWS: - if (EQ (w->buffer, obj)) + if (EQ (WVAR (w, buffer), obj)) { mark_window_display_accurate (window, 0); w->update_mode_line = 1; @@ -2500,8 +2503,8 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame /* Check for a window that has a killed buffer. */ case CHECK_ALL_WINDOWS: - if (! NILP (w->buffer) - && NILP (BVAR (XBUFFER (w->buffer), name))) + if (! NILP (WVAR (w, buffer)) + && NILP (BVAR (XBUFFER (WVAR (w, buffer)), name))) abort (); break; @@ -2588,7 +2591,7 @@ window-start value is reasonable when this function is called. */) w = decode_any_window (window); XSETWINDOW (window, w); - f = XFRAME (w->frame); + f = XFRAME (WVAR (w, frame)); if (NILP (root)) /* ROOT is the frame's root window. */ @@ -2600,12 +2603,12 @@ window-start value is reasonable when this function is called. */) /* ROOT must be an ancestor of WINDOW. */ { r = decode_any_window (root); - pwindow = XWINDOW (window)->parent; + pwindow = WVAR (XWINDOW (window), parent); while (!NILP (pwindow)) if (EQ (pwindow, root)) break; else - pwindow = XWINDOW (pwindow)->parent; + pwindow = WVAR (XWINDOW (pwindow), parent); if (!EQ (pwindow, root)) error ("Specified root is not an ancestor of specified window"); } @@ -2619,15 +2622,15 @@ window-start value is reasonable when this function is called. */) else if (MINI_WINDOW_P (w)) /* && top > 0) */ error ("Can't expand minibuffer to full frame"); - if (!NILP (w->buffer)) + if (!NILP (WVAR (w, buffer))) { - startpos = marker_position (w->start); + startpos = marker_position (WVAR (w, start)); top = WINDOW_TOP_EDGE_LINE (w) - FRAME_TOP_MARGIN (XFRAME (WINDOW_FRAME (w))); /* Make sure WINDOW is the frame's selected window. */ if (!EQ (window, FRAME_SELECTED_WINDOW (f))) { - if (EQ (selected_frame, w->frame)) + if (EQ (selected_frame, WVAR (w, frame))) Fselect_window (window, Qnil); else FRAME_SELECTED_WINDOW (f) = window; @@ -2644,7 +2647,7 @@ window-start value is reasonable when this function is called. */) { pwindow = swindow; while (!NILP (pwindow) && !EQ (window, pwindow)) - pwindow = XWINDOW (pwindow)->parent; + pwindow = WVAR (XWINDOW (pwindow), parent); if (EQ (window, pwindow)) /* If WINDOW is an ancestor of SWINDOW, then SWINDOW is ok @@ -2657,7 +2660,7 @@ window-start value is reasonable when this function is called. */) if (!EQ (swindow, FRAME_SELECTED_WINDOW (f))) { - if (EQ (selected_frame, w->frame)) + if (EQ (selected_frame, WVAR (w, frame))) Fselect_window (swindow, Qnil); else FRAME_SELECTED_WINDOW (f) = swindow; @@ -2690,11 +2693,12 @@ window-start value is reasonable when this function is called. */) FRAME_WINDOW_SIZES_CHANGED (f) = 1; resize_failed = 0; - if (NILP (w->buffer)) + if (NILP (WVAR (w, buffer))) { /* Resize child windows vertically. */ - XSETINT (delta, XINT (r->total_lines) - XINT (w->total_lines)); - w->top_line = r->top_line; + XSETINT (delta, XINT (WVAR (r, total_lines)) + - XINT (WVAR (w, total_lines))); + WVAR (w, top_line) = WVAR (r, top_line); resize_root_window (window, delta, Qnil, Qnil); if (window_resize_check (w, 0)) window_resize_apply (w, 0); @@ -2710,9 +2714,10 @@ window-start value is reasonable when this function is called. */) /* Resize child windows horizontally. */ if (!resize_failed) { - w->left_col = r->left_col; - XSETINT (delta, XINT (r->total_cols) - XINT (w->total_cols)); - w->left_col = r->left_col; + WVAR (w, left_col) = WVAR (r, left_col); + XSETINT (delta, XINT (WVAR (r, total_cols)) + - XINT (WVAR (w, total_cols))); + WVAR (w, left_col) = WVAR (r, left_col); resize_root_window (window, delta, Qt, Qnil); if (window_resize_check (w, 1)) window_resize_apply (w, 1); @@ -2735,43 +2740,43 @@ window-start value is reasonable when this function is called. */) } /* Cleanly unlink WINDOW from window-tree. */ - if (!NILP (w->prev)) + if (!NILP (WVAR (w, prev))) /* Get SIBLING above (on the left of) WINDOW. */ { - sibling = w->prev; + sibling = WVAR (w, prev); s = XWINDOW (sibling); - s->next = w->next; - if (!NILP (s->next)) - XWINDOW (s->next)->prev = sibling; + WVAR (s, next) = WVAR (w, next); + if (!NILP (WVAR (s, next))) + WVAR (XWINDOW (WVAR (s, next)), prev) = sibling; } else /* Get SIBLING below (on the right of) WINDOW. */ { - sibling = w->next; + sibling = WVAR (w, next); s = XWINDOW (sibling); - s->prev = Qnil; - if (!NILP (XWINDOW (w->parent)->vchild)) - XWINDOW (w->parent)->vchild = sibling; + WVAR (s, prev) = Qnil; + if (!NILP (WVAR (XWINDOW (WVAR (w, parent)), vchild))) + WVAR (XWINDOW (WVAR (w, parent)), vchild) = sibling; else - XWINDOW (w->parent)->hchild = sibling; + WVAR (XWINDOW (WVAR (w, parent)), hchild) = sibling; } /* Delete ROOT and all child windows of ROOT. */ - if (!NILP (r->vchild)) + if (!NILP (WVAR (r, vchild))) { - delete_all_child_windows (r->vchild); - r->vchild = Qnil; + delete_all_child_windows (WVAR (r, vchild)); + WVAR (r, vchild) = Qnil; } - else if (!NILP (r->hchild)) + else if (!NILP (WVAR (r, hchild))) { - delete_all_child_windows (r->hchild); - r->hchild = Qnil; + delete_all_child_windows (WVAR (r, hchild)); + WVAR (r, hchild) = Qnil; } replace_window (root, window, 1); /* This must become SWINDOW anyway ....... */ - if (!NILP (w->buffer) && !resize_failed) + if (!NILP (WVAR (w, buffer)) && !resize_failed) { /* Try to minimize scrolling, by setting the window start to the point will cause the text at the old window start to be at the @@ -2780,19 +2785,19 @@ window-start value is reasonable when this function is called. */) when the display is not current, due to typeahead). */ new_top = WINDOW_TOP_EDGE_LINE (w) - FRAME_TOP_MARGIN (XFRAME (WINDOW_FRAME (w))); if (new_top != top - && startpos >= BUF_BEGV (XBUFFER (w->buffer)) - && startpos <= BUF_ZV (XBUFFER (w->buffer))) + && startpos >= BUF_BEGV (XBUFFER (WVAR (w, buffer))) + && startpos <= BUF_ZV (XBUFFER (WVAR (w, buffer)))) { struct position pos; struct buffer *obuf = current_buffer; - Fset_buffer (w->buffer); + Fset_buffer (WVAR (w, buffer)); /* This computation used to temporarily move point, but that can have unwanted side effects due to text properties. */ pos = *vmotion (startpos, -top, w); - set_marker_both (w->start, w->buffer, pos.bufpos, pos.bytepos); - w->window_end_valid = Qnil; + set_marker_both (WVAR (w, start), WVAR (w, buffer), pos.bufpos, pos.bytepos); + WVAR (w, window_end_valid) = Qnil; w->start_at_line_beg = (pos.bytepos == BEGV_BYTE || FETCH_BYTE (pos.bytepos - 1) == '\n'); /* We need to do this, so that the window-scroll-functions @@ -2882,13 +2887,13 @@ adjust_window_margins (struct window *w) if (WINDOW_RIGHT_MARGIN_COLS (w) > 0) { if (WINDOW_LEFT_MARGIN_COLS (w) > 0) - w->left_margin_cols = w->right_margin_cols + WVAR (w, left_margin_cols) = WVAR (w, right_margin_cols) = make_number (margin_cols/2); else - w->right_margin_cols = make_number (margin_cols); + WVAR (w, right_margin_cols) = make_number (margin_cols); } else - w->left_margin_cols = make_number (margin_cols); + WVAR (w, left_margin_cols) = make_number (margin_cols); return 1; } @@ -2986,9 +2991,9 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int struct window *w = XWINDOW (window); struct buffer *b = XBUFFER (buffer); ptrdiff_t count = SPECPDL_INDEX (); - int samebuf = EQ (buffer, w->buffer); + int samebuf = EQ (buffer, WVAR (w, buffer)); - w->buffer = buffer; + WVAR (w, buffer) = buffer; if (EQ (window, selected_window)) BVAR (b, last_selected_window) = window; @@ -3001,10 +3006,10 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int XSETINT (BVAR (b, display_count), XINT (BVAR (b, display_count)) + 1); BVAR (b, display_time) = Fcurrent_time (); - XSETFASTINT (w->window_end_pos, 0); - XSETFASTINT (w->window_end_vpos, 0); + XSETFASTINT (WVAR (w, window_end_pos), 0); + XSETFASTINT (WVAR (w, window_end_vpos), 0); memset (&w->last_cursor, 0, sizeof w->last_cursor); - w->window_end_valid = Qnil; + WVAR (w, window_end_valid) = Qnil; if (!(keep_margins_p && samebuf)) { /* If we're not actually changing the buffer, don't reset hscroll and vscroll. This case happens for example when called from @@ -3016,8 +3021,8 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int whenever we resize the frame. */ w->hscroll = w->min_hscroll = 0; w->vscroll = 0; - set_marker_both (w->pointm, buffer, BUF_PT (b), BUF_PT_BYTE (b)); - set_marker_restricted (w->start, + set_marker_both (WVAR (w, pointm), buffer, BUF_PT (b), BUF_PT_BYTE (b)); + set_marker_restricted (WVAR (w, start), make_number (b->last_window_start), buffer); w->start_at_line_beg = 0; @@ -3038,7 +3043,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int Fset_buffer (buffer); } - XMARKER (w->pointm)->insertion_type = !NILP (Vwindow_point_insertion_type); + XMARKER (WVAR (w, pointm))->insertion_type = !NILP (Vwindow_point_insertion_type); if (!keep_margins_p) { @@ -3046,10 +3051,10 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int /* This may call adjust_window_margins three times, so temporarily disable window margins. */ - Lisp_Object save_left = w->left_margin_cols; - Lisp_Object save_right = w->right_margin_cols; + Lisp_Object save_left = WVAR (w, left_margin_cols); + Lisp_Object save_right = WVAR (w, right_margin_cols); - w->left_margin_cols = w->right_margin_cols = Qnil; + WVAR (w, left_margin_cols) = WVAR (w, right_margin_cols) = Qnil; Fset_window_fringes (window, BVAR (b, left_fringe_width), BVAR (b, right_fringe_width), @@ -3059,8 +3064,8 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int BVAR (b, scroll_bar_width), BVAR (b, vertical_scroll_bar_type), Qnil); - w->left_margin_cols = save_left; - w->right_margin_cols = save_right; + WVAR (w, left_margin_cols) = save_left; + WVAR (w, right_margin_cols) = save_right; Fset_window_margins (window, BVAR (b, left_margin_cols), BVAR (b, right_margin_cols)); @@ -3070,7 +3075,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int { if (! NILP (Vwindow_scroll_functions)) run_hook_with_args_2 (Qwindow_scroll_functions, window, - Fmarker_position (w->start)); + Fmarker_position (WVAR (w, start))); run_window_configuration_change_hook (XFRAME (WINDOW_FRAME (w))); } @@ -3104,7 +3109,7 @@ This function runs `window-scroll-functions' before running if (NILP (BVAR (XBUFFER (buffer), name))) error ("Attempt to display deleted buffer"); - tem = w->buffer; + tem = WVAR (w, buffer); if (NILP (tem)) error ("Window is deleted"); else if (!EQ (tem, Qt)) @@ -3112,14 +3117,14 @@ This function runs `window-scroll-functions' before running { if (!EQ (tem, buffer)) { - if (EQ (w->dedicated, Qt)) + if (EQ (WVAR (w, dedicated), Qt)) /* WINDOW is strongly dedicated to its buffer, signal an error. */ error ("Window is dedicated to `%s'", SDATA (BVAR (XBUFFER (tem), name))); else /* WINDOW is weakly dedicated to its buffer, reset dedication. */ - w->dedicated = Qnil; + WVAR (w, dedicated) = Qnil; call1 (Qrecord_window_buffer, window); } @@ -3158,8 +3163,8 @@ displaying that buffer. */) struct window *w = XWINDOW (object); mark_window_display_accurate (object, 0); w->update_mode_line = 1; - if (BUFFERP (w->buffer)) - XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; + if (BUFFERP (WVAR (w, buffer))) + XBUFFER (WVAR (w, buffer))->prevent_redisplay_optimizations_p = 1; ++update_mode_lines; return Qt; } @@ -3204,14 +3209,14 @@ temp_output_buffer_show (register Lisp_Object buf) { window = display_buffer (buf, Qnil, Qnil); - if (!EQ (XWINDOW (window)->frame, selected_frame)) + if (!EQ (WVAR (XWINDOW (window), frame), selected_frame)) Fmake_frame_visible (WINDOW_FRAME (XWINDOW (window))); Vminibuf_scroll_window = window; w = XWINDOW (window); w->hscroll = 0; w->min_hscroll = 0; - set_marker_restricted_both (w->start, buf, BEG, BEG); - set_marker_restricted_both (w->pointm, buf, BEG, BEG); + set_marker_restricted_both (WVAR (w, start), buf, BEG, BEG); + set_marker_restricted_both (WVAR (w, pointm), buf, BEG, BEG); /* Run temp-buffer-show-hook, with the chosen window selected and its buffer current. */ @@ -3228,7 +3233,7 @@ temp_output_buffer_show (register Lisp_Object buf) record_unwind_protect (Fset_buffer, prev_buffer); record_unwind_protect (select_window_norecord, prev_window); Fselect_window (window, Qt); - Fset_buffer (w->buffer); + Fset_buffer (WVAR (w, buffer)); Frun_hooks (1, &Qtemp_buffer_show_hook); unbind_to (count, Qnil); } @@ -3265,17 +3270,17 @@ make_parent_window (Lisp_Object window, int horflag) replace_window (window, parent, 1); - o->next = Qnil; - o->prev = Qnil; - o->parent = parent; + WVAR (o, next) = Qnil; + WVAR (o, prev) = Qnil; + WVAR (o, parent) = parent; - p->hchild = horflag ? window : Qnil; - p->vchild = horflag ? Qnil : window; - p->start = Qnil; - p->pointm = Qnil; - p->buffer = Qnil; - p->combination_limit = Qnil; - p->window_parameters = Qnil; + WVAR (p, hchild) = horflag ? window : Qnil; + WVAR (p, vchild) = horflag ? Qnil : window; + WVAR (p, start) = Qnil; + WVAR (p, pointm) = Qnil; + WVAR (p, buffer) = Qnil; + WVAR (p, combination_limit) = Qnil; + WVAR (p, window_parameters) = Qnil; } /* Make new window from scratch. */ @@ -3288,19 +3293,19 @@ make_window (void) w = allocate_window (); /* Initialize Lisp data. Note that allocate_window initializes all Lisp data to nil, so do it only for slots which should not be nil. */ - XSETFASTINT (w->left_col, 0); - XSETFASTINT (w->top_line, 0); - XSETFASTINT (w->total_lines, 0); - XSETFASTINT (w->total_cols, 0); - w->normal_lines = make_float (1.0); - w->normal_cols = make_float (1.0); - XSETFASTINT (w->new_total, 0); - XSETFASTINT (w->new_normal, 0); - w->start = Fmake_marker (); - w->pointm = Fmake_marker (); - w->vertical_scroll_bar_type = Qt; - XSETFASTINT (w->window_end_pos, 0); - XSETFASTINT (w->window_end_vpos, 0); + XSETFASTINT (WVAR (w, left_col), 0); + XSETFASTINT (WVAR (w, top_line), 0); + XSETFASTINT (WVAR (w, total_lines), 0); + XSETFASTINT (WVAR (w, total_cols), 0); + WVAR (w, normal_lines) = make_float (1.0); + WVAR (w, normal_cols) = make_float (1.0); + XSETFASTINT (WVAR (w, new_total), 0); + XSETFASTINT (WVAR (w, new_normal), 0); + WVAR (w, start) = Fmake_marker (); + WVAR (w, pointm) = Fmake_marker (); + WVAR (w, vertical_scroll_bar_type) = Qt; + XSETFASTINT (WVAR (w, window_end_pos), 0); + XSETFASTINT (WVAR (w, window_end_vpos), 0); /* Initialize non-Lisp data. Note that allocate_window zeroes out all non-Lisp data, so do it only for slots which should not be zero. */ @@ -3330,11 +3335,11 @@ Note: This function does not operate on any child windows of WINDOW. */) CHECK_NUMBER (size); if (NILP (add)) - XSETINT (w->new_total, XINT (size)); + XSETINT (WVAR (w, new_total), XINT (size)); else - XSETINT (w->new_total, XINT (w->new_total) + XINT (size)); + XSETINT (WVAR (w, new_total), XINT (WVAR (w, new_total)) + XINT (size)); - return w->new_total; + return WVAR (w, new_total); } DEFUN ("set-window-new-normal", Fset_window_new_normal, Sset_window_new_normal, 1, 2, 0, @@ -3346,8 +3351,8 @@ Note: This function does not operate on any child windows of WINDOW. */) { struct window *w = decode_any_window (window); - w->new_normal = size; - return w->new_normal; + WVAR (w, new_normal) = size; + return WVAR (w, new_normal); } /* Return 1 if setting w->total_lines (w->total_cols if HORFLAG is @@ -3362,19 +3367,19 @@ window_resize_check (struct window *w, int horflag) { struct window *c; - if (!NILP (w->vchild)) + if (!NILP (WVAR (w, vchild))) /* W is a vertical combination. */ { - c = XWINDOW (w->vchild); + c = XWINDOW (WVAR (w, vchild)); if (horflag) /* All child windows of W must have the same width as W. */ { while (c) { - if ((XINT (c->new_total) != XINT (w->new_total)) + if ((XINT (WVAR (c, new_total)) != XINT (WVAR (w, new_total))) || !window_resize_check (c, horflag)) return 0; - c = NILP (c->next) ? 0 : XWINDOW (c->next); + c = NILP (WVAR (c, next)) ? 0 : XWINDOW (WVAR (c, next)); } return 1; } @@ -3387,16 +3392,16 @@ window_resize_check (struct window *w, int horflag) { if (!window_resize_check (c, horflag)) return 0; - sum_of_sizes = sum_of_sizes + XINT (c->new_total); - c = NILP (c->next) ? 0 : XWINDOW (c->next); + sum_of_sizes = sum_of_sizes + XINT (WVAR (c, new_total)); + c = NILP (WVAR (c, next)) ? 0 : XWINDOW (WVAR (c, next)); } - return (sum_of_sizes == XINT (w->new_total)); + return (sum_of_sizes == XINT (WVAR (w, new_total))); } } - else if (!NILP (w->hchild)) + else if (!NILP (WVAR (w, hchild))) /* W is a horizontal combination. */ { - c = XWINDOW (w->hchild); + c = XWINDOW (WVAR (w, hchild)); if (horflag) /* The sum of the widths of the child windows of W must equal W's width. */ @@ -3406,20 +3411,20 @@ window_resize_check (struct window *w, int horflag) { if (!window_resize_check (c, horflag)) return 0; - sum_of_sizes = sum_of_sizes + XINT (c->new_total); - c = NILP (c->next) ? 0 : XWINDOW (c->next); + sum_of_sizes = sum_of_sizes + XINT (WVAR (c, new_total)); + c = NILP (WVAR (c, next)) ? 0 : XWINDOW (WVAR (c, next)); } - return (sum_of_sizes == XINT (w->new_total)); + return (sum_of_sizes == XINT (WVAR (w, new_total))); } else /* All child windows of W must have the same height as W. */ { while (c) { - if ((XINT (c->new_total) != XINT (w->new_total)) + if ((XINT (WVAR (c, new_total)) != XINT (WVAR (w, new_total))) || !window_resize_check (c, horflag)) return 0; - c = NILP (c->next) ? 0 : XWINDOW (c->next); + c = NILP (WVAR (c, next)) ? 0 : XWINDOW (WVAR (c, next)); } return 1; } @@ -3428,7 +3433,7 @@ window_resize_check (struct window *w, int horflag) /* A leaf window. Make sure it's not too small. The following hardcodes the values of `window-safe-min-width' (2) and `window-safe-min-height' (1) which are defined in window.el. */ - return XINT (w->new_total) >= (horflag ? 2 : 1); + return XINT (WVAR (w, new_total)) >= (horflag ? 2 : 1); } /* Set w->total_lines (w->total_cols if HORIZONTAL is non-zero) to @@ -3448,51 +3453,51 @@ window_resize_apply (struct window *w, int horflag) parent window has been set *before*. */ if (horflag) { - w->total_cols = w->new_total; - if (NUMBERP (w->new_normal)) - w->normal_cols = w->new_normal; + WVAR (w, total_cols) = WVAR (w, new_total); + if (NUMBERP (WVAR (w, new_normal))) + WVAR (w, normal_cols) = WVAR (w, new_normal); - pos = XINT (w->left_col); + pos = XINT (WVAR (w, left_col)); } else { - w->total_lines = w->new_total; - if (NUMBERP (w->new_normal)) - w->normal_lines = w->new_normal; + WVAR (w, total_lines) = WVAR (w, new_total); + if (NUMBERP (WVAR (w, new_normal))) + WVAR (w, normal_lines) = WVAR (w, new_normal); - pos = XINT (w->top_line); + pos = XINT (WVAR (w, top_line)); } - if (!NILP (w->vchild)) + if (!NILP (WVAR (w, vchild))) /* W is a vertical combination. */ { - c = XWINDOW (w->vchild); + c = XWINDOW (WVAR (w, vchild)); while (c) { if (horflag) - XSETFASTINT (c->left_col, pos); + XSETFASTINT (WVAR (c, left_col), pos); else - XSETFASTINT (c->top_line, pos); + XSETFASTINT (WVAR (c, top_line), pos); window_resize_apply (c, horflag); if (!horflag) - pos = pos + XINT (c->total_lines); - c = NILP (c->next) ? 0 : XWINDOW (c->next); + pos = pos + XINT (WVAR (c, total_lines)); + c = NILP (WVAR (c, next)) ? 0 : XWINDOW (WVAR (c, next)); } } - else if (!NILP (w->hchild)) + else if (!NILP (WVAR (w, hchild))) /* W is a horizontal combination. */ { - c = XWINDOW (w->hchild); + c = XWINDOW (WVAR (w, hchild)); while (c) { if (horflag) - XSETFASTINT (c->left_col, pos); + XSETFASTINT (WVAR (c, left_col), pos); else - XSETFASTINT (c->top_line, pos); + XSETFASTINT (WVAR (c, top_line), pos); window_resize_apply (c, horflag); if (horflag) - pos = pos + XINT (c->total_cols); - c = NILP (c->next) ? 0 : XWINDOW (c->next); + pos = pos + XINT (WVAR (c, total_cols)); + c = NILP (WVAR (c, next)) ? 0 : XWINDOW (WVAR (c, next)); } } @@ -3528,7 +3533,8 @@ be applied on the Elisp level. */) r = XWINDOW (FRAME_ROOT_WINDOW (f)); if (!window_resize_check (r, horflag) - || ! EQ (r->new_total, (horflag ? r->total_cols : r->total_lines))) + || ! EQ (WVAR (r, new_total), + (horflag ? WVAR (r, total_cols) : WVAR (r, total_lines)))) return Qnil; BLOCK_INPUT; @@ -3568,37 +3574,39 @@ resize_frame_windows (struct frame *f, int size, int horflag) - ((FRAME_HAS_MINIBUF_P (f) && !FRAME_MINIBUF_ONLY_P (f)) ? 1 : 0))); - XSETFASTINT (r->top_line, FRAME_TOP_MARGIN (f)); - if (NILP (r->vchild) && NILP (r->hchild)) + XSETFASTINT (WVAR (r, top_line), FRAME_TOP_MARGIN (f)); + if (NILP (WVAR (r, vchild)) && NILP (WVAR (r, hchild))) /* For a leaf root window just set the size. */ if (horflag) - XSETFASTINT (r->total_cols, new_size); + XSETFASTINT (WVAR (r, total_cols), new_size); else - XSETFASTINT (r->total_lines, new_size); + XSETFASTINT (WVAR (r, total_lines), new_size); else { /* old_size is the old size of the frame's root window. */ - int old_size = XFASTINT (horflag ? r->total_cols : r->total_lines); + int old_size = XFASTINT (horflag ? WVAR (r, total_cols) + : WVAR (r, total_lines)); Lisp_Object delta; XSETINT (delta, new_size - old_size); /* Try a "normal" resize first. */ resize_root_window (root, delta, horflag ? Qt : Qnil, Qnil); - if (window_resize_check (r, horflag) && new_size == XINT (r->new_total)) + if (window_resize_check (r, horflag) + && new_size == XINT (WVAR (r, new_total))) window_resize_apply (r, horflag); else { /* Try with "reasonable" minimum sizes next. */ resize_root_window (root, delta, horflag ? Qt : Qnil, Qt); if (window_resize_check (r, horflag) - && new_size == XINT (r->new_total)) + && new_size == XINT (WVAR (r, new_total))) window_resize_apply (r, horflag); else { /* Finally, try with "safe" minimum sizes. */ resize_root_window (root, delta, horflag ? Qt : Qnil, Qsafe); if (window_resize_check (r, horflag) - && new_size == XINT (r->new_total)) + && new_size == XINT (WVAR (r, new_total))) window_resize_apply (r, horflag); else { @@ -3607,9 +3615,9 @@ resize_frame_windows (struct frame *f, int size, int horflag) root = FVAR (f, selected_window); Fdelete_other_windows_internal (root, Qnil); if (horflag) - XSETFASTINT (XWINDOW (root)->total_cols, new_size); + XSETFASTINT (WVAR (XWINDOW (root), total_cols), new_size); else - XSETFASTINT (XWINDOW (root)->total_lines, new_size); + XSETFASTINT (WVAR (XWINDOW (root), total_lines), new_size); } } } @@ -3619,12 +3627,13 @@ resize_frame_windows (struct frame *f, int size, int horflag) { m = XWINDOW (mini); if (horflag) - XSETFASTINT (m->total_cols, size); + XSETFASTINT (WVAR (m, total_cols), size); else { /* Are we sure we always want 1 line here? */ - XSETFASTINT (m->total_lines, 1); - XSETFASTINT (m->top_line, XINT (r->top_line) + XINT (r->total_lines)); + XSETFASTINT (WVAR (m, total_lines), 1); + XSETFASTINT (WVAR (m, top_line), XINT (WVAR (r, top_line)) + + XINT (WVAR (r, total_lines))); } } } @@ -3680,10 +3689,10 @@ set correctly. See the code of `split-window' for how this is done. */) parent, or OLD is ortho-combined. */ combination_limit = !NILP (Vwindow_combination_limit) - || NILP (o->parent) + || NILP (WVAR (o, parent)) || NILP (horflag - ? (XWINDOW (o->parent)->hchild) - : (XWINDOW (o->parent)->vchild)); + ? (WVAR (XWINDOW (WVAR (o, parent)), hchild)) + : (WVAR (XWINDOW (WVAR (o, parent)), vchild))); /* We need a live reference window to initialize some parameters. */ if (WINDOW_LIVE_P (old)) @@ -3703,23 +3712,24 @@ set correctly. See the code of `split-window' for how this is done. */) /* `window-combination-resize' non-nil means try to resize OLD's siblings proportionally. */ { - p = XWINDOW (o->parent); + p = XWINDOW (WVAR (o, parent)); /* Temporarily pretend we split the parent window. */ - XSETINT (p->new_total, - XINT (horflag ? p->total_cols : p->total_lines) + XSETINT (WVAR (p, new_total), + XINT (horflag ? WVAR (p, total_cols) : WVAR (p, total_lines)) - XINT (total_size)); if (!window_resize_check (p, horflag)) error ("Window sizes don't fit"); else /* Undo the temporary pretension. */ - p->new_total = horflag ? p->total_cols : p->total_lines; + WVAR (p, new_total) + = horflag ? WVAR (p, total_cols) : WVAR (p, total_lines); } else { if (!window_resize_check (o, horflag)) error ("Resizing old window failed"); - else if (XINT (total_size) + XINT (o->new_total) - != XINT (horflag ? o->total_cols : o->total_lines)) + else if (XINT (total_size) + XINT (WVAR (o, new_total)) + != XINT (horflag ? WVAR (o, total_cols) : WVAR (o, total_lines))) error ("Sum of sizes of old and new window don't fit"); } @@ -3729,93 +3739,95 @@ set correctly. See the code of `split-window' for how this is done. */) /* Save the old value of o->normal_cols/lines. It gets corrupted by make_parent_window and we need it below for assigning it to p->new_normal. */ - Lisp_Object new_normal = horflag ? o->normal_cols : o->normal_lines; + Lisp_Object new_normal + = horflag ? WVAR (o, normal_cols) : WVAR (o, normal_lines); make_parent_window (old, horflag); - p = XWINDOW (o->parent); + p = XWINDOW (WVAR (o, parent)); /* Store value of `window-combination-limit' in new parent's combination_limit slot. */ - p->combination_limit = Vwindow_combination_limit; + WVAR (p, combination_limit) = Vwindow_combination_limit; /* These get applied below. */ - p->new_total = horflag ? o->total_cols : o->total_lines; - p->new_normal = new_normal; + WVAR (p, new_total) + = horflag ? WVAR (o, total_cols) : WVAR (o, total_lines); + WVAR (p, new_normal) = new_normal; } else - p = XWINDOW (o->parent); + p = XWINDOW (WVAR (o, parent)); windows_or_buffers_changed++; FRAME_WINDOW_SIZES_CHANGED (f) = 1; new = make_window (); n = XWINDOW (new); - n->frame = frame; - n->parent = o->parent; - n->vchild = n->hchild = Qnil; + WVAR (n, frame) = frame; + WVAR (n, parent) = WVAR (o, parent); + WVAR (n, vchild) = WVAR (n, hchild) = Qnil; if (EQ (side, Qabove) || EQ (side, Qleft)) { - n->prev = o->prev; - if (NILP (n->prev)) + WVAR (n, prev) = WVAR (o, prev); + if (NILP (WVAR (n, prev))) if (horflag) - p->hchild = new; + WVAR (p, hchild) = new; else - p->vchild = new; + WVAR (p, vchild) = new; else - XWINDOW (n->prev)->next = new; - n->next = old; - o->prev = new; + WVAR (XWINDOW (WVAR (n, prev)), next) = new; + WVAR (n, next) = old; + WVAR (o, prev) = new; } else { - n->next = o->next; - if (!NILP (n->next)) - XWINDOW (n->next)->prev = new; - n->prev = old; - o->next = new; + WVAR (n, next) = WVAR (o, next); + if (!NILP (WVAR (n, next))) + WVAR (XWINDOW (WVAR (n, next)), prev) = new; + WVAR (n, prev) = old; + WVAR (o, next) = new; } - n->buffer = Qt; - n->window_end_valid = Qnil; + WVAR (n, buffer) = Qt; + WVAR (n, window_end_valid) = Qnil; memset (&n->last_cursor, 0, sizeof n->last_cursor); /* Get special geometry settings from reference window. */ - n->left_margin_cols = r->left_margin_cols; - n->right_margin_cols = r->right_margin_cols; - n->left_fringe_width = r->left_fringe_width; - n->right_fringe_width = r->right_fringe_width; + WVAR (n, left_margin_cols) = WVAR (r, left_margin_cols); + WVAR (n, right_margin_cols) = WVAR (r, right_margin_cols); + WVAR (n, left_fringe_width) = WVAR (r, left_fringe_width); + WVAR (n, right_fringe_width) = WVAR (r, right_fringe_width); n->fringes_outside_margins = r->fringes_outside_margins; - n->scroll_bar_width = r->scroll_bar_width; - n->vertical_scroll_bar_type = r->vertical_scroll_bar_type; + WVAR (n, scroll_bar_width) = WVAR (r, scroll_bar_width); + WVAR (n, vertical_scroll_bar_type) = WVAR (r, vertical_scroll_bar_type); /* Directly assign orthogonal coordinates and sizes. */ if (horflag) { - n->top_line = o->top_line; - n->total_lines = o->total_lines; + WVAR (n, top_line) = WVAR (o, top_line); + WVAR (n, total_lines) = WVAR (o, total_lines); } else { - n->left_col = o->left_col; - n->total_cols = o->total_cols; + WVAR (n, left_col) = WVAR (o, left_col); + WVAR (n, total_cols) = WVAR (o, total_cols); } /* Iso-coordinates and sizes are assigned by window_resize_apply, get them ready here. */ - n->new_total = total_size; - n->new_normal = normal_size; + WVAR (n, new_total) = total_size; + WVAR (n, new_normal) = normal_size; BLOCK_INPUT; window_resize_apply (p, horflag); adjust_glyphs (f); /* Set buffer of NEW to buffer of reference window. Don't run any hooks. */ - set_window_buffer (new, r->buffer, 0, 1); + set_window_buffer (new, WVAR (r, buffer), 0, 1); UNBLOCK_INPUT; /* Maybe we should run the scroll functions in Elisp (which already runs the configuration change hook). */ if (! NILP (Vwindow_scroll_functions)) run_hook_with_args_2 (Qwindow_scroll_functions, new, - Fmarker_position (n->start)); + Fmarker_position (WVAR (n, start))); /* Return NEW. */ return new; } @@ -3835,21 +3847,22 @@ Signal an error when WINDOW is the only window on its frame. */) w = decode_any_window (window); XSETWINDOW (window, w); - if (NILP (w->buffer) && NILP (w->hchild) && NILP (w->vchild)) + if (NILP (WVAR (w, buffer)) + && NILP (WVAR (w, hchild)) && NILP (WVAR (w, vchild))) /* It's a no-op to delete an already deleted window. */ return Qnil; - parent = w->parent; + parent = WVAR (w, parent); if (NILP (parent)) /* Never delete a minibuffer or frame root window. */ error ("Attempt to delete minibuffer or sole ordinary window"); - else if (NILP (w->prev) && NILP (w->next)) + else if (NILP (WVAR (w, prev)) && NILP (WVAR (w, next))) /* Rather bow out here, this case should be handled on the Elisp level. */ error ("Attempt to delete sole window of parent"); p = XWINDOW (parent); - horflag = NILP (p->vchild); + horflag = NILP (WVAR (p, vchild)); frame = WINDOW_FRAME (w); f = XFRAME (frame); @@ -3858,32 +3871,33 @@ Signal an error when WINDOW is the only window on its frame. */) r = XWINDOW (root); /* Unlink WINDOW from window tree. */ - if (NILP (w->prev)) + if (NILP (WVAR (w, prev))) /* Get SIBLING below (on the right of) WINDOW. */ { /* before_sibling 1 means WINDOW is the first child of its parent and thus before the sibling. */ before_sibling = 1; - sibling = w->next; + sibling = WVAR (w, next); s = XWINDOW (sibling); - s->prev = Qnil; + WVAR (s, prev) = Qnil; if (horflag) - p->hchild = sibling; + WVAR (p, hchild) = sibling; else - p->vchild = sibling; + WVAR (p, vchild) = sibling; } else /* Get SIBLING above (on the left of) WINDOW. */ { - sibling = w->prev; + sibling = WVAR (w, prev); s = XWINDOW (sibling); - s->next = w->next; - if (!NILP (s->next)) - XWINDOW (s->next)->prev = sibling; + WVAR (s, next) = WVAR (w, next); + if (!NILP (WVAR (s, next))) + WVAR (XWINDOW (WVAR (s, next)), prev) = sibling; } if (window_resize_check (r, horflag) - && EQ (r->new_total, (horflag ? r->total_cols : r->total_lines))) + && EQ (WVAR (r, new_total), + (horflag ? WVAR (r, total_cols) : WVAR (r, total_lines)))) /* We can delete WINDOW now. */ { @@ -3905,28 +3919,28 @@ Signal an error when WINDOW is the only window on its frame. */) Vwindow_list = Qnil; FRAME_WINDOW_SIZES_CHANGED (f) = 1; - w->next = Qnil; /* Don't delete w->next too. */ + WVAR (w, next) = Qnil; /* Don't delete w->next too. */ free_window_matrices (w); - if (!NILP (w->vchild)) + if (!NILP (WVAR (w, vchild))) { - delete_all_child_windows (w->vchild); - w->vchild = Qnil; + delete_all_child_windows (WVAR (w, vchild)); + WVAR (w, vchild) = Qnil; } - else if (!NILP (w->hchild)) + else if (!NILP (WVAR (w, hchild))) { - delete_all_child_windows (w->hchild); - w->hchild = Qnil; + delete_all_child_windows (WVAR (w, hchild)); + WVAR (w, hchild) = Qnil; } - else if (!NILP (w->buffer)) + else if (!NILP (WVAR (w, buffer))) { unshow_buffer (w); - unchain_marker (XMARKER (w->pointm)); - unchain_marker (XMARKER (w->start)); - w->buffer = Qnil; + unchain_marker (XMARKER (WVAR (w, pointm))); + unchain_marker (XMARKER (WVAR (w, start))); + WVAR (w, buffer) = Qnil; } - if (NILP (s->prev) && NILP (s->next)) + if (NILP (WVAR (s, prev)) && NILP (WVAR (s, next))) /* A matrjoshka where SIBLING has become the only child of PARENT. */ { @@ -3934,10 +3948,10 @@ Signal an error when WINDOW is the only window on its frame. */) replace_window (parent, sibling, 0); /* Have SIBLING inherit the following three slot values from PARENT (the combination_limit slot is not inherited). */ - s->normal_cols = p->normal_cols; - s->normal_lines = p->normal_lines; + WVAR (s, normal_cols) = WVAR (p, normal_cols); + WVAR (s, normal_lines) = WVAR (p, normal_lines); /* Mark PARENT as deleted. */ - p->vchild = p->hchild = Qnil; + WVAR (p, vchild) = WVAR (p, hchild) = Qnil; /* Try to merge SIBLING into its new parent. */ recombine_windows (sibling); } @@ -3964,7 +3978,7 @@ Signal an error when WINDOW is the only window on its frame. */) /* Now look whether `get-mru-window' gets us something. */ mru_window = call1 (Qget_mru_window, frame); if (WINDOW_LIVE_P (mru_window) - && EQ (XWINDOW (mru_window)->frame, frame)) + && EQ (WVAR (XWINDOW (mru_window), frame), frame)) new_selected_window = mru_window; /* If all ended up well, we now promote the mru window. */ @@ -3984,17 +3998,17 @@ Signal an error when WINDOW is the only window on its frame. */) { if (before_sibling) { - s->prev = window; + WVAR (s, prev) = window; if (horflag) - p->hchild = window; + WVAR (p, hchild) = window; else - p->vchild = window; + WVAR (p, vchild) = window; } else { - s->next = window; - if (!NILP (w->next)) - XWINDOW (w->next)->prev = window; + WVAR (s, next) = window; + if (!NILP (WVAR (w, next))) + WVAR (XWINDOW (WVAR (w, next)), prev) = window; } error ("Deletion failed"); } @@ -4011,7 +4025,7 @@ Signal an error when WINDOW is the only window on its frame. */) void grow_mini_window (struct window *w, int delta) { - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); struct window *r; Lisp_Object root, value; @@ -4028,8 +4042,9 @@ grow_mini_window (struct window *w, int delta) window_resize_apply (r, 0); /* Grow the mini-window. */ - XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines)); - XSETFASTINT (w->total_lines, XFASTINT (w->total_lines) - XINT (value)); + XSETFASTINT (WVAR (w, top_line), + XFASTINT (WVAR (r, top_line)) + XFASTINT (WVAR (r, total_lines))); + XSETFASTINT (WVAR (w, total_lines), XFASTINT (WVAR (w, total_lines)) - XINT (value)); w->last_modified = 0; w->last_overlay_modified = 0; @@ -4043,14 +4058,14 @@ grow_mini_window (struct window *w, int delta) void shrink_mini_window (struct window *w) { - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); struct window *r; Lisp_Object root, value; EMACS_INT size; eassert (MINI_WINDOW_P (w)); - size = XINT (w->total_lines); + size = XINT (WVAR (w, total_lines)); if (size > 1) { root = FRAME_ROOT_WINDOW (f); @@ -4063,8 +4078,9 @@ shrink_mini_window (struct window *w) window_resize_apply (r, 0); /* Shrink the mini-window. */ - XSETFASTINT (w->top_line, XFASTINT (r->top_line) + XFASTINT (r->total_lines)); - XSETFASTINT (w->total_lines, 1); + XSETFASTINT (WVAR (w, top_line), XFASTINT (WVAR (r, top_line)) + + XFASTINT (WVAR (r, total_lines))); + XSETFASTINT (WVAR (w, total_lines), 1); w->last_modified = 0; w->last_overlay_modified = 0; @@ -4089,24 +4105,25 @@ DEFUN ("resize-mini-window-internal", Fresize_mini_window_internal, Sresize_mini int height; CHECK_WINDOW (window); - f = XFRAME (w->frame); + f = XFRAME (WVAR (w, frame)); - if (!EQ (FRAME_MINIBUF_WINDOW (XFRAME (w->frame)), window)) + if (!EQ (FRAME_MINIBUF_WINDOW (XFRAME (WVAR (w, frame))), window)) error ("Not a valid minibuffer window"); else if (FRAME_MINIBUF_ONLY_P (f)) error ("Cannot resize a minibuffer-only frame"); r = XWINDOW (FRAME_ROOT_WINDOW (f)); - height = XINT (r->total_lines) + XINT (w->total_lines); + height = XINT (WVAR (r, total_lines)) + XINT (WVAR (w, total_lines)); if (window_resize_check (r, 0) - && XINT (w->new_total) > 0 - && height == XINT (r->new_total) + XINT (w->new_total)) + && XINT (WVAR (w, new_total)) > 0 + && height == XINT (WVAR (r, new_total)) + XINT (WVAR (w, new_total))) { BLOCK_INPUT; window_resize_apply (r, 0); - w->total_lines = w->new_total; - XSETFASTINT (w->top_line, XINT (r->top_line) + XINT (r->total_lines)); + WVAR (w, total_lines) = WVAR (w, new_total); + XSETFASTINT (WVAR (w, top_line), + XINT (WVAR (r, top_line)) + XINT (WVAR (r, total_lines))); windows_or_buffers_changed++; FRAME_WINDOW_SIZES_CHANGED (f) = 1; @@ -4129,14 +4146,14 @@ mark_window_cursors_off (struct window *w) { while (w) { - if (!NILP (w->hchild)) - mark_window_cursors_off (XWINDOW (w->hchild)); - else if (!NILP (w->vchild)) - mark_window_cursors_off (XWINDOW (w->vchild)); + if (!NILP (WVAR (w, hchild))) + mark_window_cursors_off (XWINDOW (WVAR (w, hchild))); + else if (!NILP (WVAR (w, vchild))) + mark_window_cursors_off (XWINDOW (WVAR (w, vchild))); else w->phys_cursor_on_p = 0; - w = NILP (w->next) ? 0 : XWINDOW (w->next); + w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next)); } } @@ -4146,15 +4163,15 @@ mark_window_cursors_off (struct window *w) int window_internal_height (struct window *w) { - int ht = XFASTINT (w->total_lines); + int ht = XFASTINT (WVAR (w, total_lines)); if (!MINI_WINDOW_P (w)) { - if (!NILP (w->parent) - || !NILP (w->vchild) - || !NILP (w->hchild) - || !NILP (w->next) - || !NILP (w->prev) + if (!NILP (WVAR (w, parent)) + || !NILP (WVAR (w, vchild)) + || !NILP (WVAR (w, hchild)) + || !NILP (WVAR (w, next)) + || !NILP (WVAR (w, prev)) || WINDOW_WANTS_MODELINE_P (w)) --ht; @@ -4184,7 +4201,7 @@ window_scroll (Lisp_Object window, EMACS_INT n, int whole, int noerror) /* If we must, use the pixel-based version which is much slower than the line-based one but can handle varying line heights. */ - if (FRAME_WINDOW_P (XFRAME (XWINDOW (window)->frame))) + if (FRAME_WINDOW_P (XFRAME (WVAR (XWINDOW (window), frame)))) window_scroll_pixel_based (window, n, whole, noerror); else window_scroll_line_based (window, n, whole, noerror); @@ -4209,7 +4226,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) int x, y, rtop, rbot, rowh, vpos; void *itdata = NULL; - SET_TEXT_POS_FROM_MARKER (start, w->start); + SET_TEXT_POS_FROM_MARKER (start, WVAR (w, start)); /* Scrolling a minibuffer window via scroll bar when the echo area shows long text sometimes resets the minibuffer contents behind our backs. */ @@ -4290,8 +4307,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) spos = XINT (Fline_beginning_position (Qnil)); else spos = min (XINT (Fline_end_position (Qnil)) + 1, ZV); - set_marker_restricted (w->start, make_number (spos), - w->buffer); + set_marker_restricted (WVAR (w, start), make_number (spos), + WVAR (w, buffer)); w->start_at_line_beg = 1; w->update_mode_line = 1; w->last_modified = 0; @@ -4415,7 +4432,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) /* If control gets here, then we vscrolled. */ - XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; + XBUFFER (WVAR (w, buffer))->prevent_redisplay_optimizations_p = 1; /* Don't try to change the window start below. */ vscrolled = 1; @@ -4435,9 +4452,9 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) } /* Set the window start, and set up the window for redisplay. */ - set_marker_restricted (w->start, make_number (pos), - w->buffer); - bytepos = XMARKER (w->start)->bytepos; + set_marker_restricted (WVAR (w, start), make_number (pos), + WVAR (w, buffer)); + bytepos = XMARKER (WVAR (w, start))->bytepos; w->start_at_line_beg = (pos == BEGV || FETCH_BYTE (bytepos - 1) == '\n'); w->update_mode_line = 1; w->last_modified = 0; @@ -4455,7 +4472,8 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) This code wants current_y to be zero at the window start position even if there is a header line. */ this_scroll_margin = max (0, scroll_margin); - this_scroll_margin = min (this_scroll_margin, XFASTINT (w->total_lines) / 4); + this_scroll_margin + = min (this_scroll_margin, XFASTINT (WVAR (w, total_lines)) / 4); this_scroll_margin *= FRAME_LINE_HEIGHT (it.f); if (n > 0) @@ -4529,7 +4547,7 @@ window_scroll_pixel_based (Lisp_Object window, int n, int whole, int noerror) ; else if (window_scroll_pixel_based_preserve_y >= 0) { - SET_TEXT_POS_FROM_MARKER (start, w->start); + SET_TEXT_POS_FROM_MARKER (start, WVAR (w, start)); start_display (&it, w, start); /* It would be wrong to subtract CURRENT_HEADER_LINE_HEIGHT here because we called start_display again and did not @@ -4583,7 +4601,7 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) if (whole) n *= max (1, ht - next_screen_context_lines); - startpos = marker_position (w->start); + startpos = marker_position (WVAR (w, start)); if (!NILP (Vscroll_preserve_screen_position)) { @@ -4634,9 +4652,9 @@ window_scroll_line_based (Lisp_Object window, int n, int whole, int noerror) { /* Don't use a scroll margin that is negative or too large. */ int this_scroll_margin = - max (0, min (scroll_margin, XINT (w->total_lines) / 4)); + max (0, min (scroll_margin, XINT (WVAR (w, total_lines)) / 4)); - set_marker_restricted_both (w->start, w->buffer, pos, pos_byte); + set_marker_restricted_both (WVAR (w, start), WVAR (w, buffer), pos, pos_byte); w->start_at_line_beg = !NILP (bolp); w->update_mode_line = 1; w->last_modified = 0; @@ -4730,10 +4748,10 @@ scroll_command (Lisp_Object n, int direction) /* If selected window's buffer isn't current, make it current for the moment. But don't screw up if window_scroll gets an error. */ - if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer) + if (XBUFFER (WVAR (XWINDOW (selected_window), buffer)) != current_buffer) { record_unwind_protect (save_excursion_restore, save_excursion_save ()); - Fset_buffer (XWINDOW (selected_window)->buffer); + Fset_buffer (WVAR (XWINDOW (selected_window), buffer)); /* Make redisplay consider other windows than just selected_window. */ ++windows_or_buffers_changed; @@ -4848,8 +4866,8 @@ specifies the window to scroll. This takes precedence over record_unwind_protect (save_excursion_restore, save_excursion_save ()); ++windows_or_buffers_changed; - Fset_buffer (w->buffer); - SET_PT (marker_position (w->pointm)); + Fset_buffer (WVAR (w, buffer)); + SET_PT (marker_position (WVAR (w, pointm))); if (NILP (arg)) window_scroll (window, 1, 1, 1); @@ -4863,7 +4881,7 @@ specifies the window to scroll. This takes precedence over window_scroll (window, XINT (arg), 0, 1); } - set_marker_both (w->pointm, Qnil, PT, PT_BYTE); + set_marker_both (WVAR (w, pointm), Qnil, PT, PT_BYTE); unbind_to (count, Qnil); return Qnil; @@ -4941,10 +4959,10 @@ displayed_window_lines (struct window *w) int bottom_y; void *itdata = NULL; - if (XBUFFER (w->buffer) != current_buffer) + if (XBUFFER (WVAR (w, buffer)) != current_buffer) { old_buffer = current_buffer; - set_buffer_internal (XBUFFER (w->buffer)); + set_buffer_internal (XBUFFER (WVAR (w, buffer))); } else old_buffer = NULL; @@ -4952,12 +4970,12 @@ displayed_window_lines (struct window *w) /* In case W->start is out of the accessible range, do something reasonable. This happens in Info mode when Info-scroll-down calls (recenter -1) while W->start is 1. */ - if (XMARKER (w->start)->charpos < BEGV) + if (XMARKER (WVAR (w, start))->charpos < BEGV) SET_TEXT_POS (start, BEGV, BEGV_BYTE); - else if (XMARKER (w->start)->charpos > ZV) + else if (XMARKER (WVAR (w, start))->charpos > ZV) SET_TEXT_POS (start, ZV, ZV_BYTE); else - SET_TEXT_POS_FROM_MARKER (start, w->start); + SET_TEXT_POS_FROM_MARKER (start, WVAR (w, start)); itdata = bidi_shelve_cache (); start_display (&it, w, start); @@ -4971,7 +4989,7 @@ displayed_window_lines (struct window *w) This kludge fixes a bug whereby (move-to-window-line -1) when ZV is on the last screen line moves to the previous screen line instead of the last one. */ - if (! FRAME_WINDOW_P (XFRAME (w->frame))) + if (! FRAME_WINDOW_P (XFRAME (WVAR (w, frame)))) height++; /* Add in empty lines at the bottom of the window. */ @@ -5006,7 +5024,7 @@ and redisplay normally--don't erase and redraw the frame. */) (register Lisp_Object arg) { struct window *w = XWINDOW (selected_window); - struct buffer *buf = XBUFFER (w->buffer); + struct buffer *buf = XBUFFER (WVAR (w, buffer)); struct buffer *obuf = current_buffer; int center_p = 0; ptrdiff_t charpos, bytepos; @@ -5050,12 +5068,12 @@ and redisplay normally--don't erase and redraw the frame. */) /* Do this after making BUF current in case scroll_margin is buffer-local. */ this_scroll_margin = - max (0, min (scroll_margin, XFASTINT (w->total_lines) / 4)); + max (0, min (scroll_margin, XFASTINT (WVAR (w, total_lines)) / 4)); /* Handle centering on a graphical frame specially. Such frames can have variable-height lines and centering point on the basis of line counts would lead to strange effects. */ - if (FRAME_WINDOW_P (XFRAME (w->frame))) + if (FRAME_WINDOW_P (XFRAME (WVAR (w, frame)))) { if (center_p) { @@ -5172,8 +5190,8 @@ and redisplay normally--don't erase and redraw the frame. */) } /* Set the new window start. */ - set_marker_both (w->start, w->buffer, charpos, bytepos); - w->window_end_valid = Qnil; + set_marker_both (WVAR (w, start), WVAR (w, buffer), charpos, bytepos); + WVAR (w, window_end_valid) = Qnil; w->optional_new_start = 1; @@ -5195,7 +5213,7 @@ nor any partial-height lines at the bottom of the text area. */) { struct window *w = decode_window (window); int pixel_height = window_box_height (w); - int line_height = pixel_height / FRAME_LINE_HEIGHT (XFRAME (w->frame)); + int line_height = pixel_height / FRAME_LINE_HEIGHT (XFRAME (WVAR (w, frame))); return make_number (line_height); } @@ -5216,24 +5234,24 @@ zero means top of window, negative means relative to bottom of window. */) int this_scroll_margin; #endif - if (!(BUFFERP (w->buffer) - && XBUFFER (w->buffer) == current_buffer)) + if (!(BUFFERP (WVAR (w, buffer)) + && XBUFFER (WVAR (w, buffer)) == current_buffer)) /* This test is needed to make sure PT/PT_BYTE make sense in w->buffer when passed below to set_marker_both. */ error ("move-to-window-line called from unrelated buffer"); window = selected_window; - start = marker_position (w->start); + start = marker_position (WVAR (w, start)); if (start < BEGV || start > ZV) { int height = window_internal_height (w); Fvertical_motion (make_number (- (height / 2)), window); - set_marker_both (w->start, w->buffer, PT, PT_BYTE); + set_marker_both (WVAR (w, start), WVAR (w, buffer), PT, PT_BYTE); w->start_at_line_beg = !NILP (Fbolp ()); w->force_start = 1; } else - Fgoto_char (w->start); + Fgoto_char (WVAR (w, start)); lines = displayed_window_lines (w); @@ -5337,7 +5355,7 @@ DEFUN ("window-configuration-frame", Fwindow_configuration_frame, Swindow_config data = (struct save_window_data *) XVECTOR (config); saved_windows = XVECTOR (data->saved_windows); - return XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame; + return WVAR (XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window), frame); } DEFUN ("set-window-configuration", Fset_window_configuration, @@ -5379,11 +5397,11 @@ the return value is nil. Otherwise the value is t. */) window-point of the final-selected-window to the window-point of the current-selected-window. So we have to be careful which point of the current-buffer we copy into old_point. */ - if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer) + if (EQ (WVAR (XWINDOW (data->current_window), buffer), new_current_buffer) && WINDOWP (selected_window) - && EQ (XWINDOW (selected_window)->buffer, new_current_buffer) + && EQ (WVAR (XWINDOW (selected_window), buffer), new_current_buffer) && !EQ (selected_window, data->current_window)) - old_point = XMARKER (XWINDOW (data->current_window)->pointm)->charpos; + old_point = XMARKER (WVAR (XWINDOW (data->current_window), pointm))->charpos; else old_point = PT; else @@ -5395,15 +5413,15 @@ the return value is nil. Otherwise the value is t. */) So if possible we want this arbitrary choice of "which point" to be the one from the to-be-selected-window so as to prevent this window's cursor from being copied from another window. */ - if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer) + if (EQ (WVAR (XWINDOW (data->current_window), buffer), new_current_buffer) /* If current_window = selected_window, its point is in BUF_PT. */ && !EQ (selected_window, data->current_window)) - old_point = XMARKER (XWINDOW (data->current_window)->pointm)->charpos; + old_point = XMARKER (WVAR (XWINDOW (data->current_window), pointm))->charpos; else old_point = BUF_PT (XBUFFER (new_current_buffer)); } - frame = XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window)->frame; + frame = WVAR (XWINDOW (SAVED_WINDOW_N (saved_windows, 0)->window), frame); f = XFRAME (frame); /* If f is a dead frame, don't bother rebuilding its window tree. @@ -5456,13 +5474,13 @@ the return value is nil. Otherwise the value is t. */) window holds garbage.) We do this now, before restoring the window contents, and prevent it from being done later on when we select a new window. */ - if (! NILP (XWINDOW (selected_window)->buffer)) + if (! NILP (WVAR (XWINDOW (selected_window), buffer))) { w = XWINDOW (selected_window); - set_marker_both (w->pointm, - w->buffer, - BUF_PT (XBUFFER (w->buffer)), - BUF_PT_BYTE (XBUFFER (w->buffer))); + set_marker_both (WVAR (w, pointm), + WVAR (w, buffer), + BUF_PT (XBUFFER (WVAR (w, buffer))), + BUF_PT_BYTE (XBUFFER (WVAR (w, buffer)))); } windows_or_buffers_changed++; @@ -5491,60 +5509,60 @@ the return value is nil. Otherwise the value is t. */) p = SAVED_WINDOW_N (saved_windows, k); window = p->window; w = XWINDOW (window); - w->next = Qnil; + WVAR (w, next) = Qnil; if (!NILP (p->parent)) - w->parent = SAVED_WINDOW_N (saved_windows, - XFASTINT (p->parent))->window; + WVAR (w, parent) = SAVED_WINDOW_N (saved_windows, + XFASTINT (p->parent))->window; else - w->parent = Qnil; + WVAR (w, parent) = Qnil; if (!NILP (p->prev)) { - w->prev = SAVED_WINDOW_N (saved_windows, - XFASTINT (p->prev))->window; - XWINDOW (w->prev)->next = p->window; + WVAR (w, prev) = SAVED_WINDOW_N (saved_windows, + XFASTINT (p->prev))->window; + WVAR (XWINDOW (WVAR (w, prev)), next) = p->window; } else { - w->prev = Qnil; - if (!NILP (w->parent)) + WVAR (w, prev) = Qnil; + if (!NILP (WVAR (w, parent))) { - if (EQ (p->total_cols, XWINDOW (w->parent)->total_cols)) + if (EQ (p->total_cols, WVAR (XWINDOW (WVAR (w, parent)), total_cols))) { - XWINDOW (w->parent)->vchild = p->window; - XWINDOW (w->parent)->hchild = Qnil; + WVAR (XWINDOW (WVAR (w, parent)), vchild) = p->window; + WVAR (XWINDOW (WVAR (w, parent)), hchild) = Qnil; } else { - XWINDOW (w->parent)->hchild = p->window; - XWINDOW (w->parent)->vchild = Qnil; + WVAR (XWINDOW (WVAR (w, parent)), hchild) = p->window; + WVAR (XWINDOW (WVAR (w, parent)), vchild) = Qnil; } } } /* If we squirreled away the buffer in the window's height, restore it now. */ - if (BUFFERP (w->total_lines)) - w->buffer = w->total_lines; - w->left_col = p->left_col; - w->top_line = p->top_line; - w->total_cols = p->total_cols; - w->total_lines = p->total_lines; - w->normal_cols = p->normal_cols; - w->normal_lines = p->normal_lines; + if (BUFFERP (WVAR (w, total_lines))) + WVAR (w, buffer) = WVAR (w, total_lines); + WVAR (w, left_col) = p->left_col; + WVAR (w, top_line) = p->top_line; + WVAR (w, total_cols) = p->total_cols; + WVAR (w, total_lines) = p->total_lines; + WVAR (w, normal_cols) = p->normal_cols; + WVAR (w, normal_lines) = p->normal_lines; w->hscroll = XFASTINT (p->hscroll); w->min_hscroll = XFASTINT (p->min_hscroll); - w->display_table = p->display_table; - w->left_margin_cols = p->left_margin_cols; - w->right_margin_cols = p->right_margin_cols; - w->left_fringe_width = p->left_fringe_width; - w->right_fringe_width = p->right_fringe_width; + WVAR (w, display_table) = p->display_table; + WVAR (w, left_margin_cols) = p->left_margin_cols; + WVAR (w, right_margin_cols) = p->right_margin_cols; + WVAR (w, left_fringe_width) = p->left_fringe_width; + WVAR (w, right_fringe_width) = p->right_fringe_width; w->fringes_outside_margins = !NILP (p->fringes_outside_margins); - w->scroll_bar_width = p->scroll_bar_width; - w->vertical_scroll_bar_type = p->vertical_scroll_bar_type; - w->dedicated = p->dedicated; - w->combination_limit = p->combination_limit; + WVAR (w, scroll_bar_width) = p->scroll_bar_width; + WVAR (w, vertical_scroll_bar_type) = p->vertical_scroll_bar_type; + WVAR (w, dedicated) = p->dedicated; + WVAR (w, combination_limit) = p->combination_limit; /* Restore any window parameters that have been saved. Parameters that have not been saved are left alone. */ for (tem = p->window_parameters; CONSP (tem); tem = XCDR (tem)) @@ -5554,7 +5572,7 @@ the return value is nil. Otherwise the value is t. */) { if (NILP (XCDR (pers))) { - par = Fassq (XCAR (pers), w->window_parameters); + par = Fassq (XCAR (pers), WVAR (w, window_parameters)); if (CONSP (par) && !NILP (XCDR (par))) /* Reset a parameter to nil if and only if it has a non-nil association. Don't make new @@ -5573,45 +5591,50 @@ the return value is nil. Otherwise the value is t. */) /* Reinstall the saved buffer and pointers into it. */ if (NILP (p->buffer)) /* An internal window. */ - w->buffer = p->buffer; + WVAR (w, buffer) = p->buffer; else if (!NILP (BVAR (XBUFFER (p->buffer), name))) /* If saved buffer is alive, install it. */ { - w->buffer = p->buffer; + WVAR (w, buffer) = p->buffer; w->start_at_line_beg = !NILP (p->start_at_line_beg); - set_marker_restricted (w->start, p->start, w->buffer); - set_marker_restricted (w->pointm, p->pointm, w->buffer); - Fset_marker (BVAR (XBUFFER (w->buffer), mark), - p->mark, w->buffer); + set_marker_restricted (WVAR (w, start), p->start, WVAR (w, buffer)); + set_marker_restricted (WVAR (w, pointm), p->pointm, + WVAR (w, buffer)); + Fset_marker (BVAR (XBUFFER (WVAR (w, buffer)), mark), + p->mark, WVAR (w, buffer)); /* As documented in Fcurrent_window_configuration, don't restore the location of point in the buffer which was current when the window configuration was recorded. */ if (!EQ (p->buffer, new_current_buffer) && XBUFFER (p->buffer) == current_buffer) - Fgoto_char (w->pointm); + Fgoto_char (WVAR (w, pointm)); } - else if (!NILP (w->buffer) && !NILP (BVAR (XBUFFER (w->buffer), name))) + else if (!NILP (WVAR (w, buffer)) + && !NILP (BVAR (XBUFFER (WVAR (w, buffer)), name))) /* Keep window's old buffer; make sure the markers are real. */ { /* Set window markers at start of visible range. */ - if (XMARKER (w->start)->buffer == 0) - set_marker_restricted (w->start, make_number (0), - w->buffer); - if (XMARKER (w->pointm)->buffer == 0) - set_marker_restricted_both (w->pointm, w->buffer, - BUF_PT (XBUFFER (w->buffer)), - BUF_PT_BYTE (XBUFFER (w->buffer))); + if (XMARKER (WVAR (w, start))->buffer == 0) + set_marker_restricted (WVAR (w, start), make_number (0), + WVAR (w, buffer)); + if (XMARKER (WVAR (w, pointm))->buffer == 0) + set_marker_restricted_both + (WVAR (w, pointm), WVAR (w, buffer), + BUF_PT (XBUFFER (WVAR (w, buffer))), + BUF_PT_BYTE (XBUFFER (WVAR (w, buffer)))); w->start_at_line_beg = 1; } else if (STRINGP (auto_buffer_name = Fwindow_parameter (window, Qauto_buffer_name)) && SCHARS (auto_buffer_name) != 0 - && !NILP (w->buffer = Fget_buffer_create (auto_buffer_name))) + && !NILP (WVAR (w, buffer) = Fget_buffer_create (auto_buffer_name))) { - set_marker_restricted (w->start, make_number (0), w->buffer); - set_marker_restricted (w->pointm, make_number (0), w->buffer); + set_marker_restricted (WVAR (w, start), + make_number (0), WVAR (w, buffer)); + set_marker_restricted (WVAR (w, pointm), + make_number (0), WVAR (w, buffer)); w->start_at_line_beg = 1; } else @@ -5621,34 +5644,36 @@ the return value is nil. Otherwise the value is t. */) avoid showing an unimportant buffer and, if necessary, to recreate *scratch* in the course (part of Juanma's bs-show scenario from March 2011). */ - w->buffer = other_buffer_safely (Fcurrent_buffer ()); + WVAR (w, buffer) = other_buffer_safely (Fcurrent_buffer ()); /* This will set the markers to beginning of visible range. */ - set_marker_restricted (w->start, make_number (0), w->buffer); - set_marker_restricted (w->pointm, make_number (0), w->buffer); + set_marker_restricted (WVAR (w, start), + make_number (0), WVAR (w, buffer)); + set_marker_restricted (WVAR (w, pointm), + make_number (0), WVAR (w, buffer)); w->start_at_line_beg = 1; - if (!NILP (w->dedicated)) + if (!NILP (WVAR (w, dedicated))) /* Record this window as dead. */ dead_windows = Fcons (window, dead_windows); /* Make sure window is no more dedicated. */ - w->dedicated = Qnil; + WVAR (w, dedicated) = Qnil; } } FRAME_ROOT_WINDOW (f) = data->root_window; /* Arrange *not* to restore point in the buffer that was current when the window configuration was saved. */ - if (EQ (XWINDOW (data->current_window)->buffer, new_current_buffer)) - set_marker_restricted (XWINDOW (data->current_window)->pointm, + if (EQ (WVAR (XWINDOW (data->current_window), buffer), new_current_buffer)) + set_marker_restricted (WVAR (XWINDOW (data->current_window), pointm), make_number (old_point), - XWINDOW (data->current_window)->buffer); + WVAR (XWINDOW (data->current_window), buffer)); /* In the following call to `select-window', prevent "swapping out point" in the old selected window using the buffer that has been restored into it. We already swapped out that point from that window's old buffer. */ select_window (data->current_window, Qnil, 1); - BVAR (XBUFFER (XWINDOW (selected_window)->buffer), last_selected_window) + BVAR (XBUFFER (WVAR (XWINDOW (selected_window), buffer)), last_selected_window) = selected_window; if (NILP (data->focus_frame) @@ -5675,14 +5700,14 @@ the return value is nil. Otherwise the value is t. */) /* Now, free glyph matrices in windows that were not reused. */ for (i = n = 0; i < n_leaf_windows; ++i) { - if (NILP (leaf_windows[i]->buffer)) + if (NILP (WVAR (leaf_windows[i], buffer))) { /* Assert it's not reused as a combination. */ - eassert (NILP (leaf_windows[i]->hchild) - && NILP (leaf_windows[i]->vchild)); + eassert (NILP (WVAR (leaf_windows[i], hchild)) + && NILP (WVAR (leaf_windows[i], vchild))); free_window_matrices (leaf_windows[i]); } - else if (EQ (leaf_windows[i]->buffer, new_current_buffer)) + else if (EQ (WVAR (leaf_windows[i], buffer), new_current_buffer)) ++n; } @@ -5727,28 +5752,28 @@ delete_all_child_windows (Lisp_Object window) w = XWINDOW (window); - if (!NILP (w->next)) + if (!NILP (WVAR (w, next))) /* Delete WINDOW's siblings (we traverse postorderly). */ - delete_all_child_windows (w->next); + delete_all_child_windows (WVAR (w, next)); - w->total_lines = w->buffer; /* See Fset_window_configuration for excuse. */ + WVAR (w, total_lines) = WVAR (w, buffer); /* See Fset_window_configuration for excuse. */ - if (!NILP (w->vchild)) + if (!NILP (WVAR (w, vchild))) { - delete_all_child_windows (w->vchild); - w->vchild = Qnil; + delete_all_child_windows (WVAR (w, vchild)); + WVAR (w, vchild) = Qnil; } - else if (!NILP (w->hchild)) + else if (!NILP (WVAR (w, hchild))) { - delete_all_child_windows (w->hchild); - w->hchild = Qnil; + delete_all_child_windows (WVAR (w, hchild)); + WVAR (w, hchild) = Qnil; } - else if (!NILP (w->buffer)) + else if (!NILP (WVAR (w, buffer))) { unshow_buffer (w); - unchain_marker (XMARKER (w->pointm)); - unchain_marker (XMARKER (w->start)); - w->buffer = Qnil; + unchain_marker (XMARKER (WVAR (w, pointm))); + unchain_marker (XMARKER (WVAR (w, start))); + WVAR (w, buffer) = Qnil; } Vwindow_list = Qnil; @@ -5758,12 +5783,12 @@ static int count_windows (register struct window *window) { register int count = 1; - if (!NILP (window->next)) - count += count_windows (XWINDOW (window->next)); - if (!NILP (window->vchild)) - count += count_windows (XWINDOW (window->vchild)); - if (!NILP (window->hchild)) - count += count_windows (XWINDOW (window->hchild)); + if (!NILP (WVAR (window, next))) + count += count_windows (XWINDOW (WVAR (window, next))); + if (!NILP (WVAR (window, vchild))) + count += count_windows (XWINDOW (WVAR (window, vchild))); + if (!NILP (WVAR (window, hchild))) + count += count_windows (XWINDOW (WVAR (window, hchild))); return count; } @@ -5775,14 +5800,14 @@ get_leaf_windows (struct window *w, struct window **flat, int i) { while (w) { - if (!NILP (w->hchild)) - i = get_leaf_windows (XWINDOW (w->hchild), flat, i); - else if (!NILP (w->vchild)) - i = get_leaf_windows (XWINDOW (w->vchild), flat, i); + if (!NILP (WVAR (w, hchild))) + i = get_leaf_windows (XWINDOW (WVAR (w, hchild)), flat, i); + else if (!NILP (WVAR (w, vchild))) + i = get_leaf_windows (XWINDOW (WVAR (w, vchild)), flat, i); else flat[i++] = w; - w = NILP (w->next) ? 0 : XWINDOW (w->next); + w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next)); } return i; @@ -5835,32 +5860,32 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) register struct window *w; register Lisp_Object tem, pers, par; - for (;!NILP (window); window = w->next) + for (;!NILP (window); window = WVAR (w, next)) { p = SAVED_WINDOW_N (vector, i); w = XWINDOW (window); - XSETFASTINT (w->temslot, i); i++; + XSETFASTINT (WVAR (w, temslot), i); i++; p->window = window; - p->buffer = w->buffer; - p->left_col = w->left_col; - p->top_line = w->top_line; - p->total_cols = w->total_cols; - p->total_lines = w->total_lines; - p->normal_cols = w->normal_cols; - p->normal_lines = w->normal_lines; + p->buffer = WVAR (w, buffer); + p->left_col = WVAR (w, left_col); + p->top_line = WVAR (w, top_line); + p->total_cols = WVAR (w, total_cols); + p->total_lines = WVAR (w, total_lines); + p->normal_cols = WVAR (w, normal_cols); + p->normal_lines = WVAR (w, normal_lines); XSETFASTINT (p->hscroll, w->hscroll); XSETFASTINT (p->min_hscroll, w->min_hscroll); - p->display_table = w->display_table; - p->left_margin_cols = w->left_margin_cols; - p->right_margin_cols = w->right_margin_cols; - p->left_fringe_width = w->left_fringe_width; - p->right_fringe_width = w->right_fringe_width; + p->display_table = WVAR (w, display_table); + p->left_margin_cols = WVAR (w, left_margin_cols); + p->right_margin_cols = WVAR (w, right_margin_cols); + p->left_fringe_width = WVAR (w, left_fringe_width); + p->right_fringe_width = WVAR (w, right_fringe_width); p->fringes_outside_margins = w->fringes_outside_margins ? Qt : Qnil; - p->scroll_bar_width = w->scroll_bar_width; - p->vertical_scroll_bar_type = w->vertical_scroll_bar_type; - p->dedicated = w->dedicated; - p->combination_limit = w->combination_limit; + p->scroll_bar_width = WVAR (w, scroll_bar_width); + p->vertical_scroll_bar_type = WVAR (w, vertical_scroll_bar_type); + p->dedicated = WVAR (w, dedicated); + p->combination_limit = WVAR (w, combination_limit); p->window_parameters = Qnil; if (!NILP (Vwindow_persistent_parameters)) @@ -5893,7 +5918,7 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) /* Save values for persistent window parameters. */ if (CONSP (pers) && !NILP (XCDR (pers))) { - par = Fassq (XCAR (pers), w->window_parameters); + par = Fassq (XCAR (pers), WVAR (w, window_parameters)); if (NILP (par)) /* If the window has no value for the parameter, make one. */ @@ -5909,24 +5934,24 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) } } - if (!NILP (w->buffer)) + if (!NILP (WVAR (w, buffer))) { /* Save w's value of point in the window configuration. If w is the selected window, then get the value of point from the buffer; pointm is garbage in the selected window. */ if (EQ (window, selected_window)) - p->pointm = build_marker (XBUFFER (w->buffer), - BUF_PT (XBUFFER (w->buffer)), - BUF_PT_BYTE (XBUFFER (w->buffer))); + p->pointm = build_marker (XBUFFER (WVAR (w, buffer)), + BUF_PT (XBUFFER (WVAR (w, buffer))), + BUF_PT_BYTE (XBUFFER (WVAR (w, buffer)))); else - p->pointm = Fcopy_marker (w->pointm, Qnil); + p->pointm = Fcopy_marker (WVAR (w, pointm), Qnil); XMARKER (p->pointm)->insertion_type = !NILP (Vwindow_point_insertion_type); - p->start = Fcopy_marker (w->start, Qnil); + p->start = Fcopy_marker (WVAR (w, start), Qnil); p->start_at_line_beg = w->start_at_line_beg ? Qt : Qnil; - tem = BVAR (XBUFFER (w->buffer), mark); + tem = BVAR (XBUFFER (WVAR (w, buffer)), mark); p->mark = Fcopy_marker (tem, Qnil); } else @@ -5937,20 +5962,20 @@ save_window_save (Lisp_Object window, struct Lisp_Vector *vector, int i) p->start_at_line_beg = Qnil; } - if (NILP (w->parent)) + if (NILP (WVAR (w, parent))) p->parent = Qnil; else - p->parent = XWINDOW (w->parent)->temslot; + p->parent = WVAR (XWINDOW (WVAR (w, parent)), temslot); - if (NILP (w->prev)) + if (NILP (WVAR (w, prev))) p->prev = Qnil; else - p->prev = XWINDOW (w->prev)->temslot; + p->prev = WVAR (XWINDOW (WVAR (w, prev)), temslot); - if (!NILP (w->vchild)) - i = save_window_save (w->vchild, vector, i); - if (!NILP (w->hchild)) - i = save_window_save (w->hchild, vector, i); + if (!NILP (WVAR (w, vchild))) + i = save_window_save (WVAR (w, vchild), vector, i); + if (!NILP (WVAR (w, hchild))) + i = save_window_save (WVAR (w, hchild), vector, i); } return i; @@ -6039,11 +6064,11 @@ means no margin. */) right_width = Qnil; } - if (!EQ (w->left_margin_cols, left_width) - || !EQ (w->right_margin_cols, right_width)) + if (!EQ (WVAR (w, left_margin_cols), left_width) + || !EQ (WVAR (w, right_margin_cols), right_width)) { - w->left_margin_cols = left_width; - w->right_margin_cols = right_width; + WVAR (w, left_margin_cols) = left_width; + WVAR (w, right_margin_cols) = right_width; adjust_window_margins (w); @@ -6065,7 +6090,7 @@ as nil. */) (Lisp_Object window) { struct window *w = decode_window (window); - return Fcons (w->left_margin_cols, w->right_margin_cols); + return Fcons (WVAR (w, left_margin_cols), WVAR (w, right_margin_cols)); } @@ -6099,18 +6124,18 @@ display marginal areas and the text area. */) /* Do nothing on a tty. */ if (FRAME_WINDOW_P (WINDOW_XFRAME (w)) - && (!EQ (w->left_fringe_width, left_width) - || !EQ (w->right_fringe_width, right_width) + && (!EQ (WVAR (w, left_fringe_width), left_width) + || !EQ (WVAR (w, right_fringe_width), right_width) || w->fringes_outside_margins != outside)) { - w->left_fringe_width = left_width; - w->right_fringe_width = right_width; + WVAR (w, left_fringe_width) = left_width; + WVAR (w, right_fringe_width) = right_width; w->fringes_outside_margins = outside; adjust_window_margins (w); clear_glyph_matrix (w->current_matrix); - w->window_end_valid = Qnil; + WVAR (w, window_end_valid) = Qnil; ++windows_or_buffers_changed; adjust_glyphs (XFRAME (WINDOW_FRAME (w))); @@ -6170,16 +6195,16 @@ Fourth parameter HORIZONTAL-TYPE is currently unused. */) || EQ (vertical_type, Qt))) error ("Invalid type of vertical scroll bar"); - if (!EQ (w->scroll_bar_width, width) - || !EQ (w->vertical_scroll_bar_type, vertical_type)) + if (!EQ (WVAR (w, scroll_bar_width), width) + || !EQ (WVAR (w, vertical_scroll_bar_type), vertical_type)) { - w->scroll_bar_width = width; - w->vertical_scroll_bar_type = vertical_type; + WVAR (w, scroll_bar_width) = width; + WVAR (w, vertical_scroll_bar_type) = vertical_type; adjust_window_margins (w); clear_glyph_matrix (w->current_matrix); - w->window_end_valid = Qnil; + WVAR (w, window_end_valid) = Qnil; ++windows_or_buffers_changed; adjust_glyphs (XFRAME (WINDOW_FRAME (w))); @@ -6203,7 +6228,7 @@ value. */) ? WINDOW_CONFIG_SCROLL_BAR_WIDTH (w) : WINDOW_SCROLL_BAR_AREA_WIDTH (w))), Fcons (make_number (WINDOW_SCROLL_BAR_COLS (w)), - Fcons (w->vertical_scroll_bar_type, + Fcons (WVAR (w, vertical_scroll_bar_type), Fcons (Qnil, Qnil)))); } @@ -6229,7 +6254,7 @@ optional second arg PIXELS-P means value is measured in pixels. */) else CHECK_WINDOW (window); w = XWINDOW (window); - f = XFRAME (w->frame); + f = XFRAME (WVAR (w, frame)); if (FRAME_WINDOW_P (f)) result = (NILP (pixels_p) @@ -6263,7 +6288,7 @@ If PIXELS-P is non-nil, the return value is VSCROLL. */) CHECK_NUMBER_OR_FLOAT (vscroll); w = XWINDOW (window); - f = XFRAME (w->frame); + f = XFRAME (WVAR (w, frame)); if (FRAME_WINDOW_P (f)) { @@ -6282,7 +6307,7 @@ If PIXELS-P is non-nil, the return value is VSCROLL. */) adjust_glyphs (f); /* Prevent redisplay shortcuts. */ - XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; + XBUFFER (WVAR (w, buffer))->prevent_redisplay_optimizations_p = 1; } } @@ -6316,14 +6341,14 @@ foreach_window_1 (struct window *w, int (*fn) (struct window *, void *), void *u for (cont = 1; w && cont;) { - if (!NILP (w->hchild)) - cont = foreach_window_1 (XWINDOW (w->hchild), fn, user_data); - else if (!NILP (w->vchild)) - cont = foreach_window_1 (XWINDOW (w->vchild), fn, user_data); + if (!NILP (WVAR (w, hchild))) + cont = foreach_window_1 (XWINDOW (WVAR (w, hchild)), fn, user_data); + else if (!NILP (WVAR (w, vchild))) + cont = foreach_window_1 (XWINDOW (WVAR (w, vchild)), fn, user_data); else cont = fn (w, user_data); - w = NILP (w->next) ? 0 : XWINDOW (w->next); + w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next)); } return cont; diff --git a/src/window.h b/src/window.h index 16aecd0f01..ece58d2cf9 100644 --- a/src/window.h +++ b/src/window.h @@ -86,142 +86,150 @@ struct cursor_pos int hpos, vpos; }; +/* Most code should use this macro to access Lisp fields in struct window. */ + +#define WVAR(w, field) ((w)->INTERNAL_FIELD (field)) + struct window { /* This is for Lisp; the terminal code does not refer to it. */ struct vectorlike_header header; /* The frame this window is on. */ - Lisp_Object frame; + Lisp_Object INTERNAL_FIELD (frame); /* Following (to right or down) and preceding (to left or up) child at same level of tree. */ - Lisp_Object next, prev; + Lisp_Object INTERNAL_FIELD (next); + Lisp_Object INTERNAL_FIELD (prev); /* First child of this window: vchild is used if this is a vertical combination, hchild if this is a horizontal combination. Of the fields vchild, hchild and buffer, one and only one is non-nil unless the window is dead. */ - Lisp_Object hchild, vchild; + Lisp_Object INTERNAL_FIELD (hchild); + Lisp_Object INTERNAL_FIELD (vchild); /* The window this one is a child of. */ - Lisp_Object parent; + Lisp_Object INTERNAL_FIELD (parent); /* The upper left corner coordinates of this window, as integers relative to upper left corner of frame = 0, 0. */ - Lisp_Object left_col; - Lisp_Object top_line; + Lisp_Object INTERNAL_FIELD (left_col); + Lisp_Object INTERNAL_FIELD (top_line); /* The size of the window. */ - Lisp_Object total_lines; - Lisp_Object total_cols; + Lisp_Object INTERNAL_FIELD (total_lines); + Lisp_Object INTERNAL_FIELD (total_cols); /* The normal size of the window. */ - Lisp_Object normal_lines; - Lisp_Object normal_cols; + Lisp_Object INTERNAL_FIELD (normal_lines); + Lisp_Object INTERNAL_FIELD (normal_cols); /* New sizes of the window. */ - Lisp_Object new_total; - Lisp_Object new_normal; + Lisp_Object INTERNAL_FIELD (new_total); + Lisp_Object INTERNAL_FIELD (new_normal); /* The buffer displayed in this window. Of the fields vchild, hchild and buffer, one and only one is non-nil unless the window is dead. */ - Lisp_Object buffer; + Lisp_Object INTERNAL_FIELD (buffer); /* A marker pointing to where in the text to start displaying. BIDI Note: This is the _logical-order_ start, i.e. the smallest buffer position visible in the window, not necessarily the character displayed in the top left corner of the window. */ - Lisp_Object start; + Lisp_Object INTERNAL_FIELD (start); /* A marker pointing to where in the text point is in this window, used only when the window is not selected. This exists so that when multiple windows show one buffer each one can have its own value of point. */ - Lisp_Object pointm; + Lisp_Object INTERNAL_FIELD (pointm); /* No permanent meaning; used by save-window-excursion's bookkeeping. */ - Lisp_Object temslot; + Lisp_Object INTERNAL_FIELD (temslot); /* This window's vertical scroll bar. This field is only for use by the window-system-dependent code which implements the scroll bars; it can store anything it likes here. If this window is newly created and we haven't displayed a scroll bar in it yet, or if the frame doesn't have any scroll bars, this is nil. */ - Lisp_Object vertical_scroll_bar; + Lisp_Object INTERNAL_FIELD (vertical_scroll_bar); /* Width of left and right marginal areas. A value of nil means no margin. */ - Lisp_Object left_margin_cols, right_margin_cols; + Lisp_Object INTERNAL_FIELD (left_margin_cols); + Lisp_Object INTERNAL_FIELD (right_margin_cols); /* Width of left and right fringes. A value of nil or t means use frame values. */ - Lisp_Object left_fringe_width, right_fringe_width; + Lisp_Object INTERNAL_FIELD (left_fringe_width); + Lisp_Object INTERNAL_FIELD (right_fringe_width); /* Pixel width of scroll bars. A value of nil or t means use frame values. */ - Lisp_Object scroll_bar_width; + Lisp_Object INTERNAL_FIELD (scroll_bar_width); /* Type of vertical scroll bar. A value of nil means no scroll bar. A value of t means use frame value. */ - Lisp_Object vertical_scroll_bar_type; + Lisp_Object INTERNAL_FIELD (vertical_scroll_bar_type); /* Z - the buffer position of the last glyph in the current matrix of W. Only valid if WINDOW_END_VALID is not nil. */ - Lisp_Object window_end_pos; + Lisp_Object INTERNAL_FIELD (window_end_pos); /* Glyph matrix row of the last glyph in the current matrix of W. Only valid if WINDOW_END_VALID is not nil. */ - Lisp_Object window_end_vpos; + Lisp_Object INTERNAL_FIELD (window_end_vpos); /* t if window_end_pos is truly valid. This is nil if nontrivial redisplay is preempted since in that case the frame image that window_end_pos did not get onto the frame. */ - Lisp_Object window_end_valid; + Lisp_Object INTERNAL_FIELD (window_end_valid); /* Display-table to use for displaying chars in this window. Nil means use the buffer's own display-table. */ - Lisp_Object display_table; + Lisp_Object INTERNAL_FIELD (display_table); /* Non-nil usually means window is marked as dedicated. Note Lisp code may set this to something beyond Qnil and Qt, so bitfield can't be used here. */ - Lisp_Object dedicated; + Lisp_Object INTERNAL_FIELD (dedicated); /* Line number and position of a line somewhere above the top of the screen. If this field is nil, it means we don't have a base line. */ - Lisp_Object base_line_number; + Lisp_Object INTERNAL_FIELD (base_line_number); /* If this field is nil, it means we don't have a base line. If it is a buffer, it means don't display the line number as long as the window shows that buffer. */ - Lisp_Object base_line_pos; + Lisp_Object INTERNAL_FIELD (base_line_pos); /* If we have highlighted the region (or any part of it), this is the mark position that we used, as an integer. */ - Lisp_Object region_showing; + Lisp_Object INTERNAL_FIELD (region_showing); /* The column number currently displayed in this window's mode line, or nil if column numbers are not being displayed. */ - Lisp_Object column_number_displayed; + Lisp_Object INTERNAL_FIELD (column_number_displayed); /* If redisplay in this window goes beyond this buffer position, must run the redisplay-end-trigger-hook. */ - Lisp_Object redisplay_end_trigger; + Lisp_Object INTERNAL_FIELD (redisplay_end_trigger); /* t means this window's child windows are not (re-)combined. */ - Lisp_Object combination_limit; + Lisp_Object INTERNAL_FIELD (combination_limit); /* Alist of triples listing buffers previously shown in this window. */ - Lisp_Object prev_buffers; + Lisp_Object INTERNAL_FIELD (prev_buffers); /* List of buffers re-shown in this window. */ - Lisp_Object next_buffers; + Lisp_Object INTERNAL_FIELD (next_buffers); /* An alist with parameters. */ - Lisp_Object window_parameters; + Lisp_Object INTERNAL_FIELD (window_parameters); /* No Lisp data may follow below this point without changing mark_object in alloc.c. The member current_matrix must be the @@ -388,13 +396,13 @@ struct window This includes scroll bars and fringes. */ #define WINDOW_TOTAL_COLS(W) \ - (XFASTINT ((W)->total_cols)) + (XFASTINT (WVAR (W, total_cols))) /* Return the height of window W in canonical line units. This includes header and mode lines, if any. */ #define WINDOW_TOTAL_LINES(W) \ - (XFASTINT ((W)->total_lines)) + (XFASTINT (WVAR (W, total_lines))) /* Return the total pixel width of window W. */ @@ -422,7 +430,7 @@ struct window This includes a left-hand scroll bar, if any. */ #define WINDOW_LEFT_EDGE_COL(W) \ - (XFASTINT ((W)->left_col)) + (XFASTINT (WVAR (W, left_col))) /* Return the canonical frame column before which window W ends. This includes a right-hand scroll bar, if any. */ @@ -434,7 +442,7 @@ struct window This includes a header line, if any. */ #define WINDOW_TOP_EDGE_LINE(W) \ - (XFASTINT ((W)->top_line)) + (XFASTINT (WVAR (W, top_line))) /* Return the canonical frame line before which window W ends. This includes a mode line, if any. */ @@ -539,31 +547,31 @@ struct window /* Width of left margin area in columns. */ #define WINDOW_LEFT_MARGIN_COLS(W) \ - (NILP ((W)->left_margin_cols) \ + (NILP (WVAR (W, left_margin_cols)) \ ? 0 \ - : XINT ((W)->left_margin_cols)) + : XINT (WVAR (W, left_margin_cols))) /* Width of right marginal area in columns. */ #define WINDOW_RIGHT_MARGIN_COLS(W) \ - (NILP ((W)->right_margin_cols) \ + (NILP (WVAR (W, right_margin_cols)) \ ? 0 \ - : XINT ((W)->right_margin_cols)) + : XINT (WVAR (W, right_margin_cols))) /* Width of left margin area in pixels. */ #define WINDOW_LEFT_MARGIN_WIDTH(W) \ - (NILP ((W)->left_margin_cols) \ + (NILP (WVAR (W, left_margin_cols)) \ ? 0 \ - : (XINT ((W)->left_margin_cols) \ + : (XINT (WVAR (W, left_margin_cols)) \ * WINDOW_FRAME_COLUMN_WIDTH (W))) /* Width of right marginal area in pixels. */ #define WINDOW_RIGHT_MARGIN_WIDTH(W) \ - (NILP ((W)->right_margin_cols) \ + (NILP (WVAR (W, right_margin_cols)) \ ? 0 \ - : (XINT ((W)->right_margin_cols) \ + : (XINT (WVAR (W, right_margin_cols)) \ * WINDOW_FRAME_COLUMN_WIDTH (W))) /* Total width of fringes reserved for drawing truncation bitmaps, @@ -573,8 +581,8 @@ struct window able to split windows horizontally nicely. */ #define WINDOW_FRINGE_COLS(W) \ - ((INTEGERP ((W)->left_fringe_width) \ - || INTEGERP ((W)->right_fringe_width)) \ + ((INTEGERP (WVAR (W, left_fringe_width)) \ + || INTEGERP (WVAR (W, right_fringe_width))) \ ? ((WINDOW_LEFT_FRINGE_WIDTH (W) \ + WINDOW_RIGHT_FRINGE_WIDTH (W) \ + WINDOW_FRAME_COLUMN_WIDTH (W) - 1) \ @@ -596,13 +604,13 @@ struct window /* Pixel-width of the left and right fringe. */ #define WINDOW_LEFT_FRINGE_WIDTH(W) \ - (INTEGERP ((W)->left_fringe_width) \ - ? XFASTINT ((W)->left_fringe_width) \ + (INTEGERP (WVAR (W, left_fringe_width)) \ + ? XFASTINT (WVAR (W, left_fringe_width)) \ : FRAME_LEFT_FRINGE_WIDTH (WINDOW_XFRAME (W))) #define WINDOW_RIGHT_FRINGE_WIDTH(W) \ - (INTEGERP ((W)->right_fringe_width) \ - ? XFASTINT ((W)->right_fringe_width) \ + (INTEGERP (WVAR (W, right_fringe_width)) \ + ? XFASTINT (WVAR (W, right_fringe_width)) \ : FRAME_RIGHT_FRINGE_WIDTH (WINDOW_XFRAME (W))) /* Total width of fringes in pixels. */ @@ -619,36 +627,36 @@ struct window and which side they are on. */ #define WINDOW_VERTICAL_SCROLL_BAR_TYPE(w) \ - (EQ ((w)->vertical_scroll_bar_type, Qt) \ + (EQ (WVAR (w, vertical_scroll_bar_type), Qt) \ ? FRAME_VERTICAL_SCROLL_BAR_TYPE (WINDOW_XFRAME (w)) \ - : EQ ((w)->vertical_scroll_bar_type, Qleft) \ + : EQ (WVAR (w, vertical_scroll_bar_type), Qleft) \ ? vertical_scroll_bar_left \ - : EQ ((w)->vertical_scroll_bar_type, Qright) \ + : EQ (WVAR (w, vertical_scroll_bar_type), Qright) \ ? vertical_scroll_bar_right \ : vertical_scroll_bar_none) \ #define WINDOW_HAS_VERTICAL_SCROLL_BAR(w) \ - (EQ ((w)->vertical_scroll_bar_type, Qt) \ + (EQ (WVAR (w, vertical_scroll_bar_type), Qt) \ ? FRAME_HAS_VERTICAL_SCROLL_BARS (WINDOW_XFRAME (w)) \ - : !NILP ((w)->vertical_scroll_bar_type)) + : !NILP (WVAR (w, vertical_scroll_bar_type))) #define WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT(w) \ - (EQ ((w)->vertical_scroll_bar_type, Qt) \ + (EQ (WVAR (w, vertical_scroll_bar_type), Qt) \ ? FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (WINDOW_XFRAME (w)) \ - : EQ ((w)->vertical_scroll_bar_type, Qleft)) + : EQ (WVAR (w, vertical_scroll_bar_type), Qleft)) #define WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT(w) \ - (EQ ((w)->vertical_scroll_bar_type, Qt) \ + (EQ (WVAR (w, vertical_scroll_bar_type), Qt) \ ? FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (WINDOW_XFRAME (w))\ - : EQ ((w)->vertical_scroll_bar_type, Qright)) + : EQ (WVAR (w, vertical_scroll_bar_type), Qright)) /* Width that a scroll bar in window W should have, if there is one. Measured in pixels. If scroll bars are turned off, this is still nonzero. */ #define WINDOW_CONFIG_SCROLL_BAR_WIDTH(w) \ - (INTEGERP ((w)->scroll_bar_width) \ - ? XFASTINT ((w)->scroll_bar_width) \ + (INTEGERP (WVAR (w, scroll_bar_width)) \ + ? XFASTINT (WVAR (w, scroll_bar_width)) \ : FRAME_CONFIG_SCROLL_BAR_WIDTH (WINDOW_XFRAME (w))) /* Width that a scroll bar in window W should have, if there is one. @@ -656,8 +664,8 @@ struct window this is still nonzero. */ #define WINDOW_CONFIG_SCROLL_BAR_COLS(w) \ - (INTEGERP ((w)->scroll_bar_width) \ - ? ((XFASTINT ((w)->scroll_bar_width) \ + (INTEGERP (WVAR (w, scroll_bar_width)) \ + ? ((XFASTINT (WVAR (w, scroll_bar_width)) \ + WINDOW_FRAME_COLUMN_WIDTH (w) - 1) \ / WINDOW_FRAME_COLUMN_WIDTH (w)) \ : FRAME_CONFIG_SCROLL_BAR_COLS (WINDOW_XFRAME (w))) @@ -880,7 +888,7 @@ struct glyph *get_phys_cursor_glyph (struct window *w); /* Value is non-zero if WINDOW is a live window. */ #define WINDOW_LIVE_P(WINDOW) \ - (WINDOWP ((WINDOW)) && !NILP (XWINDOW ((WINDOW))->buffer)) + (WINDOWP ((WINDOW)) && !NILP (WVAR (XWINDOW ((WINDOW)), buffer))) /* These used to be in lisp.h. */ diff --git a/src/xdisp.c b/src/xdisp.c index 36196e876c..153e139b04 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -984,7 +984,7 @@ window_text_bottom_y (struct window *w) int window_box_width (struct window *w, int area) { - int cols = XFASTINT (w->total_cols); + int cols = XFASTINT (WVAR (w, total_cols)); int pixels = 0; if (!w->pseudo_window_p) @@ -993,22 +993,22 @@ window_box_width (struct window *w, int area) if (area == TEXT_AREA) { - if (INTEGERP (w->left_margin_cols)) - cols -= XFASTINT (w->left_margin_cols); - if (INTEGERP (w->right_margin_cols)) - cols -= XFASTINT (w->right_margin_cols); + if (INTEGERP (WVAR (w, left_margin_cols))) + cols -= XFASTINT (WVAR (w, left_margin_cols)); + if (INTEGERP (WVAR (w, right_margin_cols))) + cols -= XFASTINT (WVAR (w, right_margin_cols)); pixels = -WINDOW_TOTAL_FRINGE_WIDTH (w); } else if (area == LEFT_MARGIN_AREA) { - cols = (INTEGERP (w->left_margin_cols) - ? XFASTINT (w->left_margin_cols) : 0); + cols = (INTEGERP (WVAR (w, left_margin_cols)) + ? XFASTINT (WVAR (w, left_margin_cols)) : 0); pixels = 0; } else if (area == RIGHT_MARGIN_AREA) { - cols = (INTEGERP (w->right_margin_cols) - ? XFASTINT (w->right_margin_cols) : 0); + cols = (INTEGERP (WVAR (w, right_margin_cols)) + ? XFASTINT (WVAR (w, right_margin_cols)) : 0); pixels = 0; } } @@ -1023,7 +1023,7 @@ window_box_width (struct window *w, int area) int window_box_height (struct window *w) { - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); int height = WINDOW_TOTAL_HEIGHT (w); eassert (height >= 0); @@ -1112,7 +1112,7 @@ window_box_right_offset (struct window *w, int area) int window_box_left (struct window *w, int area) { - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); int x; if (w->pseudo_window_p) @@ -1288,13 +1288,13 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, if (FRAME_INITIAL_P (XFRAME (WINDOW_FRAME (w)))) return visible_p; - if (XBUFFER (w->buffer) != current_buffer) + if (XBUFFER (WVAR (w, buffer)) != current_buffer) { old_buffer = current_buffer; - set_buffer_internal_1 (XBUFFER (w->buffer)); + set_buffer_internal_1 (XBUFFER (WVAR (w, buffer))); } - SET_TEXT_POS_FROM_MARKER (top, w->start); + SET_TEXT_POS_FROM_MARKER (top, WVAR (w, start)); /* Scrolling a minibuffer window via scroll bar when the echo area shows long text sometimes resets the minibuffer contents behind our backs. */ @@ -1310,7 +1310,7 @@ pos_visible_p (struct window *w, ptrdiff_t charpos, int *x, int *y, if (WINDOW_WANTS_HEADER_LINE_P (w)) current_header_line_height = display_mode_line (w, HEADER_LINE_FACE_ID, - BVAR (current_buffer, header_line_format)); + BVAR (current_buffer, header_line_format)); start_display (&it, w, top); move_it_to (&it, charpos, -1, it.last_visible_y-1, -1, @@ -1913,7 +1913,7 @@ frame_to_window_pixel_xy (struct window *w, int *x, int *y) { /* A pseudo-window is always full-width, and starts at the left edge of the frame, plus a frame border. */ - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); *x -= FRAME_INTERNAL_BORDER_WIDTH (f); *y = FRAME_TO_WINDOW_PIXEL_Y (w, *y); } @@ -2522,11 +2522,11 @@ static void check_window_end (struct window *w) { if (!MINI_WINDOW_P (w) - && !NILP (w->window_end_valid)) + && !NILP (WVAR (w, window_end_valid))) { struct glyph_row *row; eassert ((row = MATRIX_ROW (w->current_matrix, - XFASTINT (w->window_end_vpos)), + XFASTINT (WVAR (w, window_end_vpos))), !row->enabled_p || MATRIX_ROW_DISPLAYS_TEXT_P (row) || MATRIX_ROW_VPOS (row, w->current_matrix) == 0)); @@ -2591,7 +2591,8 @@ init_iterator (struct it *it, struct window *w, /* Perhaps remap BASE_FACE_ID to a user-specified alternative. */ if (! NILP (Vface_remapping_alist)) - remapped_base_face_id = lookup_basic_face (XFRAME (w->frame), base_face_id); + remapped_base_face_id + = lookup_basic_face (XFRAME (WVAR (w, frame)), base_face_id); /* Use one of the mode line rows of W's desired matrix if appropriate. */ @@ -2619,7 +2620,7 @@ init_iterator (struct it *it, struct window *w, /* The window in which we iterate over current_buffer: */ XSETWINDOW (it->window, w); it->w = w; - it->f = XFRAME (w->frame); + it->f = XFRAME (WVAR (w, frame)); it->cmp_it.id = -1; @@ -2659,9 +2660,9 @@ init_iterator (struct it *it, struct window *w, is invisible. >0 means lines indented more than this value are invisible. */ it->selective = (INTEGERP (BVAR (current_buffer, selective_display)) - ? clip_to_bounds (-1, XINT (BVAR (current_buffer, - selective_display)), - PTRDIFF_MAX) + ? clip_to_bounds + (-1, XINT (BVAR (current_buffer, selective_display)), + PTRDIFF_MAX) : (!NILP (BVAR (current_buffer, selective_display)) ? -1 : 0)); it->selective_display_ellipsis_p @@ -2703,13 +2704,13 @@ init_iterator (struct it *it, struct window *w, /* Get the position at which the redisplay_end_trigger hook should be run, if it is to be run at all. */ - if (MARKERP (w->redisplay_end_trigger) - && XMARKER (w->redisplay_end_trigger)->buffer != 0) + if (MARKERP (WVAR (w, redisplay_end_trigger)) + && XMARKER (WVAR (w, redisplay_end_trigger))->buffer != 0) it->redisplay_end_trigger_charpos - = marker_position (w->redisplay_end_trigger); - else if (INTEGERP (w->redisplay_end_trigger)) + = marker_position (WVAR (w, redisplay_end_trigger)); + else if (INTEGERP (WVAR (w, redisplay_end_trigger))) it->redisplay_end_trigger_charpos = - clip_to_bounds (PTRDIFF_MIN, XINT (w->redisplay_end_trigger), PTRDIFF_MAX); + clip_to_bounds (PTRDIFF_MIN, XINT (WVAR (w, redisplay_end_trigger)), PTRDIFF_MAX); it->tab_width = SANE_TAB_WIDTH (current_buffer); @@ -4407,7 +4408,7 @@ handle_display_prop (struct it *it) if it was a text property. */ if (!STRINGP (it->string)) - object = it->w->buffer; + object = WVAR (it->w, buffer); display_replaced_p = handle_display_spec (it, propval, object, overlay, position, bufpos, @@ -4815,7 +4816,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, it->what = IT_IMAGE; it->image_id = -1; /* no image */ it->position = start_pos; - it->object = NILP (object) ? it->w->buffer : object; + it->object = NILP (object) ? WVAR (it->w, buffer) : object; it->method = GET_FROM_IMAGE; it->from_overlay = Qnil; it->face_id = face_id; @@ -4961,7 +4962,7 @@ handle_single_display_spec (struct it *it, Lisp_Object spec, Lisp_Object object, it->what = IT_IMAGE; it->image_id = lookup_image (it->f, value); it->position = start_pos; - it->object = NILP (object) ? it->w->buffer : object; + it->object = NILP (object) ? WVAR (it->w, buffer) : object; it->method = GET_FROM_IMAGE; /* Say that we haven't consumed the characters with @@ -5784,7 +5785,7 @@ pop_it (struct it *it) it->object = p->u.stretch.object; break; case GET_FROM_BUFFER: - it->object = it->w->buffer; + it->object = WVAR (it->w, buffer); break; case GET_FROM_STRING: it->object = it->string; @@ -5797,7 +5798,7 @@ pop_it (struct it *it) else { it->method = GET_FROM_BUFFER; - it->object = it->w->buffer; + it->object = WVAR (it->w, buffer); } } it->end_charpos = p->end_charpos; @@ -6235,7 +6236,7 @@ reseat_1 (struct it *it, struct text_pos pos, int set_stop_p) IT_STRING_BYTEPOS (*it) = -1; it->string = Qnil; it->method = GET_FROM_BUFFER; - it->object = it->w->buffer; + it->object = WVAR (it->w, buffer); it->area = TEXT_AREA; it->multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters)); it->sp = 0; @@ -7084,7 +7085,7 @@ set_iterator_to_next (struct it *it, int reseat_p) else { it->method = GET_FROM_BUFFER; - it->object = it->w->buffer; + it->object = WVAR (it->w, buffer); } it->dpvec = NULL; @@ -7659,7 +7660,7 @@ next_element_from_ellipsis (struct it *it) setting face_before_selective_p. */ it->saved_face_id = it->face_id; it->method = GET_FROM_BUFFER; - it->object = it->w->buffer; + it->object = WVAR (it->w, buffer); reseat_at_next_visible_line_start (it, 1); it->face_before_selective_p = 1; } @@ -7923,7 +7924,7 @@ next_element_from_buffer (struct it *it) /* Record what we have and where it came from. */ it->what = IT_CHARACTER; - it->object = it->w->buffer; + it->object = WVAR (it->w, buffer); it->position = it->current.pos; /* Normally we return the character found above, except when we @@ -7980,7 +7981,7 @@ run_redisplay_end_trigger_hook (struct it *it) /* Since we are *trying* to run these functions, don't try to run them again, even if they get an error. */ - it->w->redisplay_end_trigger = Qnil; + WVAR (it->w, redisplay_end_trigger) = Qnil; Frun_hook_with_args (3, args); /* Notice if it changed the face of the character we are on. */ @@ -8029,7 +8030,7 @@ next_element_from_composition (struct it *it) return 0; } it->position = it->current.pos; - it->object = it->w->buffer; + it->object = WVAR (it->w, buffer); it->c = composition_update_it (&it->cmp_it, IT_CHARPOS (*it), IT_BYTEPOS (*it), Qnil); } @@ -8890,7 +8891,7 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos && it->current_x == it->last_visible_x - 1 && it->c != '\n' && it->c != '\t' - && it->vpos < XFASTINT (it->w->window_end_vpos)) + && it->vpos < XFASTINT (WVAR (it->w, window_end_vpos))) { it->continuation_lines_width += it->current_x; it->current_x = it->hpos = it->max_ascent = it->max_descent = 0; @@ -9644,7 +9645,7 @@ message3_nolog (Lisp_Object m, ptrdiff_t nbytes, int multibyte) /* Get the frame containing the mini-buffer that the selected frame is using. */ mini_window = FRAME_MINIBUF_WINDOW (sf); - frame = XWINDOW (mini_window)->frame; + frame = WVAR (XWINDOW (mini_window), frame); f = XFRAME (frame); FRAME_SAMPLE_VISIBILITY (f); @@ -9970,8 +9971,8 @@ with_echo_area_buffer (struct window *w, int which, set_buffer_internal_1 (XBUFFER (buffer)); if (w) { - w->buffer = buffer; - set_marker_both (w->pointm, buffer, BEG, BEG_BYTE); + WVAR (w, buffer) = buffer; + set_marker_both (WVAR (w, pointm), buffer, BEG, BEG_BYTE); } BVAR (current_buffer, undo_list) = Qt; @@ -10019,9 +10020,9 @@ with_echo_area_buffer_unwind_data (struct window *w) if (w) { XSETWINDOW (tmp, w); ASET (vector, i, tmp); ++i; - ASET (vector, i, w->buffer); ++i; - ASET (vector, i, make_number (XMARKER (w->pointm)->charpos)); ++i; - ASET (vector, i, make_number (XMARKER (w->pointm)->bytepos)); ++i; + ASET (vector, i, WVAR (w, buffer)); ++i; + ASET (vector, i, make_number (XMARKER (WVAR (w, pointm))->charpos)); ++i; + ASET (vector, i, make_number (XMARKER (WVAR (w, pointm))->bytepos)); ++i; } else { @@ -10055,8 +10056,8 @@ unwind_with_echo_area_buffer (Lisp_Object vector) charpos = AREF (vector, 5); bytepos = AREF (vector, 6); - w->buffer = buffer; - set_marker_both (w->pointm, buffer, + WVAR (w, buffer) = buffer; + set_marker_both (WVAR (w, pointm), buffer, XFASTINT (charpos), XFASTINT (bytepos)); } @@ -10195,7 +10196,7 @@ display_echo_area_1 (ptrdiff_t a1, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4) window_height_changed_p = resize_mini_window (w, 0); /* Use the starting position chosen by resize_mini_window. */ - SET_TEXT_POS_FROM_MARKER (start, w->start); + SET_TEXT_POS_FROM_MARKER (start, WVAR (w, start)); /* Display. */ clear_glyph_matrix (w->desired_matrix); @@ -10266,15 +10267,15 @@ resize_mini_window_1 (ptrdiff_t a1, Lisp_Object exactly, ptrdiff_t a3, ptrdiff_t int resize_mini_window (struct window *w, int exact_p) { - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); int window_height_changed_p = 0; eassert (MINI_WINDOW_P (w)); /* By default, start display at the beginning. */ - set_marker_both (w->start, w->buffer, - BUF_BEGV (XBUFFER (w->buffer)), - BUF_BEGV_BYTE (XBUFFER (w->buffer))); + set_marker_both (WVAR (w, start), WVAR (w, buffer), + BUF_BEGV (XBUFFER (WVAR (w, buffer))), + BUF_BEGV_BYTE (XBUFFER (WVAR (w, buffer)))); /* Don't resize windows while redisplaying a window; it would confuse redisplay functions when the size of the window they are @@ -10301,10 +10302,10 @@ resize_mini_window (struct window *w, int exact_p) struct text_pos start; struct buffer *old_current_buffer = NULL; - if (current_buffer != XBUFFER (w->buffer)) + if (current_buffer != XBUFFER (WVAR (w, buffer))) { old_current_buffer = current_buffer; - set_buffer_internal (XBUFFER (w->buffer)); + set_buffer_internal (XBUFFER (WVAR (w, buffer))); } init_iterator (&it, w, BEGV, BEGV_BYTE, NULL, DEFAULT_FACE_ID); @@ -10346,7 +10347,7 @@ resize_mini_window (struct window *w, int exact_p) } else SET_TEXT_POS (start, BEGV, BEGV_BYTE); - SET_MARKER_FROM_TEXT_POS (w->start, start); + SET_MARKER_FROM_TEXT_POS (WVAR (w, start), start); if (EQ (Vresize_mini_windows, Qgrow_only)) { @@ -11053,7 +11054,8 @@ x_consider_frame_title (Lisp_Object frame) (f, current_buffer, selected_window, 0)); Fselect_window (FVAR (f, selected_window), Qt); - set_buffer_internal_1 (XBUFFER (XWINDOW (FVAR (f, selected_window))->buffer)); + set_buffer_internal_1 + (XBUFFER (WVAR (XWINDOW (FVAR (f, selected_window)), buffer))); fmt = FRAME_ICONIFIED_P (f) ? Vicon_title_format : Vframe_title_format; mode_line_target = MODE_LINE_TITLE; @@ -11171,8 +11173,9 @@ prepare_menu_bars (void) #ifdef HAVE_NS if (windows_or_buffers_changed && FRAME_NS_P (f)) - ns_set_doc_edited (f, Fbuffer_modified_p - (XWINDOW (FVAR (f, selected_window))->buffer)); + ns_set_doc_edited + (f, Fbuffer_modified_p + (WVAR (XWINDOW (FVAR (f, selected_window)), buffer))); #endif UNGCPRO; } @@ -11237,19 +11240,19 @@ update_menu_bar (struct frame *f, int save_match_data, int hooks_run) /* This used to test w->update_mode_line, but we believe there is no need to recompute the menu in that case. */ || update_mode_lines - || ((BUF_SAVE_MODIFF (XBUFFER (w->buffer)) - < BUF_MODIFF (XBUFFER (w->buffer))) + || ((BUF_SAVE_MODIFF (XBUFFER (WVAR (w, buffer))) + < BUF_MODIFF (XBUFFER (WVAR (w, buffer)))) != w->last_had_star) || ((!NILP (Vtransient_mark_mode) - && !NILP (BVAR (XBUFFER (w->buffer), mark_active))) - != !NILP (w->region_showing))) + && !NILP (BVAR (XBUFFER (WVAR (w, buffer)), mark_active))) + != !NILP (WVAR (w, region_showing)))) { struct buffer *prev = current_buffer; ptrdiff_t count = SPECPDL_INDEX (); specbind (Qinhibit_menubar_update, Qt); - set_buffer_internal_1 (XBUFFER (w->buffer)); + set_buffer_internal_1 (XBUFFER (WVAR (w, buffer))); if (save_match_data) record_unwind_save_match_data (); if (NILP (Voverriding_local_map_menu_flag)) @@ -11435,12 +11438,12 @@ update_tool_bar (struct frame *f, int save_match_data) if (windows_or_buffers_changed || w->update_mode_line || update_mode_lines - || ((BUF_SAVE_MODIFF (XBUFFER (w->buffer)) - < BUF_MODIFF (XBUFFER (w->buffer))) + || ((BUF_SAVE_MODIFF (XBUFFER (WVAR (w, buffer))) + < BUF_MODIFF (XBUFFER (WVAR (w, buffer)))) != w->last_had_star) || ((!NILP (Vtransient_mark_mode) - && !NILP (BVAR (XBUFFER (w->buffer), mark_active))) - != !NILP (w->region_showing))) + && !NILP (BVAR (XBUFFER (WVAR (w, buffer)), mark_active))) + != !NILP (WVAR (w, region_showing)))) { struct buffer *prev = current_buffer; ptrdiff_t count = SPECPDL_INDEX (); @@ -11451,7 +11454,7 @@ update_tool_bar (struct frame *f, int save_match_data) /* Set current_buffer to the buffer of the selected window of the frame, so that we get the right local keymaps. */ - set_buffer_internal_1 (XBUFFER (w->buffer)); + set_buffer_internal_1 (XBUFFER (WVAR (w, buffer))); /* Save match data, if we must. */ if (save_match_data) @@ -12321,10 +12324,10 @@ hscroll_window_tree (Lisp_Object window) { struct window *w = XWINDOW (window); - if (WINDOWP (w->hchild)) - hscrolled_p |= hscroll_window_tree (w->hchild); - else if (WINDOWP (w->vchild)) - hscrolled_p |= hscroll_window_tree (w->vchild); + if (WINDOWP (WVAR (w, hchild))) + hscrolled_p |= hscroll_window_tree (WVAR (w, hchild)); + else if (WINDOWP (WVAR (w, vchild))) + hscrolled_p |= hscroll_window_tree (WVAR (w, vchild)); else if (w->cursor.vpos >= 0) { int h_margin; @@ -12344,7 +12347,7 @@ hscroll_window_tree (Lisp_Object window) /* Scroll when cursor is inside this scroll margin. */ h_margin = hscroll_margin * WINDOW_FRAME_COLUMN_WIDTH (w); - if (!NILP (Fbuffer_local_value (Qauto_hscroll_mode, w->buffer)) + if (!NILP (Fbuffer_local_value (Qauto_hscroll_mode, WVAR (w, buffer))) /* For left-to-right rows, hscroll when cursor is either (i) inside the right hscroll margin, or (ii) if it is inside the left margin and the window is already @@ -12379,13 +12382,13 @@ hscroll_window_tree (Lisp_Object window) /* Find point in a display of infinite width. */ saved_current_buffer = current_buffer; - current_buffer = XBUFFER (w->buffer); + current_buffer = XBUFFER (WVAR (w, buffer)); if (w == XWINDOW (selected_window)) pt = PT; else { - pt = marker_position (w->pointm); + pt = marker_position (WVAR (w, pointm)); pt = max (BEGV, pt); pt = min (ZV, pt); } @@ -12436,14 +12439,14 @@ hscroll_window_tree (Lisp_Object window) redisplay. */ if (w->hscroll != hscroll) { - XBUFFER (w->buffer)->prevent_redisplay_optimizations_p = 1; + XBUFFER (WVAR (w, buffer))->prevent_redisplay_optimizations_p = 1; w->hscroll = hscroll; hscrolled_p = 1; } } } - window = w->next; + window = WVAR (w, next); } /* Value is non-zero if hscroll of any leaf window has been changed. */ @@ -12525,9 +12528,9 @@ debug_method_add (struct window *w, char const *fmt, ...) if (trace_redisplay_p) fprintf (stderr, "%p (%s): %s\n", w, - ((BUFFERP (w->buffer) - && STRINGP (BVAR (XBUFFER (w->buffer), name))) - ? SSDATA (BVAR (XBUFFER (w->buffer), name)) + ((BUFFERP (WVAR (w, buffer)) + && STRINGP (BVAR (XBUFFER (WVAR (w, buffer)), name))) + ? SSDATA (BVAR (XBUFFER (WVAR (w, buffer)), name)) : "no buffer"), method + len); } @@ -12592,8 +12595,8 @@ text_outside_line_unchanged_p (struct window *w, require to redisplay the whole paragraph. It might be worthwhile to find the paragraph limits and widen the range of redisplayed lines to that, but for now just give up this optimization. */ - if (!NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering)) - && NILP (BVAR (XBUFFER (w->buffer), bidi_paragraph_direction))) + if (!NILP (BVAR (XBUFFER (WVAR (w, buffer)), bidi_display_reordering)) + && NILP (BVAR (XBUFFER (WVAR (w, buffer)), bidi_paragraph_direction))) unchanged_p = 0; } @@ -12805,7 +12808,7 @@ static inline void reconsider_clip_changes (struct window *w, struct buffer *b) { if (b->clip_changed - && !NILP (w->window_end_valid) + && !NILP (WVAR (w, window_end_valid)) && w->current_matrix->buffer == b && w->current_matrix->zv == BUF_ZV (b) && w->current_matrix->begv == BUF_BEGV (b)) @@ -12817,20 +12820,20 @@ reconsider_clip_changes (struct window *w, struct buffer *b) b->clip_changed has already been set to 1, we can skip this check. */ if (!b->clip_changed - && BUFFERP (w->buffer) && !NILP (w->window_end_valid)) + && BUFFERP (WVAR (w, buffer)) && !NILP (WVAR (w, window_end_valid))) { ptrdiff_t pt; if (w == XWINDOW (selected_window)) pt = PT; else - pt = marker_position (w->pointm); + pt = marker_position (WVAR (w, pointm)); - if ((w->current_matrix->buffer != XBUFFER (w->buffer) + if ((w->current_matrix->buffer != XBUFFER (WVAR (w, buffer)) || pt != w->last_point) && check_point_in_composition (w->current_matrix->buffer, w->last_point, - XBUFFER (w->buffer), pt)) + XBUFFER (WVAR (w, buffer)), pt)) b->clip_changed = 1; } } @@ -12913,7 +12916,7 @@ redisplay_internal (void) /* Don't examine these until after testing Vinhibit_redisplay. When Emacs is shutting down, perhaps because its connection to X has dropped, we should not look at them at all. */ - fr = XFRAME (w->frame); + fr = XFRAME (WVAR (w, frame)); sf = SELECTED_FRAME (); if (!fr->glyphs_initialized_p) @@ -13049,18 +13052,18 @@ redisplay_internal (void) specbind (Qinhibit_point_motion_hooks, Qt); /* If %c is in the mode line, update it if needed. */ - if (!NILP (w->column_number_displayed) + if (!NILP (WVAR (w, column_number_displayed)) /* This alternative quickly identifies a common case where no change is needed. */ && !(PT == w->last_point && w->last_modified >= MODIFF && w->last_overlay_modified >= OVERLAY_MODIFF) - && (XFASTINT (w->column_number_displayed) != current_column ())) + && (XFASTINT (WVAR (w, column_number_displayed)) != current_column ())) w->update_mode_line = 1; unbind_to (count1, Qnil); - FRAME_SCROLL_BOTTOM_VPOS (XFRAME (w->frame)) = -1; + FRAME_SCROLL_BOTTOM_VPOS (XFRAME (WVAR (w, frame))) = -1; /* The variable buffer_shared is set in redisplay_window and indicates that we redisplay a buffer in different windows. See @@ -13144,11 +13147,11 @@ redisplay_internal (void) the whole window. The assignment to this_line_start_pos prevents the optimization directly below this if-statement. */ if (((!NILP (Vtransient_mark_mode) - && !NILP (BVAR (XBUFFER (w->buffer), mark_active))) - != !NILP (w->region_showing)) - || (!NILP (w->region_showing) - && !EQ (w->region_showing, - Fmarker_position (BVAR (XBUFFER (w->buffer), mark))))) + && !NILP (BVAR (XBUFFER (WVAR (w, buffer)), mark_active))) + != !NILP (WVAR (w, region_showing))) + || (!NILP (WVAR (w, region_showing)) + && !EQ (WVAR (w, region_showing), + Fmarker_position (BVAR (XBUFFER (WVAR (w, buffer)), mark))))) CHARPOS (this_line_start_pos) = 0; /* Optimize the case that only the line containing the cursor in the @@ -13162,11 +13165,11 @@ redisplay_internal (void) && !w->update_mode_line && !current_buffer->clip_changed && !current_buffer->prevent_redisplay_optimizations_p - && FRAME_VISIBLE_P (XFRAME (w->frame)) - && !FRAME_OBSCURED_P (XFRAME (w->frame)) + && FRAME_VISIBLE_P (XFRAME (WVAR (w, frame))) + && !FRAME_OBSCURED_P (XFRAME (WVAR (w, frame))) /* Make sure recorded data applies to current buffer, etc. */ && this_line_buffer == current_buffer - && current_buffer == XBUFFER (w->buffer) + && current_buffer == XBUFFER (WVAR (w, buffer)) && !w->force_start && !w->optional_new_start /* Point must be on the line that we have info recorded about. */ @@ -13264,13 +13267,13 @@ redisplay_internal (void) adjusted. */ if ((it.glyph_row - 1)->displays_text_p) { - if (XFASTINT (w->window_end_vpos) < this_line_vpos) - XSETINT (w->window_end_vpos, this_line_vpos); + if (XFASTINT (WVAR (w, window_end_vpos)) < this_line_vpos) + XSETINT (WVAR (w, window_end_vpos), this_line_vpos); } - else if (XFASTINT (w->window_end_vpos) == this_line_vpos + else if (XFASTINT (WVAR (w, window_end_vpos)) == this_line_vpos && this_line_vpos > 0) - XSETINT (w->window_end_vpos, this_line_vpos - 1); - w->window_end_valid = Qnil; + XSETINT (WVAR (w, window_end_vpos), this_line_vpos - 1); + WVAR (w, window_end_valid) = Qnil; /* Update hint: No need to try to scroll in update_window. */ w->desired_matrix->no_scrolling_p = 1; @@ -13316,7 +13319,7 @@ redisplay_internal (void) && (EQ (selected_window, BVAR (current_buffer, last_selected_window)) || highlight_nonselected_windows) - && NILP (w->region_showing) + && NILP (WVAR (w, region_showing)) && NILP (Vshow_trailing_whitespace) && !cursor_in_echo_area) { @@ -13477,7 +13480,7 @@ redisplay_internal (void) Lisp_Object mini_window = FRAME_MINIBUF_WINDOW (sf); struct frame *mini_frame; - displayed_buffer = XBUFFER (XWINDOW (selected_window)->buffer); + displayed_buffer = XBUFFER (WVAR (XWINDOW (selected_window), buffer)); /* Use list_of_error, not Qerror, so that we catch only errors and don't run the debugger. */ internal_condition_case_1 (redisplay_window_1, selected_window, @@ -13543,7 +13546,7 @@ redisplay_internal (void) /* If we pause after scrolling, some rows in the current matrices of some windows are not valid. */ if (!WINDOW_FULL_WIDTH_P (w) - && !FRAME_WINDOW_P (XFRAME (w->frame))) + && !FRAME_WINDOW_P (XFRAME (WVAR (w, frame)))) update_mode_lines = 1; } else @@ -13701,9 +13704,9 @@ unwind_redisplay (Lisp_Object val) static void mark_window_display_accurate_1 (struct window *w, int accurate_p) { - if (BUFFERP (w->buffer)) + if (BUFFERP (WVAR (w, buffer))) { - struct buffer *b = XBUFFER (w->buffer); + struct buffer *b = XBUFFER (WVAR (w, buffer)); w->last_modified = accurate_p ? BUF_MODIFF(b) : 0; w->last_overlay_modified = accurate_p ? BUF_OVERLAY_MODIFF(b) : 0; @@ -13730,13 +13733,13 @@ mark_window_display_accurate_1 (struct window *w, int accurate_p) if (w == XWINDOW (selected_window)) w->last_point = BUF_PT (b); else - w->last_point = XMARKER (w->pointm)->charpos; + w->last_point = XMARKER (WVAR (w, pointm))->charpos; } } if (accurate_p) { - w->window_end_valid = w->buffer; + WVAR (w, window_end_valid) = WVAR (w, buffer); w->update_mode_line = 0; } } @@ -13752,15 +13755,15 @@ mark_window_display_accurate (Lisp_Object window, int accurate_p) { struct window *w; - for (; !NILP (window); window = w->next) + for (; !NILP (window); window = WVAR (w, next)) { w = XWINDOW (window); mark_window_display_accurate_1 (w, accurate_p); - if (!NILP (w->vchild)) - mark_window_display_accurate (w->vchild, accurate_p); - if (!NILP (w->hchild)) - mark_window_display_accurate (w->hchild, accurate_p); + if (!NILP (WVAR (w, vchild))) + mark_window_display_accurate (WVAR (w, vchild), accurate_p); + if (!NILP (WVAR (w, hchild))) + mark_window_display_accurate (WVAR (w, hchild), accurate_p); } if (accurate_p) @@ -13820,13 +13823,13 @@ redisplay_windows (Lisp_Object window) { struct window *w = XWINDOW (window); - if (!NILP (w->hchild)) - redisplay_windows (w->hchild); - else if (!NILP (w->vchild)) - redisplay_windows (w->vchild); - else if (!NILP (w->buffer)) + if (!NILP (WVAR (w, hchild))) + redisplay_windows (WVAR (w, hchild)); + else if (!NILP (WVAR (w, vchild))) + redisplay_windows (WVAR (w, vchild)); + else if (!NILP (WVAR (w, buffer))) { - displayed_buffer = XBUFFER (w->buffer); + displayed_buffer = XBUFFER (WVAR (w, buffer)); /* Use list_of_error, not Qerror, so that we catch only errors and don't run the debugger. */ internal_condition_case_1 (redisplay_window_0, window, @@ -13834,7 +13837,7 @@ redisplay_windows (Lisp_Object window) redisplay_window_error); } - window = w->next; + window = WVAR (w, next); } } @@ -14468,7 +14471,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, && !MATRIX_ROW_CONTINUATION_LINE_P (row) && row->x == 0) { - this_line_buffer = XBUFFER (w->buffer); + this_line_buffer = XBUFFER (WVAR (w, buffer)); CHARPOS (this_line_start_pos) = MATRIX_ROW_START_CHARPOS (row) + delta; @@ -14502,19 +14505,19 @@ static inline struct text_pos run_window_scroll_functions (Lisp_Object window, struct text_pos startp) { struct window *w = XWINDOW (window); - SET_MARKER_FROM_TEXT_POS (w->start, startp); + SET_MARKER_FROM_TEXT_POS (WVAR (w, start), startp); - if (current_buffer != XBUFFER (w->buffer)) + if (current_buffer != XBUFFER (WVAR (w, buffer))) abort (); if (!NILP (Vwindow_scroll_functions)) { run_hook_with_args_2 (Qwindow_scroll_functions, window, make_number (CHARPOS (startp))); - SET_TEXT_POS_FROM_MARKER (startp, w->start); + SET_TEXT_POS_FROM_MARKER (startp, WVAR (w, start)); /* In case the hook functions switch buffers. */ - if (current_buffer != XBUFFER (w->buffer)) - set_buffer_internal_1 (XBUFFER (w->buffer)); + if (current_buffer != XBUFFER (WVAR (w, buffer))) + set_buffer_internal_1 (XBUFFER (WVAR (w, buffer))); } return startp; @@ -14604,7 +14607,7 @@ try_scrolling (Lisp_Object window, int just_this_one_p, int temp_scroll_step, int last_line_misfit) { struct window *w = XWINDOW (window); - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); struct text_pos pos, startp; struct it it; int this_scroll_margin, scroll_max, rc, height; @@ -14618,7 +14621,7 @@ try_scrolling (Lisp_Object window, int just_this_one_p, debug_method_add (w, "try_scrolling"); #endif - SET_TEXT_POS_FROM_MARKER (startp, w->start); + SET_TEXT_POS_FROM_MARKER (startp, WVAR (w, start)); /* Compute scroll margin height in pixels. We scroll when point is within this distance from the top or bottom of the window. */ @@ -14844,7 +14847,7 @@ try_scrolling (Lisp_Object window, int just_this_one_p, if (!just_this_one_p || current_buffer->clip_changed || BEG_UNCHANGED < CHARPOS (startp)) - w->base_line_number = Qnil; + WVAR (w, base_line_number) = Qnil; /* If cursor ends up on a partially visible line, treat that as being off the bottom of the screen. */ @@ -14879,7 +14882,7 @@ compute_window_start_on_continuation_line (struct window *w) struct text_pos pos, start_pos; int window_start_changed_p = 0; - SET_TEXT_POS_FROM_MARKER (start_pos, w->start); + SET_TEXT_POS_FROM_MARKER (start_pos, WVAR (w, start)); /* If window start is on a continuation line... Window start may be < BEGV in case there's invisible text at the start of the @@ -14927,7 +14930,7 @@ compute_window_start_on_continuation_line (struct window *w) } /* Set the window start there. */ - SET_MARKER_FROM_TEXT_POS (w->start, pos); + SET_MARKER_FROM_TEXT_POS (WVAR (w, start), pos); window_start_changed_p = 1; } } @@ -14963,7 +14966,7 @@ static int try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_step) { struct window *w = XWINDOW (window); - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); int rc = CURSOR_MOVEMENT_CANNOT_BE_USED; #ifdef GLYPH_DEBUG @@ -14994,7 +14997,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste set the cursor. */ && !(!NILP (Vtransient_mark_mode) && !NILP (BVAR (current_buffer, mark_active))) - && NILP (w->region_showing) + && NILP (WVAR (w, region_showing)) && NILP (Vshow_trailing_whitespace) /* This code is not used for mini-buffer for the sake of the case of redisplaying to replace an echo area message; since in @@ -15008,8 +15011,8 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste larger than the window. This should really be fixed in window.c. I don't have this on my list, now, so we do approximately the same as the old redisplay code. --gerd. */ - && INTEGERP (w->window_end_vpos) - && XFASTINT (w->window_end_vpos) < w->current_matrix->nrows + && INTEGERP (WVAR (w, window_end_vpos)) + && XFASTINT (WVAR (w, window_end_vpos)) < w->current_matrix->nrows && (FRAME_WINDOW_P (f) || !overlay_arrow_in_current_buffer_p ())) { @@ -15146,7 +15149,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste must_scroll = 1; } else if (rc != CURSOR_MOVEMENT_SUCCESS - && !NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering))) + && !NILP (BVAR (XBUFFER (WVAR (w, buffer)), bidi_display_reordering))) { struct glyph_row *row1; @@ -15209,7 +15212,7 @@ try_cursor_movement (Lisp_Object window, struct text_pos startp, int *scroll_ste else if (scroll_p) rc = CURSOR_MOVEMENT_MUST_SCROLL; else if (rc != CURSOR_MOVEMENT_SUCCESS - && !NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering))) + && !NILP (BVAR (XBUFFER (WVAR (w, buffer)), bidi_display_reordering))) { /* With bidi-reordered rows, there could be more than one candidate row whose start and end positions @@ -15316,12 +15319,12 @@ set_vertical_scroll_bar (struct window *w) || (w == XWINDOW (minibuf_window) && NILP (echo_area_buffer[0]))) { - struct buffer *buf = XBUFFER (w->buffer); + struct buffer *buf = XBUFFER (WVAR (w, buffer)); whole = BUF_ZV (buf) - BUF_BEGV (buf); - start = marker_position (w->start) - BUF_BEGV (buf); + start = marker_position (WVAR (w, start)) - BUF_BEGV (buf); /* I don't think this is guaranteed to be right. For the moment, we'll pretend it is. */ - end = BUF_Z (buf) - XFASTINT (w->window_end_pos) - BUF_BEGV (buf); + end = BUF_Z (buf) - XFASTINT (WVAR (w, window_end_pos)) - BUF_BEGV (buf); if (end < start) end = start; @@ -15332,8 +15335,8 @@ set_vertical_scroll_bar (struct window *w) start = end = whole = 0; /* Indicate what this scroll bar ought to be displaying now. */ - if (FRAME_TERMINAL (XFRAME (w->frame))->set_vertical_scroll_bar_hook) - (*FRAME_TERMINAL (XFRAME (w->frame))->set_vertical_scroll_bar_hook) + if (FRAME_TERMINAL (XFRAME (WVAR (w, frame)))->set_vertical_scroll_bar_hook) + (*FRAME_TERMINAL (XFRAME (WVAR (w, frame)))->set_vertical_scroll_bar_hook) (w, end - start, whole, start); } @@ -15349,8 +15352,8 @@ static void redisplay_window (Lisp_Object window, int just_this_one_p) { struct window *w = XWINDOW (window); - struct frame *f = XFRAME (w->frame); - struct buffer *buffer = XBUFFER (w->buffer); + struct frame *f = XFRAME (WVAR (w, frame)); + struct buffer *buffer = XBUFFER (WVAR (w, buffer)); struct buffer *old = current_buffer; struct text_pos lpoint, opoint, startp; int update_mode_line; @@ -15373,7 +15376,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) opoint = lpoint; /* W must be a leaf window here. */ - eassert (!NILP (w->buffer)); + eassert (!NILP (WVAR (w, buffer))); #ifdef GLYPH_DEBUG *w->desired_matrix->method = 0; #endif @@ -15403,10 +15406,10 @@ redisplay_window (Lisp_Object window, int just_this_one_p) else if ((w != XWINDOW (minibuf_window) || minibuf_level == 0) /* When buffer is nonempty, redisplay window normally. */ - && BUF_Z (XBUFFER (w->buffer)) == BUF_BEG (XBUFFER (w->buffer)) + && BUF_Z (XBUFFER (WVAR (w, buffer))) == BUF_BEG (XBUFFER (WVAR (w, buffer))) /* Quail displays non-mini buffers in minibuffer window. In that case, redisplay the window normally. */ - && !NILP (Fmemq (w->buffer, Vminibuffer_list))) + && !NILP (Fmemq (WVAR (w, buffer), Vminibuffer_list))) { /* W is a mini-buffer window, but it's not active, so clear it. */ @@ -15428,10 +15431,10 @@ redisplay_window (Lisp_Object window, int just_this_one_p) value. */ /* Really select the buffer, for the sake of buffer-local variables. */ - set_buffer_internal_1 (XBUFFER (w->buffer)); + set_buffer_internal_1 (XBUFFER (WVAR (w, buffer))); current_matrix_up_to_date_p - = (!NILP (w->window_end_valid) + = (!NILP (WVAR (w, window_end_valid)) && !current_buffer->clip_changed && !current_buffer->prevent_redisplay_optimizations_p && w->last_modified >= MODIFF @@ -15455,7 +15458,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) specbind (Qinhibit_point_motion_hooks, Qt); buffer_unchanged_p - = (!NILP (w->window_end_valid) + = (!NILP (WVAR (w, window_end_valid)) && !current_buffer->clip_changed && w->last_modified >= MODIFF && w->last_overlay_modified >= OVERLAY_MODIFF); @@ -15466,10 +15469,10 @@ redisplay_window (Lisp_Object window, int just_this_one_p) { /* If window starts on a continuation line, maybe adjust the window start in case the window's width changed. */ - if (XMARKER (w->start)->buffer == current_buffer) + if (XMARKER (WVAR (w, start))->buffer == current_buffer) compute_window_start_on_continuation_line (w); - w->window_end_valid = Qnil; + WVAR (w, window_end_valid) = Qnil; } /* Some sanity checks. */ @@ -15480,13 +15483,13 @@ redisplay_window (Lisp_Object window, int just_this_one_p) abort (); /* If %c is in mode line, update it if needed. */ - if (!NILP (w->column_number_displayed) + if (!NILP (WVAR (w, column_number_displayed)) /* This alternative quickly identifies a common case where no change is needed. */ && !(PT == w->last_point && w->last_modified >= MODIFF && w->last_overlay_modified >= OVERLAY_MODIFF) - && (XFASTINT (w->column_number_displayed) != current_column ())) + && (XFASTINT (WVAR (w, column_number_displayed)) != current_column ())) update_mode_line = 1; /* Count number of windows showing the selected buffer. An indirect @@ -15495,7 +15498,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) { struct buffer *current_base, *window_base; current_base = current_buffer; - window_base = XBUFFER (XWINDOW (selected_window)->buffer); + window_base = XBUFFER (WVAR (XWINDOW (selected_window), buffer)); if (current_base->base_buffer) current_base = current_base->base_buffer; if (window_base->base_buffer) @@ -15508,19 +15511,19 @@ redisplay_window (Lisp_Object window, int just_this_one_p) window, set up appropriate value. */ if (!EQ (window, selected_window)) { - ptrdiff_t new_pt = XMARKER (w->pointm)->charpos; - ptrdiff_t new_pt_byte = marker_byte_position (w->pointm); + ptrdiff_t new_pt = XMARKER (WVAR (w, pointm))->charpos; + ptrdiff_t new_pt_byte = marker_byte_position (WVAR (w, pointm)); if (new_pt < BEGV) { new_pt = BEGV; new_pt_byte = BEGV_BYTE; - set_marker_both (w->pointm, Qnil, BEGV, BEGV_BYTE); + set_marker_both (WVAR (w, pointm), Qnil, BEGV, BEGV_BYTE); } else if (new_pt > (ZV - 1)) { new_pt = ZV; new_pt_byte = ZV_BYTE; - set_marker_both (w->pointm, Qnil, ZV, ZV_BYTE); + set_marker_both (WVAR (w, pointm), Qnil, ZV, ZV_BYTE); } /* We don't use SET_PT so that the point-motion hooks don't run. */ @@ -15536,8 +15539,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p) { struct Lisp_Char_Table *disptab = buffer_display_table (); - if (! disptab_matches_widthtab (disptab, - XVECTOR (BVAR (current_buffer, width_table)))) + if (! disptab_matches_widthtab + (disptab, XVECTOR (BVAR (current_buffer, width_table)))) { invalidate_region_cache (current_buffer, current_buffer->width_run_cache, @@ -15547,10 +15550,10 @@ redisplay_window (Lisp_Object window, int just_this_one_p) } /* If window-start is screwed up, choose a new one. */ - if (XMARKER (w->start)->buffer != current_buffer) + if (XMARKER (WVAR (w, start))->buffer != current_buffer) goto recenter; - SET_TEXT_POS_FROM_MARKER (startp, w->start); + SET_TEXT_POS_FROM_MARKER (startp, WVAR (w, start)); /* If someone specified a new starting point but did not insist, check whether it can be used. */ @@ -15580,11 +15583,11 @@ redisplay_window (Lisp_Object window, int just_this_one_p) w->force_start = 0; w->vscroll = 0; - w->window_end_valid = Qnil; + WVAR (w, window_end_valid) = Qnil; /* Forget any recorded base line for line number display. */ if (!buffer_unchanged_p) - w->base_line_number = Qnil; + WVAR (w, base_line_number) = Qnil; /* Redisplay the mode line. Select the buffer properly for that. Also, run the hook window-scroll-functions @@ -15649,7 +15652,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) MATRIX_ROW_START_BYTEPOS (row)); if (w != XWINDOW (selected_window)) - set_marker_both (w->pointm, Qnil, PT, PT_BYTE); + set_marker_both (WVAR (w, pointm), Qnil, PT, PT_BYTE); else if (current_buffer == old) SET_TEXT_POS (lpoint, PT, PT_BYTE); @@ -15751,7 +15754,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) sets it. So, we need to check the return value of compute_window_start_on_continuation_line. (See also bug#197). */ - && XMARKER (w->start)->buffer == current_buffer + && XMARKER (WVAR (w, start))->buffer == current_buffer && compute_window_start_on_continuation_line (w) /* It doesn't make sense to force the window start like we do at label force_start if it is already known that point @@ -15762,7 +15765,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) && pos_visible_p (w, PT, &d1, &d2, &d3, &d4, &d5, &d6)) { w->force_start = 1; - SET_TEXT_POS_FROM_MARKER (startp, w->start); + SET_TEXT_POS_FROM_MARKER (startp, WVAR (w, start)); goto force_start; } @@ -15798,7 +15801,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) || current_buffer->clip_changed || BEG_UNCHANGED < CHARPOS (startp)) /* Forget any recorded base line for line number display. */ - w->base_line_number = Qnil; + WVAR (w, base_line_number) = Qnil; if (!cursor_row_fully_visible_p (w, 1, 0)) { @@ -15869,7 +15872,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) /* Forget any previously recorded base line for line number display. */ if (!buffer_unchanged_p) - w->base_line_number = Qnil; + WVAR (w, base_line_number) = Qnil; /* Determine the window start relative to point. */ init_iterator (&it, w, PT, PT_BYTE, NULL, DEFAULT_FACE_ID); @@ -15972,7 +15975,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) /* Set the window start position here explicitly, to avoid an infinite loop in case the functions in window-scroll-functions get errors. */ - set_marker_both (w->start, Qnil, IT_CHARPOS (it), IT_BYTEPOS (it)); + set_marker_both (WVAR (w, start), Qnil, IT_CHARPOS (it), IT_BYTEPOS (it)); /* Run scroll hooks. */ startp = run_window_scroll_functions (window, it.current.pos); @@ -16003,8 +16006,8 @@ redisplay_window (Lisp_Object window, int just_this_one_p) line.) */ if (w->cursor.vpos < 0) { - if (!NILP (w->window_end_valid) - && PT >= Z - XFASTINT (w->window_end_pos)) + if (!NILP (WVAR (w, window_end_valid)) + && PT >= Z - XFASTINT (WVAR (w, window_end_pos))) { clear_glyph_matrix (w->desired_matrix); move_it_by_lines (&it, 1); @@ -16076,7 +16079,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) done: - SET_TEXT_POS_FROM_MARKER (startp, w->start); + SET_TEXT_POS_FROM_MARKER (startp, WVAR (w, start)); w->start_at_line_beg = (CHARPOS (startp) == BEGV || FETCH_BYTE (BYTEPOS (startp) - 1) == '\n'); @@ -16090,10 +16093,10 @@ redisplay_window (Lisp_Object window, int just_this_one_p) && !FRAME_WINDOW_P (f) && !WINDOW_FULL_WIDTH_P (w)) /* Line number to display. */ - || INTEGERP (w->base_line_pos) + || INTEGERP (WVAR (w, base_line_pos)) /* Column number is displayed and different from the one displayed. */ - || (!NILP (w->column_number_displayed) - && (XFASTINT (w->column_number_displayed) != current_column ()))) + || (!NILP (WVAR (w, column_number_displayed)) + && (XFASTINT (WVAR (w, column_number_displayed)) != current_column ()))) /* This means that the window has a mode line. */ && (WINDOW_WANTS_MODELINE_P (w) || WINDOW_WANTS_HEADER_LINE_P (w))) @@ -16125,10 +16128,10 @@ redisplay_window (Lisp_Object window, int just_this_one_p) } if (!line_number_displayed - && !BUFFERP (w->base_line_pos)) + && !BUFFERP (WVAR (w, base_line_pos))) { - w->base_line_pos = Qnil; - w->base_line_number = Qnil; + WVAR (w, base_line_pos) = Qnil; + WVAR (w, base_line_number) = Qnil; } finish_menu_bars: @@ -16241,10 +16244,10 @@ try_window (Lisp_Object window, struct text_pos pos, int flags) struct window *w = XWINDOW (window); struct it it; struct glyph_row *last_text_row = NULL; - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); /* Make POS the new window start. */ - set_marker_both (w->start, Qnil, CHARPOS (pos), BYTEPOS (pos)); + set_marker_both (WVAR (w, start), Qnil, CHARPOS (pos), BYTEPOS (pos)); /* Mark cursor position as unknown. No overlay arrow seen. */ w->cursor.vpos = -1; @@ -16293,7 +16296,7 @@ try_window (Lisp_Object window, struct text_pos pos, int flags) } /* If bottom moved off end of frame, change mode line percentage. */ - if (XFASTINT (w->window_end_pos) <= 0 + if (XFASTINT (WVAR (w, window_end_pos)) <= 0 && Z != IT_CHARPOS (it)) w->update_mode_line = 1; @@ -16305,22 +16308,23 @@ try_window (Lisp_Object window, struct text_pos pos, int flags) eassert (MATRIX_ROW_DISPLAYS_TEXT_P (last_text_row)); w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); - w->window_end_pos + WVAR (w, window_end_pos) = make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row)); - w->window_end_vpos + WVAR (w, window_end_vpos) = make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix)); - eassert (MATRIX_ROW (w->desired_matrix, XFASTINT (w->window_end_vpos)) - ->displays_text_p); + eassert + (MATRIX_ROW (w->desired_matrix, + XFASTINT (WVAR (w, window_end_vpos)))->displays_text_p); } else { w->window_end_bytepos = Z_BYTE - ZV_BYTE; - w->window_end_pos = make_number (Z - ZV); - w->window_end_vpos = make_number (0); + WVAR (w, window_end_pos) = make_number (Z - ZV); + WVAR (w, window_end_vpos) = make_number (0); } /* But that is not valid info until redisplay finishes. */ - w->window_end_valid = Qnil; + WVAR (w, window_end_valid) = Qnil; return 1; } @@ -16338,7 +16342,7 @@ try_window (Lisp_Object window, struct text_pos pos, int flags) static int try_window_reusing_current_matrix (struct window *w) { - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); struct glyph_row *bottom_row; struct it it; struct run run; @@ -16365,7 +16369,7 @@ try_window_reusing_current_matrix (struct window *w) /* Can't do this if region may have changed. */ if ((!NILP (Vtransient_mark_mode) && !NILP (BVAR (current_buffer, mark_active))) - || !NILP (w->region_showing) + || !NILP (WVAR (w, region_showing)) || !NILP (Vshow_trailing_whitespace)) return 0; @@ -16382,7 +16386,7 @@ try_window_reusing_current_matrix (struct window *w) /* The variable new_start now holds the new window start. The old start `start' can be determined from the current matrix. */ - SET_TEXT_POS_FROM_MARKER (new_start, w->start); + SET_TEXT_POS_FROM_MARKER (new_start, WVAR (w, start)); start = start_row->minpos; start_vpos = MATRIX_ROW_VPOS (start_row, w->current_matrix); @@ -16544,9 +16548,9 @@ try_window_reusing_current_matrix (struct window *w) { w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_reused_text_row); - w->window_end_pos + WVAR (w, window_end_pos) = make_number (Z - MATRIX_ROW_END_CHARPOS (last_reused_text_row)); - w->window_end_vpos + WVAR (w, window_end_vpos) = make_number (MATRIX_ROW_VPOS (last_reused_text_row, w->current_matrix)); } @@ -16554,19 +16558,19 @@ try_window_reusing_current_matrix (struct window *w) { w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); - w->window_end_pos + WVAR (w, window_end_pos) = make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row)); - w->window_end_vpos + WVAR (w, window_end_vpos) = make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix)); } else { /* This window must be completely empty. */ w->window_end_bytepos = Z_BYTE - ZV_BYTE; - w->window_end_pos = make_number (Z - ZV); - w->window_end_vpos = make_number (0); + WVAR (w, window_end_pos) = make_number (Z - ZV); + WVAR (w, window_end_vpos) = make_number (0); } - w->window_end_valid = Qnil; + WVAR (w, window_end_valid) = Qnil; /* Update hint: don't try scrolling again in update_window. */ w->desired_matrix->no_scrolling_p = 1; @@ -16720,7 +16724,7 @@ try_window_reusing_current_matrix (struct window *w) /* Can't use this optimization with bidi-reordered glyph rows, unless cursor is already at point. */ - if (!NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering))) + if (!NILP (BVAR (XBUFFER (WVAR (w, buffer)), bidi_display_reordering))) { if (!(w->cursor.hpos >= 0 && w->cursor.hpos < row->used[TEXT_AREA] @@ -16747,18 +16751,18 @@ try_window_reusing_current_matrix (struct window *w) { w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); - w->window_end_pos + WVAR (w, window_end_pos) = make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row)); - w->window_end_vpos + WVAR (w, window_end_vpos) = make_number (MATRIX_ROW_VPOS (last_text_row, w->desired_matrix)); } else { - w->window_end_vpos - = make_number (XFASTINT (w->window_end_vpos) - nrows_scrolled); + WVAR (w, window_end_vpos) + = make_number (XFASTINT (WVAR (w, window_end_vpos)) - nrows_scrolled); } - w->window_end_valid = Qnil; + WVAR (w, window_end_valid) = Qnil; w->desired_matrix->no_scrolling_p = 1; #ifdef GLYPH_DEBUG @@ -16891,16 +16895,16 @@ find_first_unchanged_at_end_row (struct window *w, /* Display must not have been paused, otherwise the current matrix is not up to date. */ - eassert (!NILP (w->window_end_valid)); + eassert (!NILP (WVAR (w, window_end_valid))); /* A value of window_end_pos >= END_UNCHANGED means that the window end is in the range of changed text. If so, there is no unchanged row at the end of W's current matrix. */ - if (XFASTINT (w->window_end_pos) >= END_UNCHANGED) + if (XFASTINT (WVAR (w, window_end_pos)) >= END_UNCHANGED) return NULL; /* Set row to the last row in W's current matrix displaying text. */ - row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); + row = MATRIX_ROW (w->current_matrix, XFASTINT (WVAR (w, window_end_vpos))); /* If matrix is entirely empty, no unchanged row exists. */ if (MATRIX_ROW_DISPLAYS_TEXT_P (row)) @@ -16911,7 +16915,7 @@ find_first_unchanged_at_end_row (struct window *w, buffer positions in the current matrix to current buffer positions for characters not in changed text. */ ptrdiff_t Z_old = - MATRIX_ROW_END_CHARPOS (row) + XFASTINT (w->window_end_pos); + MATRIX_ROW_END_CHARPOS (row) + XFASTINT (WVAR (w, window_end_pos)); ptrdiff_t Z_BYTE_old = MATRIX_ROW_END_BYTEPOS (row) + w->window_end_bytepos; ptrdiff_t last_unchanged_pos, last_unchanged_pos_old; @@ -16959,12 +16963,12 @@ find_first_unchanged_at_end_row (struct window *w, static void sync_frame_with_window_matrix_rows (struct window *w) { - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); struct glyph_row *window_row, *window_row_end, *frame_row; /* Preconditions: W must be a leaf window and full-width. Its frame must have a frame matrix. */ - eassert (NILP (w->hchild) && NILP (w->vchild)); + eassert (NILP (WVAR (w, hchild)) && NILP (WVAR (w, vchild))); eassert (WINDOW_FULL_WIDTH_P (w)); eassert (!FRAME_WINDOW_P (f)); @@ -17006,7 +17010,7 @@ row_containing_pos (struct window *w, ptrdiff_t charpos, { struct glyph_row *row = start; struct glyph_row *best_row = NULL; - ptrdiff_t mindif = BUF_ZV (XBUFFER (w->buffer)) + 1; + ptrdiff_t mindif = BUF_ZV (XBUFFER (WVAR (w, buffer))) + 1; int last_y; /* If we happen to start on a header-line, skip that. */ @@ -17042,7 +17046,7 @@ row_containing_pos (struct window *w, ptrdiff_t charpos, { struct glyph *g; - if (NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering)) + if (NILP (BVAR (XBUFFER (WVAR (w, buffer)), bidi_display_reordering)) || (!best_row && !row->continued_p)) return row; /* In bidi-reordered rows, there could be several rows @@ -17111,7 +17115,7 @@ row_containing_pos (struct window *w, ptrdiff_t charpos, static int try_window_id (struct window *w) { - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); struct glyph_matrix *current_matrix = w->current_matrix; struct glyph_matrix *desired_matrix = w->desired_matrix; struct glyph_row *last_unchanged_at_beg_row; @@ -17145,7 +17149,7 @@ try_window_id (struct window *w) #define GIVE_UP(X) return 0 #endif - SET_TEXT_POS_FROM_MARKER (start, w->start); + SET_TEXT_POS_FROM_MARKER (start, WVAR (w, start)); /* Don't use this for mini-windows because these can show messages and mini-buffers, and we don't handle that here. */ @@ -17183,7 +17187,7 @@ try_window_id (struct window *w) GIVE_UP (7); /* Verify that display wasn't paused. */ - if (NILP (w->window_end_valid)) + if (NILP (WVAR (w, window_end_valid))) GIVE_UP (8); /* Can't use this if highlighting a region because a cursor movement @@ -17197,7 +17201,7 @@ try_window_id (struct window *w) GIVE_UP (11); /* Likewise if showing a region. */ - if (!NILP (w->region_showing)) + if (!NILP (WVAR (w, region_showing))) GIVE_UP (10); /* Can't use this if overlay arrow position and/or string have @@ -17209,7 +17213,7 @@ try_window_id (struct window *w) wrapped line can change the wrap position, altering the line above it. It might be worthwhile to handle this more intelligently, but for now just redisplay from scratch. */ - if (!NILP (BVAR (XBUFFER (w->buffer), word_wrap))) + if (!NILP (BVAR (XBUFFER (WVAR (w, buffer)), word_wrap))) GIVE_UP (21); /* Under bidi reordering, adding or deleting a character in the @@ -17220,8 +17224,8 @@ try_window_id (struct window *w) to find the paragraph limits and widen the range of redisplayed lines to that, but for now just give up this optimization and redisplay from scratch. */ - if (!NILP (BVAR (XBUFFER (w->buffer), bidi_display_reordering)) - && NILP (BVAR (XBUFFER (w->buffer), bidi_paragraph_direction))) + if (!NILP (BVAR (XBUFFER (WVAR (w, buffer)), bidi_display_reordering)) + && NILP (BVAR (XBUFFER (WVAR (w, buffer)), bidi_paragraph_direction))) GIVE_UP (22); /* Make sure beg_unchanged and end_unchanged are up to date. Do it @@ -17247,7 +17251,7 @@ try_window_id (struct window *w) This case happens with stealth-fontification. Note that although the display is unchanged, glyph positions in the matrix have to be adjusted, of course. */ - row = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); + row = MATRIX_ROW (w->current_matrix, XFASTINT (WVAR (w, window_end_vpos))); if (MATRIX_ROW_DISPLAYS_TEXT_P (row) && ((last_changed_charpos < CHARPOS (start) && CHARPOS (start) == BEGV) @@ -17259,7 +17263,7 @@ try_window_id (struct window *w) /* Compute how many chars/bytes have been added to or removed from the buffer. */ - Z_old = MATRIX_ROW_END_CHARPOS (row) + XFASTINT (w->window_end_pos); + Z_old = MATRIX_ROW_END_CHARPOS (row) + XFASTINT (WVAR (w, window_end_pos)); Z_BYTE_old = MATRIX_ROW_END_BYTEPOS (row) + w->window_end_bytepos; Z_delta = Z - Z_old; Z_delta_bytes = Z_BYTE - Z_BYTE_old; @@ -17330,7 +17334,7 @@ try_window_id (struct window *w) { /* We have to compute the window end anew since text could have been added/removed after it. */ - w->window_end_pos + WVAR (w, window_end_pos) = make_number (Z - MATRIX_ROW_END_CHARPOS (row)); w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); @@ -17366,7 +17370,7 @@ try_window_id (struct window *w) /* Give up if the window ends in strings. Overlay strings at the end are difficult to handle, so don't try. */ - row = MATRIX_ROW (current_matrix, XFASTINT (w->window_end_vpos)); + row = MATRIX_ROW (current_matrix, XFASTINT (WVAR (w, window_end_vpos))); if (MATRIX_ROW_START_CHARPOS (row) == MATRIX_ROW_END_CHARPOS (row)) GIVE_UP (20); @@ -17709,7 +17713,7 @@ try_window_id (struct window *w) /* Set last_row to the glyph row in the current matrix where the window end line is found. It has been moved up or down in the matrix by dvpos. */ - int last_vpos = XFASTINT (w->window_end_vpos) + dvpos; + int last_vpos = XFASTINT (WVAR (w, window_end_vpos)) + dvpos; struct glyph_row *last_row = MATRIX_ROW (current_matrix, last_vpos); /* If last_row is the window end line, it should display text. */ @@ -17765,20 +17769,20 @@ try_window_id (struct window *w) first_unchanged_at_end_row); eassert (row && MATRIX_ROW_DISPLAYS_TEXT_P (row)); - w->window_end_pos = make_number (Z - MATRIX_ROW_END_CHARPOS (row)); + WVAR (w, window_end_pos) = make_number (Z - MATRIX_ROW_END_CHARPOS (row)); w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); - w->window_end_vpos + WVAR (w, window_end_vpos) = make_number (MATRIX_ROW_VPOS (row, w->current_matrix)); eassert (w->window_end_bytepos >= 0); IF_DEBUG (debug_method_add (w, "A")); } else if (last_text_row_at_end) { - w->window_end_pos + WVAR (w, window_end_pos) = make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row_at_end)); w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row_at_end); - w->window_end_vpos + WVAR (w, window_end_vpos) = make_number (MATRIX_ROW_VPOS (last_text_row_at_end, desired_matrix)); eassert (w->window_end_bytepos >= 0); IF_DEBUG (debug_method_add (w, "B")); @@ -17788,11 +17792,11 @@ try_window_id (struct window *w) /* We have displayed either to the end of the window or at the end of the window, i.e. the last row with text is to be found in the desired matrix. */ - w->window_end_pos + WVAR (w, window_end_pos) = make_number (Z - MATRIX_ROW_END_CHARPOS (last_text_row)); w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (last_text_row); - w->window_end_vpos + WVAR (w, window_end_vpos) = make_number (MATRIX_ROW_VPOS (last_text_row, desired_matrix)); eassert (w->window_end_bytepos >= 0); } @@ -17803,7 +17807,7 @@ try_window_id (struct window *w) /* Displayed to end of window, but no line containing text was displayed. Lines were deleted at the end of the window. */ int first_vpos = WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0; - int vpos = XFASTINT (w->window_end_vpos); + int vpos = XFASTINT (WVAR (w, window_end_vpos)); struct glyph_row *current_row = current_matrix->rows + vpos; struct glyph_row *desired_row = desired_matrix->rows + vpos; @@ -17821,8 +17825,8 @@ try_window_id (struct window *w) } eassert (row != NULL); - w->window_end_vpos = make_number (vpos + 1); - w->window_end_pos = make_number (Z - MATRIX_ROW_END_CHARPOS (row)); + WVAR (w, window_end_vpos) = make_number (vpos + 1); + WVAR (w, window_end_pos) = make_number (Z - MATRIX_ROW_END_CHARPOS (row)); w->window_end_bytepos = Z_BYTE - MATRIX_ROW_END_BYTEPOS (row); eassert (w->window_end_bytepos >= 0); IF_DEBUG (debug_method_add (w, "C")); @@ -17834,7 +17838,7 @@ try_window_id (struct window *w) debug_end_vpos = XFASTINT (w->window_end_vpos)); /* Record that display has not been completed. */ - w->window_end_valid = Qnil; + WVAR (w, window_end_valid) = Qnil; w->desired_matrix->no_scrolling_p = 1; return 3; @@ -18064,7 +18068,7 @@ glyphs in short form, otherwise show glyphs in long form. */) (Lisp_Object glyphs) { struct window *w = XWINDOW (selected_window); - struct buffer *buffer = XBUFFER (w->buffer); + struct buffer *buffer = XBUFFER (WVAR (w, buffer)); fprintf (stderr, "PT = %"pI"d, BEGV = %"pI"d. ZV = %"pI"d\n", BUF_PT (buffer), BUF_BEGV (buffer), BUF_ZV (buffer)); @@ -18170,7 +18174,7 @@ static struct glyph_row * get_overlay_arrow_glyph_row (struct window *w, Lisp_Object overlay_arrow_string) { struct frame *f = XFRAME (WINDOW_FRAME (w)); - struct buffer *buffer = XBUFFER (w->buffer); + struct buffer *buffer = XBUFFER (WVAR (w, buffer)); struct buffer *old = current_buffer; const unsigned char *arrow_string = SDATA (overlay_arrow_string); int arrow_len = SCHARS (overlay_arrow_string); @@ -19247,7 +19251,7 @@ display_line (struct it *it) } /* Is IT->w showing the region? */ - it->w->region_showing = it->region_beg_charpos > 0 ? Qt : Qnil; + WVAR (it->w, region_showing) = it->region_beg_charpos > 0 ? Qt : Qnil; /* Clear the result glyph row and enable it. */ prepare_desired_row (row); @@ -19362,7 +19366,7 @@ display_line (struct it *it) row->glyphs[TEXT_AREA]->charpos = -1; row->displays_text_p = 0; - if (!NILP (BVAR (XBUFFER (it->w->buffer), indicate_empty_lines)) + if (!NILP (BVAR (XBUFFER (WVAR (it->w, buffer)), indicate_empty_lines)) && (!MINI_WINDOW_P (it->w) || (minibuf_level && EQ (it->window, minibuf_window)))) row->indicate_empty_line_p = 1; @@ -20185,12 +20189,12 @@ redisplay_mode_lines (Lisp_Object window, int force) { struct window *w = XWINDOW (window); - if (WINDOWP (w->hchild)) - nwindows += redisplay_mode_lines (w->hchild, force); - else if (WINDOWP (w->vchild)) - nwindows += redisplay_mode_lines (w->vchild, force); + if (WINDOWP (WVAR (w, hchild))) + nwindows += redisplay_mode_lines (WVAR (w, hchild), force); + else if (WINDOWP (WVAR (w, vchild))) + nwindows += redisplay_mode_lines (WVAR (w, vchild), force); else if (force - || FRAME_GARBAGED_P (XFRAME (w->frame)) + || FRAME_GARBAGED_P (XFRAME (WVAR (w, frame))) || !MATRIX_MODE_LINE_ROW (w->current_matrix)->enabled_p) { struct text_pos lpoint; @@ -20198,7 +20202,7 @@ redisplay_mode_lines (Lisp_Object window, int force) /* Set the window's buffer for the mode line display. */ SET_TEXT_POS (lpoint, PT, PT_BYTE); - set_buffer_internal_1 (XBUFFER (w->buffer)); + set_buffer_internal_1 (XBUFFER (WVAR (w, buffer))); /* Point refers normally to the selected window. For any other window, set up appropriate value. */ @@ -20206,7 +20210,7 @@ redisplay_mode_lines (Lisp_Object window, int force) { struct text_pos pt; - SET_TEXT_POS_FROM_MARKER (pt, w->pointm); + SET_TEXT_POS_FROM_MARKER (pt, WVAR (w, pointm)); if (CHARPOS (pt) < BEGV) TEMP_SET_PT_BOTH (BEGV, BEGV_BYTE); else if (CHARPOS (pt) > (ZV - 1)) @@ -20228,7 +20232,7 @@ redisplay_mode_lines (Lisp_Object window, int force) TEMP_SET_PT_BOTH (CHARPOS (lpoint), BYTEPOS (lpoint)); } - window = w->next; + window = WVAR (w, next); } return nwindows; @@ -20245,13 +20249,13 @@ display_mode_lines (struct window *w) int n = 0; old_selected_frame = selected_frame; - selected_frame = w->frame; + selected_frame = WVAR (w, frame); old_selected_window = selected_window; XSETWINDOW (selected_window, w); /* These will be set while the mode line specs are processed. */ line_number_displayed = 0; - w->column_number_displayed = Qnil; + WVAR (w, column_number_displayed) = Qnil; if (WINDOW_WANTS_MODELINE_P (w)) { @@ -20981,7 +20985,7 @@ are the selected window and the WINDOW's buffer). */) w = XWINDOW (window); if (NILP (buffer)) - buffer = w->buffer; + buffer = WVAR (w, buffer); CHECK_BUFFER (buffer); /* Make formatting the modeline a non-op when noninteractive, otherwise @@ -21387,7 +21391,7 @@ decode_mode_spec (struct window *w, register int c, int field_width, else { ptrdiff_t col = current_column (); - w->column_number_displayed = make_number (col); + WVAR (w, column_number_displayed) = make_number (col); pint2str (decode_mode_spec_buf, field_width, col); return decode_mode_spec_buf; } @@ -21440,33 +21444,33 @@ decode_mode_spec (struct window *w, register int c, int field_width, if (mode_line_target == MODE_LINE_TITLE) return ""; - startpos = XMARKER (w->start)->charpos; - startpos_byte = marker_byte_position (w->start); + startpos = XMARKER (WVAR (w, start))->charpos; + startpos_byte = marker_byte_position (WVAR (w, start)); height = WINDOW_TOTAL_LINES (w); /* If we decided that this buffer isn't suitable for line numbers, don't forget that too fast. */ - if (EQ (w->base_line_pos, w->buffer)) + if (EQ (WVAR (w, base_line_pos), WVAR (w, buffer))) goto no_value; /* But do forget it, if the window shows a different buffer now. */ - else if (BUFFERP (w->base_line_pos)) - w->base_line_pos = Qnil; + else if (BUFFERP (WVAR (w, base_line_pos))) + WVAR (w, base_line_pos) = Qnil; /* If the buffer is very big, don't waste time. */ if (INTEGERP (Vline_number_display_limit) && BUF_ZV (b) - BUF_BEGV (b) > XINT (Vline_number_display_limit)) { - w->base_line_pos = Qnil; - w->base_line_number = Qnil; + WVAR (w, base_line_pos) = Qnil; + WVAR (w, base_line_number) = Qnil; goto no_value; } - if (INTEGERP (w->base_line_number) - && INTEGERP (w->base_line_pos) - && XFASTINT (w->base_line_pos) <= startpos) + if (INTEGERP (WVAR (w, base_line_number)) + && INTEGERP (WVAR (w, base_line_pos)) + && XFASTINT (WVAR (w, base_line_pos)) <= startpos) { - line = XFASTINT (w->base_line_number); - linepos = XFASTINT (w->base_line_pos); + line = XFASTINT (WVAR (w, base_line_number)); + linepos = XFASTINT (WVAR (w, base_line_pos)); linepos_byte = buf_charpos_to_bytepos (b, linepos); } else @@ -21489,8 +21493,8 @@ decode_mode_spec (struct window *w, register int c, int field_width, go back past it. */ if (startpos == BUF_BEGV (b)) { - w->base_line_number = make_number (topline); - w->base_line_pos = make_number (BUF_BEGV (b)); + WVAR (w, base_line_number) = make_number (topline); + WVAR (w, base_line_pos) = make_number (BUF_BEGV (b)); } else if (nlines < height + 25 || nlines > height * 3 + 50 || linepos == BUF_BEGV (b)) @@ -21516,13 +21520,13 @@ decode_mode_spec (struct window *w, register int c, int field_width, give up on line numbers for this window. */ if (position == limit_byte && limit == startpos - distance) { - w->base_line_pos = w->buffer; - w->base_line_number = Qnil; + WVAR (w, base_line_pos) = WVAR (w, buffer); + WVAR (w, base_line_number) = Qnil; goto no_value; } - w->base_line_number = make_number (topline - nlines); - w->base_line_pos = make_number (BYTE_TO_CHAR (position)); + WVAR (w, base_line_number) = make_number (topline - nlines); + WVAR (w, base_line_pos) = make_number (BYTE_TO_CHAR (position)); } /* Now count lines from the start pos to point. */ @@ -21560,10 +21564,10 @@ decode_mode_spec (struct window *w, register int c, int field_width, case 'p': { - ptrdiff_t pos = marker_position (w->start); + ptrdiff_t pos = marker_position (WVAR (w, start)); ptrdiff_t total = BUF_ZV (b) - BUF_BEGV (b); - if (XFASTINT (w->window_end_pos) <= BUF_Z (b) - BUF_ZV (b)) + if (XFASTINT (WVAR (w, window_end_pos)) <= BUF_Z (b) - BUF_ZV (b)) { if (pos <= BUF_BEGV (b)) return "All"; @@ -21591,8 +21595,8 @@ decode_mode_spec (struct window *w, register int c, int field_width, /* Display percentage of size above the bottom of the screen. */ case 'P': { - ptrdiff_t toppos = marker_position (w->start); - ptrdiff_t botpos = BUF_Z (b) - XFASTINT (w->window_end_pos); + ptrdiff_t toppos = marker_position (WVAR (w, start)); + ptrdiff_t botpos = BUF_Z (b) - XFASTINT (WVAR (w, window_end_pos)); ptrdiff_t total = BUF_ZV (b) - BUF_BEGV (b); if (botpos >= BUF_ZV (b)) @@ -22299,7 +22303,7 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop, return OK_PIXELS (WINDOW_SCROLL_BAR_AREA_WIDTH (it->w)); } - prop = buffer_local_value_1 (prop, it->w->buffer); + prop = buffer_local_value_1 (prop, WVAR (it->w, buffer)); if (EQ (prop, Qunbound)) prop = Qnil; } @@ -22351,7 +22355,7 @@ calc_pixel_width_or_height (double *res, struct it *it, Lisp_Object prop, return OK_PIXELS (pixels); } - car = buffer_local_value_1 (car, it->w->buffer); + car = buffer_local_value_1 (car, WVAR (it->w, buffer)); if (EQ (car, Qunbound)) car = Qnil; } @@ -22432,7 +22436,7 @@ init_glyph_string (struct glyph_string *s, { memset (s, 0, sizeof *s); s->w = w; - s->f = XFRAME (w->frame); + s->f = XFRAME (WVAR (w, frame)); #ifdef HAVE_NTGUI s->hdc = hdc; #endif @@ -22764,7 +22768,7 @@ fill_glyph_string (struct glyph_string *s, int face_id, int voffset; int glyph_not_available_p; - eassert (s->f == XFRAME (s->w->frame)); + eassert (s->f == XFRAME (WVAR (s->w, frame))); eassert (s->nchars == 0); eassert (start >= 0 && end > start); @@ -24159,7 +24163,7 @@ produce_stretch_glyph (struct it *it) int n = width; if (!STRINGP (object)) - object = it->w->buffer; + object = WVAR (it->w, buffer); #ifdef HAVE_WINDOW_SYSTEM if (FRAME_WINDOW_P (it->f)) append_stretch_glyph (it, object, width, height, ascent); @@ -25386,7 +25390,7 @@ x_clear_end_of_line (int to_x) int from_x, from_y, to_y; eassert (updated_window && updated_row); - f = XFRAME (w->frame); + f = XFRAME (WVAR (w, frame)); if (updated_row->full_width_p) max_x = WINDOW_TOTAL_WIDTH (w); @@ -25544,8 +25548,8 @@ static enum text_cursor_kinds get_window_cursor_type (struct window *w, struct glyph *glyph, int *width, int *active_cursor) { - struct frame *f = XFRAME (w->frame); - struct buffer *b = XBUFFER (w->buffer); + struct frame *f = XFRAME (WVAR (w, frame)); + struct buffer *b = XBUFFER (WVAR (w, buffer)); int cursor_type = DEFAULT_CURSOR; Lisp_Object alt_cursor; int non_selected = 0; @@ -25856,7 +25860,7 @@ draw_phys_cursor_glyph (struct window *w, struct glyph_row *row, void erase_phys_cursor (struct window *w) { - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); int hpos = w->phys_cursor.hpos; int vpos = w->phys_cursor.vpos; @@ -25975,7 +25979,7 @@ void display_and_set_cursor (struct window *w, int on, int hpos, int vpos, int x, int y) { - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); int new_cursor_type; int new_cursor_width; int active_cursor; @@ -26096,14 +26100,14 @@ update_cursor_in_window_tree (struct window *w, int on_p) { while (w) { - if (!NILP (w->hchild)) - update_cursor_in_window_tree (XWINDOW (w->hchild), on_p); - else if (!NILP (w->vchild)) - update_cursor_in_window_tree (XWINDOW (w->vchild), on_p); + if (!NILP (WVAR (w, hchild))) + update_cursor_in_window_tree (XWINDOW (WVAR (w, hchild)), on_p); + else if (!NILP (WVAR (w, vchild))) + update_cursor_in_window_tree (XWINDOW (WVAR (w, vchild)), on_p); else update_window_cursor (w, on_p); - w = NILP (w->next) ? 0 : XWINDOW (w->next); + w = NILP (WVAR (w, next)) ? 0 : XWINDOW (WVAR (w, next)); } } @@ -26127,7 +26131,7 @@ x_update_cursor (struct frame *f, int on_p) void x_clear_cursor (struct window *w) { - if (FRAME_VISIBLE_P (XFRAME (w->frame)) && w->phys_cursor_on_p) + if (FRAME_VISIBLE_P (XFRAME (WVAR (w, frame))) && w->phys_cursor_on_p) update_window_cursor (w, 0); } @@ -26141,7 +26145,7 @@ draw_row_with_mouse_face (struct window *w, int start_x, struct glyph_row *row, enum draw_glyphs_face draw) { #ifdef HAVE_WINDOW_SYSTEM - if (FRAME_WINDOW_P (XFRAME (w->frame))) + if (FRAME_WINDOW_P (XFRAME (WVAR (w, frame)))) { draw_glyphs (w, start_x, row, TEXT_AREA, start_hpos, end_hpos, draw, 0); return; @@ -26312,7 +26316,7 @@ clear_mouse_face (Mouse_HLInfo *hlinfo) static int coords_in_mouse_face_p (struct window *w, int hpos, int vpos) { - Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (WVAR (w, frame))); /* Quickly resolve the easy cases. */ if (!(WINDOWP (hlinfo->mouse_face_window) @@ -26564,7 +26568,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, /* Find the rows corresponding to START_CHARPOS and END_CHARPOS. */ rows_from_pos_range (w, start_charpos, end_charpos, disp_string, &r1, &r2); if (r1 == NULL) - r1 = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); + r1 = MATRIX_ROW (w->current_matrix, XFASTINT (WVAR (w, window_end_vpos))); /* If the before-string or display-string contains newlines, rows_from_pos_range skips to its last row. Move back. */ if (!NILP (before_string) || !NILP (disp_string)) @@ -26586,7 +26590,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, } if (r2 == NULL) { - r2 = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); + r2 = MATRIX_ROW (w->current_matrix, XFASTINT (WVAR (w, window_end_vpos))); hlinfo->mouse_face_past_end = 1; } else if (!NILP (after_string)) @@ -26594,7 +26598,7 @@ mouse_face_from_buffer_pos (Lisp_Object window, /* If the after-string has newlines, advance to its last row. */ struct glyph_row *next; struct glyph_row *last - = MATRIX_ROW (w->current_matrix, XFASTINT (w->window_end_vpos)); + = MATRIX_ROW (w->current_matrix, XFASTINT (WVAR (w, window_end_vpos))); for (next = r2 + 1; next <= last @@ -27259,7 +27263,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, enum window_part area) { struct window *w = XWINDOW (window); - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); #ifdef HAVE_WINDOW_SYSTEM Display_Info *dpyinfo; @@ -27343,7 +27347,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, { help_echo_string = help; XSETWINDOW (help_echo_window, w); - help_echo_object = w->buffer; + help_echo_object = WVAR (w, buffer); help_echo_pos = charpos; } } @@ -27379,7 +27383,7 @@ note_mode_line_or_margin_highlight (Lisp_Object window, int x, int y, { Lisp_Object default_help = buffer_local_value_1 (Qmode_line_default_help_echo, - w->buffer); + WVAR (w, buffer)); if (STRINGP (default_help)) { @@ -27660,9 +27664,9 @@ note_mouse_highlight (struct frame *f, int x, int y) /* Are we in a window whose display is up to date? And verify the buffer's text has not changed. */ - b = XBUFFER (w->buffer); + b = XBUFFER (WVAR (w, buffer)); if (part == ON_TEXT - && EQ (w->window_end_valid, w->buffer) + && EQ (WVAR (w, window_end_valid), WVAR (w, buffer)) && w->last_modified == BUF_MODIFF (b) && w->last_overlay_modified == BUF_OVERLAY_MODIFF (b)) { @@ -27869,8 +27873,8 @@ note_mouse_highlight (struct frame *f, int x, int y) if (pos > 0) { mouse_face = get_char_property_and_overlay - (make_number (pos), Qmouse_face, w->buffer, &overlay); - buffer = w->buffer; + (make_number (pos), Qmouse_face, WVAR (w, buffer), &overlay); + buffer = WVAR (w, buffer); disp_string = object; } } @@ -27896,12 +27900,12 @@ note_mouse_highlight (struct frame *f, int x, int y) is the smallest. */ Lisp_Object lim1 = NILP (BVAR (XBUFFER (buffer), bidi_display_reordering)) - ? Fmarker_position (w->start) + ? Fmarker_position (WVAR (w, start)) : Qnil; Lisp_Object lim2 = NILP (BVAR (XBUFFER (buffer), bidi_display_reordering)) ? make_number (BUF_Z (XBUFFER (buffer)) - - XFASTINT (w->window_end_pos)) + - XFASTINT (WVAR (w, window_end_pos))) : Qnil; if (NILP (overlay)) @@ -27983,11 +27987,11 @@ note_mouse_highlight (struct frame *f, int x, int y) if (p > 0) { help = Fget_char_property (make_number (p), - Qhelp_echo, w->buffer); + Qhelp_echo, WVAR (w, buffer)); if (!NILP (help)) { charpos = p; - obj = w->buffer; + obj = WVAR (w, buffer); } } } @@ -28038,7 +28042,7 @@ note_mouse_highlight (struct frame *f, int x, int y) ptrdiff_t p = string_buffer_position (obj, start); if (p > 0) pointer = Fget_char_property (make_number (p), - Qpointer, w->buffer); + Qpointer, WVAR (w, buffer)); } } else if (BUFFERP (obj) @@ -28076,7 +28080,7 @@ note_mouse_highlight (struct frame *f, int x, int y) void x_clear_window_mouse_face (struct window *w) { - Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (WVAR (w, frame))); Lisp_Object window; BLOCK_INPUT; @@ -28098,7 +28102,7 @@ cancel_mouse_face (struct frame *f) Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); window = hlinfo->mouse_face_window; - if (! NILP (window) && XFRAME (XWINDOW (window)->frame) == f) + if (! NILP (window) && XFRAME (WVAR (XWINDOW (window), frame)) == f) { hlinfo->mouse_face_beg_row = hlinfo->mouse_face_beg_col = -1; hlinfo->mouse_face_end_row = hlinfo->mouse_face_end_col = -1; @@ -28292,7 +28296,7 @@ x_draw_vertical_border (struct window *w) do it for frames with vertical scroll bars because either the right scroll bar of a window, or the left scroll bar of its neighbor will suffice as a border. */ - if (FRAME_HAS_VERTICAL_SCROLL_BARS (XFRAME (w->frame))) + if (FRAME_HAS_VERTICAL_SCROLL_BARS (XFRAME (WVAR (w, frame)))) return; if (!WINDOW_RIGHTMOST_P (w) @@ -28332,7 +28336,7 @@ x_draw_vertical_border (struct window *w) static int expose_window (struct window *w, XRectangle *fr) { - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); XRectangle wr, r; int mouse_face_overwritten_p = 0; @@ -28473,21 +28477,21 @@ expose_window (struct window *w, XRectangle *fr) static int expose_window_tree (struct window *w, XRectangle *r) { - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); int mouse_face_overwritten_p = 0; while (w && !FRAME_GARBAGED_P (f)) { - if (!NILP (w->hchild)) + if (!NILP (WVAR (w, hchild))) mouse_face_overwritten_p - |= expose_window_tree (XWINDOW (w->hchild), r); - else if (!NILP (w->vchild)) + |= expose_window_tree (XWINDOW (WVAR (w, hchild)), r); + else if (!NILP (WVAR (w, vchild))) mouse_face_overwritten_p - |= expose_window_tree (XWINDOW (w->vchild), r); + |= expose_window_tree (XWINDOW (WVAR (w, vchild)), r); else mouse_face_overwritten_p |= expose_window (w, r); - w = NILP (w->next) ? NULL : XWINDOW (w->next); + w = NILP (WVAR (w, next)) ? NULL : XWINDOW (WVAR (w, next)); } return mouse_face_overwritten_p; @@ -29279,7 +29283,7 @@ init_xdisp (void) if (!noninteractive) { struct window *m = XWINDOW (minibuf_window); - Lisp_Object frame = m->frame; + Lisp_Object frame = WVAR (m, frame); struct frame *f = XFRAME (frame); Lisp_Object root = FRAME_ROOT_WINDOW (f); struct window *r = XWINDOW (root); @@ -29287,12 +29291,12 @@ init_xdisp (void) echo_area_window = minibuf_window; - XSETFASTINT (r->top_line, FRAME_TOP_MARGIN (f)); - XSETFASTINT (r->total_lines, FRAME_LINES (f) - 1 - FRAME_TOP_MARGIN (f)); - XSETFASTINT (r->total_cols, FRAME_COLS (f)); - XSETFASTINT (m->top_line, FRAME_LINES (f) - 1); - XSETFASTINT (m->total_lines, 1); - XSETFASTINT (m->total_cols, FRAME_COLS (f)); + XSETFASTINT (WVAR (r, top_line), FRAME_TOP_MARGIN (f)); + XSETFASTINT (WVAR (r, total_lines), FRAME_LINES (f) - 1 - FRAME_TOP_MARGIN (f)); + XSETFASTINT (WVAR (r, total_cols), FRAME_COLS (f)); + XSETFASTINT (WVAR (m, top_line), FRAME_LINES (f) - 1); + XSETFASTINT (WVAR (m, total_lines), 1); + XSETFASTINT (WVAR (m, total_cols), FRAME_COLS (f)); scratch_glyph_row.glyphs[TEXT_AREA] = scratch_glyphs; scratch_glyph_row.glyphs[TEXT_AREA + 1] diff --git a/src/xfaces.c b/src/xfaces.c index 3d5ea9e115..b92e0c8217 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -6031,7 +6031,7 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos, ptrdiff_t *endptr, ptrdiff_t limit, int mouse, int base_face_id) { - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); Lisp_Object attrs[LFACE_VECTOR_SIZE]; Lisp_Object prop, position; ptrdiff_t i, noverlays; @@ -6055,9 +6055,9 @@ face_at_buffer_position (struct window *w, ptrdiff_t pos, /* Get the `face' or `mouse_face' text property at POS, and determine the next position at which the property changes. */ - prop = Fget_text_property (position, propname, w->buffer); + prop = Fget_text_property (position, propname, WVAR (w, buffer)); XSETFASTINT (limit1, (limit < endpos ? limit : endpos)); - end = Fnext_single_property_change (position, propname, w->buffer, limit1); + end = Fnext_single_property_change (position, propname, WVAR (w, buffer), limit1); if (INTEGERP (end)) endpos = XINT (end); @@ -6143,7 +6143,7 @@ face_for_overlay_string (struct window *w, ptrdiff_t pos, ptrdiff_t *endptr, ptrdiff_t limit, int mouse, Lisp_Object overlay) { - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); Lisp_Object attrs[LFACE_VECTOR_SIZE]; Lisp_Object prop, position; Lisp_Object frame; @@ -6165,9 +6165,9 @@ face_for_overlay_string (struct window *w, ptrdiff_t pos, /* Get the `face' or `mouse_face' text property at POS, and determine the next position at which the property changes. */ - prop = Fget_text_property (position, propname, w->buffer); + prop = Fget_text_property (position, propname, WVAR (w, buffer)); XSETFASTINT (limit1, (limit < endpos ? limit : endpos)); - end = Fnext_single_property_change (position, propname, w->buffer, limit1); + end = Fnext_single_property_change (position, propname, WVAR (w, buffer), limit1); if (INTEGERP (end)) endpos = XINT (end); diff --git a/src/xfns.c b/src/xfns.c index da7f6067a9..df66cbe1ab 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -2260,7 +2260,7 @@ free_frame_xic (struct frame *f) void xic_set_preeditarea (struct window *w, int x, int y) { - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); XVaNestedList attr; XPoint spot; @@ -5069,28 +5069,28 @@ Text larger than the specified size is clipped. */) /* Set up the frame's root window. */ w = XWINDOW (FRAME_ROOT_WINDOW (f)); - w->left_col = w->top_line = make_number (0); + WVAR (w, left_col) = WVAR (w, top_line) = make_number (0); if (CONSP (Vx_max_tooltip_size) && RANGED_INTEGERP (1, XCAR (Vx_max_tooltip_size), INT_MAX) && RANGED_INTEGERP (1, XCDR (Vx_max_tooltip_size), INT_MAX)) { - w->total_cols = XCAR (Vx_max_tooltip_size); - w->total_lines = XCDR (Vx_max_tooltip_size); + WVAR (w, total_cols) = XCAR (Vx_max_tooltip_size); + WVAR (w, total_lines) = XCDR (Vx_max_tooltip_size); } else { - w->total_cols = make_number (80); - w->total_lines = make_number (40); + WVAR (w, total_cols) = make_number (80); + WVAR (w, total_lines) = make_number (40); } - FRAME_TOTAL_COLS (f) = XINT (w->total_cols); + FRAME_TOTAL_COLS (f) = XINT (WVAR (w, total_cols)); adjust_glyphs (f); w->pseudo_window_p = 1; /* Display the tooltip text in a temporary buffer. */ old_buffer = current_buffer; - set_buffer_internal_1 (XBUFFER (XWINDOW (FRAME_ROOT_WINDOW (f))->buffer)); + set_buffer_internal_1 (XBUFFER (WVAR (XWINDOW (FRAME_ROOT_WINDOW (f)), buffer))); BVAR (current_buffer, truncate_lines) = Qnil; clear_glyph_matrix (w->desired_matrix); clear_glyph_matrix (w->current_matrix); @@ -5151,7 +5151,7 @@ Text larger than the specified size is clipped. */) /* w->total_cols and FRAME_TOTAL_COLS want the width in columns, not in pixels. */ width /= WINDOW_FRAME_COLUMN_WIDTH (w); - w->total_cols = make_number (width); + WVAR (w, total_cols) = make_number (width); FRAME_TOTAL_COLS (f) = width; adjust_glyphs (f); clear_glyph_matrix (w->desired_matrix); diff --git a/src/xmenu.c b/src/xmenu.c index d1b3198cc8..e68245ba37 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -985,7 +985,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) if (! menubar_widget) previous_menu_items_used = 0; - buffer = XWINDOW (FRAME_SELECTED_WINDOW (f))->buffer; + buffer = WVAR (XWINDOW (FRAME_SELECTED_WINDOW (f)), buffer); specbind (Qinhibit_quit, Qt); /* Don't let the debugger step into this code because it is not reentrant. */ diff --git a/src/xterm.c b/src/xterm.c index 0f386b6b6a..e4023f9de7 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -628,7 +628,7 @@ x_draw_vertical_window_border (struct window *w, int x, int y0, int y1) static void x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritten_p) { - Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); + Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (WVAR (w, frame))); if (!w->pseudo_window_p) { @@ -728,7 +728,7 @@ x_after_update_window_line (struct glyph_row *desired_row) overhead is very small. */ if (windows_or_buffers_changed && desired_row->full_width_p - && (f = XFRAME (w->frame), + && (f = XFRAME (WVAR (w, frame)), width = FRAME_INTERNAL_BORDER_WIDTH (f), width != 0) && (height = desired_row->visible_height, @@ -3295,7 +3295,7 @@ x_ins_del_lines (struct frame *f, int vpos, int n) static void x_scroll_run (struct window *w, struct run *run) { - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); int x, y, width, height, from_y, to_y, bottom_y; /* Get frame-relative bounding box of the text display area of W, @@ -4244,9 +4244,9 @@ xt_action_hook (Widget widget, XtPointer client_data, String action_name, scroll_bar_end_scroll, 0, 0); w = XWINDOW (window_being_scrolled); - if (!NILP (XSCROLL_BAR (w->vertical_scroll_bar)->dragging)) + if (!NILP (XSCROLL_BAR (WVAR (w, vertical_scroll_bar))->dragging)) { - XSCROLL_BAR (w->vertical_scroll_bar)->dragging = Qnil; + XSCROLL_BAR (WVAR (w, vertical_scroll_bar))->dragging = Qnil; /* The thumb size is incorrect while dragging: fix it. */ set_vertical_scroll_bar (w); } @@ -4277,7 +4277,7 @@ x_send_scroll_bar_event (Lisp_Object window, int part, int portion, int whole) XEvent event; XClientMessageEvent *ev = (XClientMessageEvent *) &event; struct window *w = XWINDOW (window); - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); ptrdiff_t i; BLOCK_INPUT; @@ -4353,7 +4353,7 @@ x_scroll_bar_to_input_event (XEvent *event, struct input_event *ievent) ievent->timestamp = CurrentTime; #else ievent->timestamp = - XtLastTimestampProcessed (FRAME_X_DISPLAY (XFRAME (w->frame))); + XtLastTimestampProcessed (FRAME_X_DISPLAY (XFRAME (WVAR (w, frame)))); #endif ievent->part = ev->data.l[1]; ievent->code = ev->data.l[2]; @@ -4954,7 +4954,7 @@ x_set_toolkit_scroll_bar_thumb (struct scroll_bar *bar, int portion, int positio static struct scroll_bar * x_scroll_bar_create (struct window *w, int top, int left, int width, int height) { - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); struct scroll_bar *bar = ALLOCATE_PSEUDOVECTOR (struct scroll_bar, x_window, PVEC_OTHER); @@ -5180,7 +5180,7 @@ x_scroll_bar_remove (struct scroll_bar *bar) #endif /* Dissociate this scroll bar from its window. */ - XWINDOW (bar->window)->vertical_scroll_bar = Qnil; + WVAR (XWINDOW (bar->window), vertical_scroll_bar) = Qnil; UNBLOCK_INPUT; } @@ -5194,7 +5194,7 @@ x_scroll_bar_remove (struct scroll_bar *bar) static void XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int position) { - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); struct scroll_bar *bar; int top, height, left, sb_left, width, sb_width; int window_y, window_height; @@ -5245,7 +5245,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio #endif /* Does the scroll bar exist yet? */ - if (NILP (w->vertical_scroll_bar)) + if (NILP (WVAR (w, vertical_scroll_bar))) { if (width > 0 && height > 0) { @@ -5268,7 +5268,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio /* It may just need to be moved and resized. */ unsigned int mask = 0; - bar = XSCROLL_BAR (w->vertical_scroll_bar); + bar = XSCROLL_BAR (WVAR (w, vertical_scroll_bar)); BLOCK_INPUT; @@ -5392,7 +5392,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio } #endif /* not USE_TOOLKIT_SCROLL_BARS */ - XSETVECTOR (w->vertical_scroll_bar, bar); + XSETVECTOR (WVAR (w, vertical_scroll_bar), bar); } @@ -5436,10 +5436,10 @@ XTredeem_scroll_bar (struct window *window) struct frame *f; /* We can't redeem this window's scroll bar if it doesn't have one. */ - if (NILP (window->vertical_scroll_bar)) + if (NILP (WVAR (window, vertical_scroll_bar))) abort (); - bar = XSCROLL_BAR (window->vertical_scroll_bar); + bar = XSCROLL_BAR (WVAR (window, vertical_scroll_bar)); /* Unlink it from the condemned list. */ f = XFRAME (WINDOW_FRAME (window)); @@ -5447,11 +5447,11 @@ XTredeem_scroll_bar (struct window *window) { /* If the prev pointer is nil, it must be the first in one of the lists. */ - if (EQ (FRAME_SCROLL_BARS (f), window->vertical_scroll_bar)) + if (EQ (FRAME_SCROLL_BARS (f), WVAR (window, vertical_scroll_bar))) /* It's not condemned. Everything's fine. */ return; else if (EQ (FRAME_CONDEMNED_SCROLL_BARS (f), - window->vertical_scroll_bar)) + WVAR (window, vertical_scroll_bar))) FRAME_CONDEMNED_SCROLL_BARS (f) = bar->next; else /* If its prev pointer is nil, it must be at the front of @@ -5610,7 +5610,7 @@ x_scroll_bar_handle_click (struct scroll_bar *bar, XEvent *event, struct input_e static void x_scroll_bar_note_movement (struct scroll_bar *bar, XEvent *event) { - FRAME_PTR f = XFRAME (XWINDOW (bar->window)->frame); + FRAME_PTR f = XFRAME (WVAR (XWINDOW (bar->window), frame)); last_mouse_movement_time = event->xmotion.time; @@ -6784,8 +6784,8 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, create event iff we don't leave the selected frame. */ && (focus_follows_mouse - || (EQ (XWINDOW (window)->frame, - XWINDOW (selected_window)->frame)))) + || (EQ (WVAR (XWINDOW (window), frame), + WVAR (XWINDOW (selected_window), frame))))) { inev.ie.kind = SELECT_WINDOW_EVENT; inev.ie.frame_or_window = window; @@ -7334,7 +7334,7 @@ x_draw_hollow_cursor (struct window *w, struct glyph_row *row) static void x_draw_bar_cursor (struct window *w, struct glyph_row *row, int width, enum text_cursor_kinds kind) { - struct frame *f = XFRAME (w->frame); + struct frame *f = XFRAME (WVAR (w, frame)); struct glyph *cursor_glyph; /* If cursor is out of bounds, don't draw garbage. This can happen -- 2.20.1