diff options
author | Dmitry Antipov <dmantipov@yandex.ru> | 2012-07-31 16:36:19 +0400 |
---|---|---|
committer | Dmitry Antipov <dmantipov@yandex.ru> | 2012-07-31 16:36:19 +0400 |
commit | e34f7f79833a23586d32fe522b547a0d9a696c13 (patch) | |
tree | 4a2d3927202cb91b474bc9648ca9dee2bffaa54a /src | |
parent | c09bfb2f140b2885af17185634451e2abfd6e91c (diff) | |
download | emacs-e34f7f79833a23586d32fe522b547a0d9a696c13.tar.gz |
Generalize INTERNAL_FIELD between buffers, keyboards and frames.
* src/lisp.h (INTERNAL_FIELD): New macro.
* src/buffer.h (BUFFER_INTERNAL_FIELD): Removed.
(BVAR): Change to use INTERNAL_FIELD.
* src/keyboard.h (KBOARD_INTERNAL_FIELD): Likewise.
(KVAR): Change to use INTERNAL_FIELD.
* src/frame.h (FVAR): New macro.
(struct frame): Use INTERNAL_FIELD for all Lisp_Object fields.
* src/alloc.c, src/buffer.c, src/data.c, src/dispnew.c, src/dosfns.c
* src/eval.c, src/frame.c, src/fringe.c, src/gtkutil.c, src/minibuf.c
* src/nsfns.m, src/nsterm.m, src/print.c, src/term.c, src/w32fns.c
* src/w32menu.c, src/w32term.c, src/window.c, src/window.h, src/xdisp.c
* src/xfaces.c, src/xfns.c, src/xmenu.c, src/xterm.c: Users changed.
* admin/coccinelle/frame.cocci: Semantic patch to replace direct
access to Lisp_Object members of struct frame to FVAR.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 15 | ||||
-rw-r--r-- | src/alloc.c | 10 | ||||
-rw-r--r-- | src/buffer.c | 19 | ||||
-rw-r--r-- | src/buffer.h | 151 | ||||
-rw-r--r-- | src/data.c | 4 | ||||
-rw-r--r-- | src/dispnew.c | 79 | ||||
-rw-r--r-- | src/dosfns.c | 6 | ||||
-rw-r--r-- | src/eval.c | 2 | ||||
-rw-r--r-- | src/frame.c | 128 | ||||
-rw-r--r-- | src/frame.h | 61 | ||||
-rw-r--r-- | src/fringe.c | 4 | ||||
-rw-r--r-- | src/gtkutil.c | 24 | ||||
-rw-r--r-- | src/keyboard.h | 43 | ||||
-rw-r--r-- | src/lisp.h | 7 | ||||
-rw-r--r-- | src/minibuf.c | 8 | ||||
-rw-r--r-- | src/nsfns.m | 4 | ||||
-rw-r--r-- | src/nsterm.m | 4 | ||||
-rw-r--r-- | src/print.c | 2 | ||||
-rw-r--r-- | src/term.c | 2 | ||||
-rw-r--r-- | src/w32fns.c | 60 | ||||
-rw-r--r-- | src/w32menu.c | 10 | ||||
-rw-r--r-- | src/w32term.c | 22 | ||||
-rw-r--r-- | src/window.c | 45 | ||||
-rw-r--r-- | src/window.h | 8 | ||||
-rw-r--r-- | src/xdisp.c | 127 | ||||
-rw-r--r-- | src/xfaces.c | 17 | ||||
-rw-r--r-- | src/xfns.c | 80 | ||||
-rw-r--r-- | src/xmenu.c | 8 | ||||
-rw-r--r-- | src/xterm.c | 25 |
29 files changed, 499 insertions, 476 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 0c791bcd17c..ed398888285 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,20 @@ 2012-07-31 Dmitry Antipov <dmantipov@yandex.ru> + Generalize INTERNAL_FIELD between buffers, keyboards and frames. + * lisp.h (INTERNAL_FIELD): New macro. + * buffer.h (BUFFER_INTERNAL_FIELD): Removed. + (BVAR): Change to use INTERNAL_FIELD. + * keyboard.h (KBOARD_INTERNAL_FIELD): Likewise. + (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, + * xdisp.c, xfaces.c, xfns.c, xmenu.c, xterm.c: Users changed. + +2012-07-31 Dmitry Antipov <dmantipov@yandex.ru> + Miscellaneous fixes for non-default X toolkits. * xfns.c (Fx_file_dialog): Change to SSDATA to avoid warnings. * xterm.c (x_frame_of_widget): Remove redundant prototype. diff --git a/src/alloc.c b/src/alloc.c index 5b2553c69cc..f04f3c05134 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -4424,7 +4424,7 @@ live_buffer_p (struct mem_node *m, void *p) must not have been killed. */ return (m->type == MEM_TYPE_BUFFER && p == m->start - && !NILP (((struct buffer *) p)->BUFFER_INTERNAL_FIELD (name))); + && !NILP (((struct buffer *) p)->INTERNAL_FIELD (name))); } #endif /* GC_MARK_STACK || defined GC_MALLOC_CHECK */ @@ -5549,10 +5549,10 @@ See Info node `(elisp)Garbage Collection'. */) turned off in that buffer. Calling truncate_undo_list on Qt tends to return NULL, which effectively turns undo back on. So don't call truncate_undo_list if undo_list is Qt. */ - if (! EQ (nextb->BUFFER_INTERNAL_FIELD (undo_list), Qt)) + if (! EQ (nextb->INTERNAL_FIELD (undo_list), Qt)) { Lisp_Object tail, prev; - tail = nextb->BUFFER_INTERNAL_FIELD (undo_list); + tail = nextb->INTERNAL_FIELD (undo_list); prev = Qnil; while (CONSP (tail)) { @@ -5561,7 +5561,7 @@ See Info node `(elisp)Garbage Collection'. */) && !XMARKER (XCAR (XCAR (tail)))->gcmarkbit) { if (NILP (prev)) - nextb->BUFFER_INTERNAL_FIELD (undo_list) = tail = XCDR (tail); + nextb->INTERNAL_FIELD (undo_list) = tail = XCDR (tail); else { tail = XCDR (tail); @@ -5577,7 +5577,7 @@ See Info node `(elisp)Garbage Collection'. */) } /* Now that we have stripped the elements that need not be in the undo_list any more, we can finally mark the list. */ - mark_object (nextb->BUFFER_INTERNAL_FIELD (undo_list)); + mark_object (nextb->INTERNAL_FIELD (undo_list)); } gc_sweep (); diff --git a/src/buffer.c b/src/buffer.c index 833eb843168..4168fa8f027 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -191,9 +191,9 @@ followed by the rest of the buffers. */) Lisp_Object args[3]; CHECK_FRAME (frame); - framelist = Fcopy_sequence (XFRAME (frame)->buffer_list); + framelist = Fcopy_sequence (FVAR (XFRAME (frame), buffer_list)); prevlist = Fnreverse (Fcopy_sequence - (XFRAME (frame)->buried_buffer_list)); + (FVAR (XFRAME (frame), buried_buffer_list))); /* Remove from GENERAL any buffer that duplicates one in FRAMELIST or PREVLIST. */ @@ -1324,7 +1324,7 @@ exists, return the buffer `*scratch*' (creating it if necessary). */) pred = frame_buffer_predicate (frame); /* Consider buffers that have been seen in the frame first. */ - tail = XFRAME (frame)->buffer_list; + tail = FVAR (XFRAME (frame), buffer_list); for (; CONSP (tail); tail = XCDR (tail)) { buf = XCAR (tail); @@ -1446,7 +1446,7 @@ compact_buffer (struct buffer *buffer) /* Skip dead buffers, indirect buffers and buffers which aren't changed since last compaction. */ - if (!NILP (buffer->BUFFER_INTERNAL_FIELD (name)) + if (!NILP (buffer->INTERNAL_FIELD (name)) && (buffer->base_buffer == NULL) && (buffer->text->compact != buffer->text->modiff)) { @@ -1454,7 +1454,7 @@ compact_buffer (struct buffer *buffer) turned off in that buffer. Calling truncate_undo_list on Qt tends to return NULL, which effectively turns undo back on. So don't call truncate_undo_list if undo_list is Qt. */ - if (!EQ (buffer->BUFFER_INTERNAL_FIELD (undo_list), Qt)) + if (!EQ (buffer->INTERNAL_FIELD (undo_list), Qt)) truncate_undo_list (buffer); /* Shrink buffer gaps. */ @@ -1764,8 +1764,8 @@ record_buffer (Lisp_Object buffer) Vinhibit_quit = tem; /* Update buffer list of selected frame. */ - f->buffer_list = Fcons (buffer, Fdelq (buffer, f->buffer_list)); - f->buried_buffer_list = Fdelq (buffer, f->buried_buffer_list); + FVAR (f, buffer_list) = Fcons (buffer, Fdelq (buffer, FVAR (f, buffer_list))); + FVAR (f, buried_buffer_list) = Fdelq (buffer, FVAR (f, buried_buffer_list)); /* Run buffer-list-update-hook. */ if (!NILP (Vrun_hooks)) @@ -1802,8 +1802,9 @@ DEFUN ("bury-buffer-internal", Fbury_buffer_internal, Sbury_buffer_internal, Vinhibit_quit = tem; /* Update buffer lists of selected frame. */ - f->buffer_list = Fdelq (buffer, f->buffer_list); - f->buried_buffer_list = Fcons (buffer, Fdelq (buffer, f->buried_buffer_list)); + FVAR (f, buffer_list) = Fdelq (buffer, FVAR (f, buffer_list)); + FVAR (f, buried_buffer_list) + = Fcons (buffer, Fdelq (buffer, FVAR (f, buried_buffer_list))); /* Run buffer-list-update-hook. */ if (!NILP (Vrun_hooks)) diff --git a/src/buffer.h b/src/buffer.h index 61f9e72fcfd..b9a2c9c7dce 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -472,14 +472,9 @@ struct buffer_text int inhibit_shrinking; }; -/* Lisp fields in struct buffer are hidden from most code and accessed - via the BVAR macro, below. Only select pieces of code, like the GC, - are allowed to use BUFFER_INTERNAL_FIELD. */ -#define BUFFER_INTERNAL_FIELD(field) field ## _ +/* Most code should use this macro to access Lisp fields in struct buffer. */ -/* Most code should use this macro to access Lisp fields in struct - buffer. */ -#define BVAR(buf, field) ((buf)->BUFFER_INTERNAL_FIELD (field)) +#define BVAR(buf, field) ((buf)->INTERNAL_FIELD (field)) /* This is the structure that the buffer Lisp object points to. */ @@ -493,17 +488,17 @@ struct buffer struct vectorlike_header header; /* The name of this buffer. */ - Lisp_Object BUFFER_INTERNAL_FIELD (name); + Lisp_Object INTERNAL_FIELD (name); /* The name of the file visited in this buffer, or nil. */ - Lisp_Object BUFFER_INTERNAL_FIELD (filename); + Lisp_Object INTERNAL_FIELD (filename); /* Directory for expanding relative file names. */ - Lisp_Object BUFFER_INTERNAL_FIELD (directory); + Lisp_Object INTERNAL_FIELD (directory); /* True if this buffer has been backed up (if you write to the visited file and it hasn't been backed up, then a backup will be made). */ - Lisp_Object BUFFER_INTERNAL_FIELD (backed_up); + Lisp_Object INTERNAL_FIELD (backed_up); /* Length of file when last read or saved. -1 means auto saving turned off because buffer shrank a lot. @@ -511,132 +506,132 @@ struct buffer (That value is used with buffer-swap-text.) This is not in the struct buffer_text because it's not used in indirect buffers at all. */ - Lisp_Object BUFFER_INTERNAL_FIELD (save_length); + Lisp_Object INTERNAL_FIELD (save_length); /* File name used for auto-saving this buffer. This is not in the struct buffer_text because it's not used in indirect buffers at all. */ - Lisp_Object BUFFER_INTERNAL_FIELD (auto_save_file_name); + Lisp_Object INTERNAL_FIELD (auto_save_file_name); /* Non-nil if buffer read-only. */ - Lisp_Object BUFFER_INTERNAL_FIELD (read_only); + Lisp_Object INTERNAL_FIELD (read_only); /* "The mark". This is a marker which may point into this buffer or may point nowhere. */ - Lisp_Object BUFFER_INTERNAL_FIELD (mark); + Lisp_Object INTERNAL_FIELD (mark); /* Alist of elements (SYMBOL . VALUE-IN-THIS-BUFFER) for all per-buffer variables of this buffer. For locally unbound symbols, just the symbol appears as the element. */ - Lisp_Object BUFFER_INTERNAL_FIELD (local_var_alist); + Lisp_Object INTERNAL_FIELD (local_var_alist); /* Symbol naming major mode (e.g., lisp-mode). */ - Lisp_Object BUFFER_INTERNAL_FIELD (major_mode); + Lisp_Object INTERNAL_FIELD (major_mode); /* Pretty name of major mode (e.g., "Lisp"). */ - Lisp_Object BUFFER_INTERNAL_FIELD (mode_name); + Lisp_Object INTERNAL_FIELD (mode_name); /* Mode line element that controls format of mode line. */ - Lisp_Object BUFFER_INTERNAL_FIELD (mode_line_format); + Lisp_Object INTERNAL_FIELD (mode_line_format); /* Analogous to mode_line_format for the line displayed at the top of windows. Nil means don't display that line. */ - Lisp_Object BUFFER_INTERNAL_FIELD (header_line_format); + Lisp_Object INTERNAL_FIELD (header_line_format); /* Keys that are bound local to this buffer. */ - Lisp_Object BUFFER_INTERNAL_FIELD (keymap); + Lisp_Object INTERNAL_FIELD (keymap); /* This buffer's local abbrev table. */ - Lisp_Object BUFFER_INTERNAL_FIELD (abbrev_table); + Lisp_Object INTERNAL_FIELD (abbrev_table); /* This buffer's syntax table. */ - Lisp_Object BUFFER_INTERNAL_FIELD (syntax_table); + Lisp_Object INTERNAL_FIELD (syntax_table); /* This buffer's category table. */ - Lisp_Object BUFFER_INTERNAL_FIELD (category_table); + Lisp_Object INTERNAL_FIELD (category_table); /* Values of several buffer-local variables. */ /* tab-width is buffer-local so that redisplay can find it in buffers that are not current. */ - Lisp_Object BUFFER_INTERNAL_FIELD (case_fold_search); - Lisp_Object BUFFER_INTERNAL_FIELD (tab_width); - Lisp_Object BUFFER_INTERNAL_FIELD (fill_column); - Lisp_Object BUFFER_INTERNAL_FIELD (left_margin); + Lisp_Object INTERNAL_FIELD (case_fold_search); + Lisp_Object INTERNAL_FIELD (tab_width); + Lisp_Object INTERNAL_FIELD (fill_column); + Lisp_Object INTERNAL_FIELD (left_margin); /* Function to call when insert space past fill column. */ - Lisp_Object BUFFER_INTERNAL_FIELD (auto_fill_function); + Lisp_Object INTERNAL_FIELD (auto_fill_function); /* Case table for case-conversion in this buffer. This char-table maps each char into its lower-case version. */ - Lisp_Object BUFFER_INTERNAL_FIELD (downcase_table); + Lisp_Object INTERNAL_FIELD (downcase_table); /* Char-table mapping each char to its upper-case version. */ - Lisp_Object BUFFER_INTERNAL_FIELD (upcase_table); + Lisp_Object INTERNAL_FIELD (upcase_table); /* Char-table for conversion for case-folding search. */ - Lisp_Object BUFFER_INTERNAL_FIELD (case_canon_table); + Lisp_Object INTERNAL_FIELD (case_canon_table); /* Char-table of equivalences for case-folding search. */ - Lisp_Object BUFFER_INTERNAL_FIELD (case_eqv_table); + Lisp_Object INTERNAL_FIELD (case_eqv_table); /* Non-nil means do not display continuation lines. */ - Lisp_Object BUFFER_INTERNAL_FIELD (truncate_lines); + Lisp_Object INTERNAL_FIELD (truncate_lines); /* Non-nil means to use word wrapping when displaying continuation lines. */ - Lisp_Object BUFFER_INTERNAL_FIELD (word_wrap); + Lisp_Object INTERNAL_FIELD (word_wrap); /* Non-nil means display ctl chars with uparrow. */ - Lisp_Object BUFFER_INTERNAL_FIELD (ctl_arrow); + Lisp_Object INTERNAL_FIELD (ctl_arrow); /* Non-nil means reorder bidirectional text for display in the visual order. */ - Lisp_Object BUFFER_INTERNAL_FIELD (bidi_display_reordering); + Lisp_Object INTERNAL_FIELD (bidi_display_reordering); /* If non-nil, specifies which direction of text to force in all the paragraphs of the buffer. Nil means determine paragraph direction dynamically for each paragraph. */ - Lisp_Object BUFFER_INTERNAL_FIELD (bidi_paragraph_direction); + Lisp_Object INTERNAL_FIELD (bidi_paragraph_direction); /* Non-nil means do selective display; see doc string in syms_of_buffer (buffer.c) for details. */ - Lisp_Object BUFFER_INTERNAL_FIELD (selective_display); + Lisp_Object INTERNAL_FIELD (selective_display); /* Non-nil means show ... at end of line followed by invisible lines. */ - Lisp_Object BUFFER_INTERNAL_FIELD (selective_display_ellipses); + Lisp_Object INTERNAL_FIELD (selective_display_ellipses); /* Alist of (FUNCTION . STRING) for each minor mode enabled in buffer. */ - Lisp_Object BUFFER_INTERNAL_FIELD (minor_modes); + Lisp_Object INTERNAL_FIELD (minor_modes); /* t if "self-insertion" should overwrite; `binary' if it should also overwrite newlines and tabs - for editing executables and the like. */ - Lisp_Object BUFFER_INTERNAL_FIELD (overwrite_mode); + Lisp_Object INTERNAL_FIELD (overwrite_mode); /* Non-nil means abbrev mode is on. Expand abbrevs automatically. */ - Lisp_Object BUFFER_INTERNAL_FIELD (abbrev_mode); + Lisp_Object INTERNAL_FIELD (abbrev_mode); /* Display table to use for text in this buffer. */ - Lisp_Object BUFFER_INTERNAL_FIELD (display_table); + Lisp_Object INTERNAL_FIELD (display_table); /* t means the mark and region are currently active. */ - Lisp_Object BUFFER_INTERNAL_FIELD (mark_active); + Lisp_Object INTERNAL_FIELD (mark_active); /* Non-nil means the buffer contents are regarded as multi-byte form of characters, not a binary code. */ - Lisp_Object BUFFER_INTERNAL_FIELD (enable_multibyte_characters); + Lisp_Object INTERNAL_FIELD (enable_multibyte_characters); /* Coding system to be used for encoding the buffer contents on saving. */ - Lisp_Object BUFFER_INTERNAL_FIELD (buffer_file_coding_system); + Lisp_Object INTERNAL_FIELD (buffer_file_coding_system); /* List of symbols naming the file format used for visited file. */ - Lisp_Object BUFFER_INTERNAL_FIELD (file_format); + Lisp_Object INTERNAL_FIELD (file_format); /* List of symbols naming the file format used for auto-save file. */ - Lisp_Object BUFFER_INTERNAL_FIELD (auto_save_file_format); + Lisp_Object INTERNAL_FIELD (auto_save_file_format); /* True if the newline position cache and width run cache are enabled. See search.c and indent.c. */ - Lisp_Object BUFFER_INTERNAL_FIELD (cache_long_line_scans); + Lisp_Object INTERNAL_FIELD (cache_long_line_scans); /* If the width run cache is enabled, this table contains the character widths width_run_cache (see above) assumes. When we @@ -644,102 +639,102 @@ struct buffer current display table to see whether the display table has affected the widths of any characters. If it has, we invalidate the width run cache, and re-initialize width_table. */ - Lisp_Object BUFFER_INTERNAL_FIELD (width_table); + Lisp_Object INTERNAL_FIELD (width_table); /* In an indirect buffer, or a buffer that is the base of an indirect buffer, this holds a marker that records PT for this buffer when the buffer is not current. */ - Lisp_Object BUFFER_INTERNAL_FIELD (pt_marker); + Lisp_Object INTERNAL_FIELD (pt_marker); /* In an indirect buffer, or a buffer that is the base of an indirect buffer, this holds a marker that records BEGV for this buffer when the buffer is not current. */ - Lisp_Object BUFFER_INTERNAL_FIELD (begv_marker); + Lisp_Object INTERNAL_FIELD (begv_marker); /* In an indirect buffer, or a buffer that is the base of an indirect buffer, this holds a marker that records ZV for this buffer when the buffer is not current. */ - Lisp_Object BUFFER_INTERNAL_FIELD (zv_marker); + Lisp_Object INTERNAL_FIELD (zv_marker); /* This holds the point value before the last scroll operation. Explicitly setting point sets this to nil. */ - Lisp_Object BUFFER_INTERNAL_FIELD (point_before_scroll); + Lisp_Object INTERNAL_FIELD (point_before_scroll); /* Truename of the visited file, or nil. */ - Lisp_Object BUFFER_INTERNAL_FIELD (file_truename); + Lisp_Object INTERNAL_FIELD (file_truename); /* Invisibility spec of this buffer. t => any non-nil `invisible' property means invisible. A list => `invisible' property means invisible if it is memq in that list. */ - Lisp_Object BUFFER_INTERNAL_FIELD (invisibility_spec); + Lisp_Object INTERNAL_FIELD (invisibility_spec); /* This is the last window that was selected with this buffer in it, or nil if that window no longer displays this buffer. */ - Lisp_Object BUFFER_INTERNAL_FIELD (last_selected_window); + Lisp_Object INTERNAL_FIELD (last_selected_window); /* Incremented each time the buffer is displayed in a window. */ - Lisp_Object BUFFER_INTERNAL_FIELD (display_count); + Lisp_Object INTERNAL_FIELD (display_count); /* Widths of left and right marginal areas for windows displaying this buffer. */ - Lisp_Object BUFFER_INTERNAL_FIELD (left_margin_cols); - Lisp_Object BUFFER_INTERNAL_FIELD (right_margin_cols); + Lisp_Object INTERNAL_FIELD (left_margin_cols); + Lisp_Object INTERNAL_FIELD (right_margin_cols); /* Widths of left and right fringe areas for windows displaying this buffer. */ - Lisp_Object BUFFER_INTERNAL_FIELD (left_fringe_width); - Lisp_Object BUFFER_INTERNAL_FIELD (right_fringe_width); + Lisp_Object INTERNAL_FIELD (left_fringe_width); + Lisp_Object INTERNAL_FIELD (right_fringe_width); /* Non-nil means fringes are drawn outside display margins; othersize draw them between margin areas and text. */ - Lisp_Object BUFFER_INTERNAL_FIELD (fringes_outside_margins); + Lisp_Object INTERNAL_FIELD (fringes_outside_margins); /* Width and type of scroll bar areas for windows displaying this buffer. */ - Lisp_Object BUFFER_INTERNAL_FIELD (scroll_bar_width); - Lisp_Object BUFFER_INTERNAL_FIELD (vertical_scroll_bar_type); + Lisp_Object INTERNAL_FIELD (scroll_bar_width); + Lisp_Object INTERNAL_FIELD (vertical_scroll_bar_type); /* Non-nil means indicate lines not displaying text (in a style like vi). */ - Lisp_Object BUFFER_INTERNAL_FIELD (indicate_empty_lines); + Lisp_Object INTERNAL_FIELD (indicate_empty_lines); /* Non-nil means indicate buffer boundaries and scrolling. */ - Lisp_Object BUFFER_INTERNAL_FIELD (indicate_buffer_boundaries); + Lisp_Object INTERNAL_FIELD (indicate_buffer_boundaries); /* Logical to physical fringe bitmap mappings. */ - Lisp_Object BUFFER_INTERNAL_FIELD (fringe_indicator_alist); + Lisp_Object INTERNAL_FIELD (fringe_indicator_alist); /* Logical to physical cursor bitmap mappings. */ - Lisp_Object BUFFER_INTERNAL_FIELD (fringe_cursor_alist); + Lisp_Object INTERNAL_FIELD (fringe_cursor_alist); /* Time stamp updated each time this buffer is displayed in a window. */ - Lisp_Object BUFFER_INTERNAL_FIELD (display_time); + Lisp_Object INTERNAL_FIELD (display_time); /* If scrolling the display because point is below the bottom of a window showing this buffer, try to choose a window start so that point ends up this number of lines from the top of the window. Nil means that scrolling method isn't used. */ - Lisp_Object BUFFER_INTERNAL_FIELD (scroll_up_aggressively); + Lisp_Object INTERNAL_FIELD (scroll_up_aggressively); /* If scrolling the display because point is above the top of a window showing this buffer, try to choose a window start so that point ends up this number of lines from the bottom of the window. Nil means that scrolling method isn't used. */ - Lisp_Object BUFFER_INTERNAL_FIELD (scroll_down_aggressively); + Lisp_Object INTERNAL_FIELD (scroll_down_aggressively); /* Desired cursor type in this buffer. See the doc string of per-buffer variable `cursor-type'. */ - Lisp_Object BUFFER_INTERNAL_FIELD (cursor_type); + Lisp_Object INTERNAL_FIELD (cursor_type); /* An integer > 0 means put that number of pixels below text lines in the display of this buffer. */ - Lisp_Object BUFFER_INTERNAL_FIELD (extra_line_spacing); + Lisp_Object INTERNAL_FIELD (extra_line_spacing); /* Cursor type to display in non-selected windows. t means to use hollow box cursor. See `cursor-type' for other values. */ - Lisp_Object BUFFER_INTERNAL_FIELD (cursor_in_non_selected_windows); + Lisp_Object INTERNAL_FIELD (cursor_in_non_selected_windows); /* No more Lisp_Object beyond this point. Except undo_list, which is handled specially in Fgarbage_collect . */ @@ -861,7 +856,7 @@ struct buffer buffer of an indirect buffer. But we can't store it in the struct buffer_text because local variables have to be right in the struct buffer. So we copy it around in set_buffer_internal. */ - Lisp_Object BUFFER_INTERNAL_FIELD (undo_list); + Lisp_Object INTERNAL_FIELD (undo_list); }; @@ -1020,7 +1015,7 @@ extern int last_per_buffer_idx; from the start of a buffer structure. */ #define PER_BUFFER_VAR_OFFSET(VAR) \ - offsetof (struct buffer, BUFFER_INTERNAL_FIELD (VAR)) + offsetof (struct buffer, INTERNAL_FIELD (VAR)) /* Used to iterate over normal Lisp_Object fields of struct buffer (all Lisp_Objects except undo_list). If you add, remove, or reorder diff --git a/src/data.c b/src/data.c index fd873b22d4d..59228adb28f 100644 --- a/src/data.c +++ b/src/data.c @@ -1006,7 +1006,7 @@ swap_in_symval_forwarding (struct Lisp_Symbol *symbol, struct Lisp_Buffer_Local_ XSETSYMBOL (var, symbol); if (blv->frame_local) { - tem1 = assq_no_quit (var, XFRAME (selected_frame)->param_alist); + tem1 = assq_no_quit (var, FVAR (XFRAME (selected_frame), param_alist)); blv->where = selected_frame; } else @@ -1179,7 +1179,7 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register XSETSYMBOL (symbol, sym); /* May have changed via aliasing. */ tem1 = Fassq (symbol, (blv->frame_local - ? XFRAME (where)->param_alist + ? FVAR (XFRAME (where), param_alist) : BVAR (XBUFFER (where), local_var_alist))); blv->where = where; blv->found = 1; diff --git a/src/dispnew.c b/src/dispnew.c index c149baec507..af3e0981d5c 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -841,12 +841,12 @@ clear_current_matrices (register struct frame *f) /* Clear the matrix of the menu bar window, if such a window exists. The menu bar window is currently used to display menus on X when no toolkit support is compiled in. */ - if (WINDOWP (f->menu_bar_window)) - clear_glyph_matrix (XWINDOW (f->menu_bar_window)->current_matrix); + if (WINDOWP (FVAR (f, menu_bar_window))) + clear_glyph_matrix (XWINDOW (FVAR (f, menu_bar_window))->current_matrix); /* Clear the matrix of the tool-bar window, if any. */ - if (WINDOWP (f->tool_bar_window)) - clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix); + if (WINDOWP (FVAR (f, tool_bar_window))) + clear_glyph_matrix (XWINDOW (FVAR (f, tool_bar_window))->current_matrix); /* Clear current window matrices. */ eassert (WINDOWP (FRAME_ROOT_WINDOW (f))); @@ -862,11 +862,11 @@ clear_desired_matrices (register struct frame *f) if (f->desired_matrix) clear_glyph_matrix (f->desired_matrix); - if (WINDOWP (f->menu_bar_window)) - clear_glyph_matrix (XWINDOW (f->menu_bar_window)->desired_matrix); + if (WINDOWP (FVAR (f, menu_bar_window))) + clear_glyph_matrix (XWINDOW (FVAR (f, menu_bar_window))->desired_matrix); - if (WINDOWP (f->tool_bar_window)) - clear_glyph_matrix (XWINDOW (f->tool_bar_window)->desired_matrix); + if (WINDOWP (FVAR (f, tool_bar_window))) + clear_glyph_matrix (XWINDOW (FVAR (f, tool_bar_window))->desired_matrix); /* Do it for window matrices. */ eassert (WINDOWP (FRAME_ROOT_WINDOW (f))); @@ -1901,7 +1901,7 @@ static void adjust_frame_glyphs_initially (void) { struct frame *sf = SELECTED_FRAME (); - struct window *root = XWINDOW (sf->root_window); + struct window *root = XWINDOW (FVAR (sf, root_window)); struct window *mini = XWINDOW (root->next); int frame_lines = FRAME_LINES (sf); int frame_cols = FRAME_COLS (sf); @@ -2184,15 +2184,15 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f) { /* Allocate a dummy window if not already done. */ struct window *w; - if (NILP (f->menu_bar_window)) + if (NILP (FVAR (f, menu_bar_window))) { - f->menu_bar_window = make_window (); - w = XWINDOW (f->menu_bar_window); + FVAR (f, menu_bar_window) = make_window (); + w = XWINDOW (FVAR (f, menu_bar_window)); XSETFRAME (w->frame, f); w->pseudo_window_p = 1; } else - w = XWINDOW (f->menu_bar_window); + w = XWINDOW (FVAR (f, menu_bar_window)); /* Set window dimensions to frame dimensions and allocate or adjust glyph matrices of W. */ @@ -2210,15 +2210,15 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f) /* Allocate/ reallocate matrices of the tool bar window. If we don't have a tool bar window yet, make one. */ struct window *w; - if (NILP (f->tool_bar_window)) + if (NILP (FVAR (f, tool_bar_window))) { - f->tool_bar_window = make_window (); - w = XWINDOW (f->tool_bar_window); + FVAR (f, tool_bar_window) = make_window (); + w = XWINDOW (FVAR (f, tool_bar_window)); XSETFRAME (w->frame, f); w->pseudo_window_p = 1; } else - w = XWINDOW (f->tool_bar_window); + w = XWINDOW (FVAR (f, tool_bar_window)); XSETFASTINT (w->top_line, FRAME_MENU_BAR_LINES (f)); XSETFASTINT (w->left_col, 0); @@ -2278,28 +2278,28 @@ free_glyphs (struct frame *f) f->glyphs_initialized_p = 0; /* Release window sub-matrices. */ - if (!NILP (f->root_window)) - free_window_matrices (XWINDOW (f->root_window)); + if (!NILP (FVAR (f, root_window))) + free_window_matrices (XWINDOW (FVAR (f, root_window))); /* Free the dummy window for menu bars without X toolkit and its glyph matrices. */ - if (!NILP (f->menu_bar_window)) + if (!NILP (FVAR (f, menu_bar_window))) { - struct window *w = XWINDOW (f->menu_bar_window); + struct window *w = XWINDOW (FVAR (f, menu_bar_window)); free_glyph_matrix (w->desired_matrix); free_glyph_matrix (w->current_matrix); w->desired_matrix = w->current_matrix = NULL; - f->menu_bar_window = Qnil; + FVAR (f, menu_bar_window) = Qnil; } /* Free the tool bar window and its glyph matrices. */ - if (!NILP (f->tool_bar_window)) + if (!NILP (FVAR (f, tool_bar_window))) { - struct window *w = XWINDOW (f->tool_bar_window); + struct window *w = XWINDOW (FVAR (f, tool_bar_window)); free_glyph_matrix (w->desired_matrix); free_glyph_matrix (w->current_matrix); w->desired_matrix = w->current_matrix = NULL; - f->tool_bar_window = Qnil; + FVAR (f, tool_bar_window) = Qnil; } /* Release frame glyph matrices. Reset fields to zero in @@ -2722,7 +2722,7 @@ make_current (struct glyph_matrix *desired_matrix, struct glyph_matrix *current_ /* If we are called on frame matrices, perform analogous operations for window matrices. */ if (frame_matrix_frame) - mirror_make_current (XWINDOW (frame_matrix_frame->root_window), row); + mirror_make_current (XWINDOW (FVAR (frame_matrix_frame, root_window)), row); } @@ -2820,7 +2820,7 @@ mirrored_line_dance (struct glyph_matrix *matrix, int unchanged_at_top, int nlin /* Do the same for window matrices, if MATRIX is a frame matrix. */ if (frame_matrix_frame) - mirror_line_dance (XWINDOW (frame_matrix_frame->root_window), + mirror_line_dance (XWINDOW (FVAR (frame_matrix_frame, root_window)), unchanged_at_top, nlines, copy_from, retained_p); } @@ -3183,7 +3183,7 @@ update_frame (struct frame *f, int force_p, int inhibit_hairy_id_p) { /* 1 means display has been paused because of pending input. */ int paused_p; - struct window *root_window = XWINDOW (f->root_window); + struct window *root_window = XWINDOW (FVAR (f, root_window)); if (redisplay_dont_pause) force_p = 1; @@ -3218,13 +3218,13 @@ update_frame (struct frame *f, int force_p, int inhibit_hairy_id_p) /* Update the menu bar on X frames that don't have toolkit support. */ - if (WINDOWP (f->menu_bar_window)) - update_window (XWINDOW (f->menu_bar_window), 1); + if (WINDOWP (FVAR (f, menu_bar_window))) + update_window (XWINDOW (FVAR (f, menu_bar_window)), 1); /* Update the tool-bar window, if present. */ - if (WINDOWP (f->tool_bar_window)) + if (WINDOWP (FVAR (f, tool_bar_window))) { - struct window *w = XWINDOW (f->tool_bar_window); + struct window *w = XWINDOW (FVAR (f, tool_bar_window)); /* Update tool-bar window. */ if (w->must_be_updated_p) @@ -3236,9 +3236,10 @@ update_frame (struct frame *f, int force_p, int inhibit_hairy_id_p) /* Swap tool-bar strings. We swap because we want to reuse strings. */ - tem = f->current_tool_bar_string; - f->current_tool_bar_string = f->desired_tool_bar_string; - f->desired_tool_bar_string = tem; + tem = FVAR (f, current_tool_bar_string); + FVAR (f, current_tool_bar_string) = FVAR (f, + desired_tool_bar_string); + FVAR (f, desired_tool_bar_string) = tem; } } @@ -5759,8 +5760,8 @@ change_frame_size_1 (register struct frame *f, int newheight, int newwidth, int if ((FRAME_TERMCAP_P (f) && !pretend) || FRAME_MSDOS_P (f)) FrameCols (FRAME_TTY (f)) = newwidth; - if (WINDOWP (f->tool_bar_window)) - XSETFASTINT (XWINDOW (f->tool_bar_window)->total_cols, newwidth); + if (WINDOWP (FVAR (f, tool_bar_window))) + XSETFASTINT (XWINDOW (FVAR (f, tool_bar_window))->total_cols, newwidth); } FRAME_LINES (f) = newheight; @@ -6084,7 +6085,7 @@ pass nil for VARIABLE. */) goto changed; if (vecp == end) goto changed; - if (!EQ (*vecp++, XFRAME (frame)->name)) + if (!EQ (*vecp++, FVAR (XFRAME (frame), name))) goto changed; } /* Check that the buffer info matches. */ @@ -6141,7 +6142,7 @@ pass nil for VARIABLE. */) FOR_EACH_FRAME (tail, frame) { *vecp++ = frame; - *vecp++ = XFRAME (frame)->name; + *vecp++ = FVAR (XFRAME (frame), name); } for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail)) { diff --git a/src/dosfns.c b/src/dosfns.c index 6fd1b52e252..162a98382cb 100644 --- a/src/dosfns.c +++ b/src/dosfns.c @@ -468,15 +468,15 @@ void x_set_title (struct frame *f, Lisp_Object name) { /* Don't change the title if it's already NAME. */ - if (EQ (name, f->title)) + if (EQ (name, FVAR (f, title))) return; update_mode_lines = 1; - f->title = name; + FVAR (f, title) = name; if (NILP (name)) - name = f->name; + name = FVAR (f, name); if (FRAME_MSDOS_P (f)) { diff --git a/src/eval.c b/src/eval.c index e6cd4e8dc27..391058d12c6 100644 --- a/src/eval.c +++ b/src/eval.c @@ -3254,7 +3254,7 @@ unbind_to (ptrdiff_t count, Lisp_Object value) local binding, but only if that binding still exists. */ else if (BUFFERP (where) ? !NILP (Flocal_variable_p (symbol, where)) - : !NILP (Fassq (symbol, XFRAME (where)->param_alist))) + : !NILP (Fassq (symbol, FVAR (XFRAME (where), param_alist)))) set_internal (symbol, this_binding.old_value, where, 1); } /* If variable has a trivial value (no forwarding), we can diff --git a/src/frame.c b/src/frame.c index 07783bd8c07..9a1628e4ade 100644 --- a/src/frame.c +++ b/src/frame.c @@ -170,7 +170,7 @@ set_menu_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) windows_or_buffers_changed++; FRAME_WINDOW_SIZES_CHANGED (f) = 1; FRAME_MENU_BAR_LINES (f) = nlines; - set_menu_bar_lines_1 (f->root_window, nlines - olines); + set_menu_bar_lines_1 (FVAR (f, root_window), nlines - olines); adjust_glyphs (f); } } @@ -269,7 +269,7 @@ make_frame (int mini_p) /* Initialize Lisp data. Note that allocate_frame initializes all Lisp data to nil, so do it only for slots which should not be nil. */ - f->tool_bar_position = Qtop; + FVAR (f, tool_bar_position) = Qtop; /* Initialize non-Lisp data. Note that allocate_frame zeroes out all non-Lisp data, so do it only for slots which should not be zero. @@ -293,13 +293,13 @@ make_frame (int mini_p) XWINDOW (mini_window)->prev = root_window; XWINDOW (mini_window)->mini = 1; XWINDOW (mini_window)->frame = frame; - f->minibuffer_window = mini_window; + FVAR (f, minibuffer_window) = mini_window; } else { mini_window = Qnil; XWINDOW (root_window)->next = Qnil; - f->minibuffer_window = Qnil; + FVAR (f, minibuffer_window) = Qnil; } XWINDOW (root_window)->frame = frame; @@ -339,7 +339,7 @@ make_frame (int mini_p) etc. Running Lisp functions at this point surely ends in a SEGV. */ set_window_buffer (root_window, buf, 0, 0); - f->buffer_list = Fcons (buf, Qnil); + FVAR (f, buffer_list) = Fcons (buf, Qnil); } if (mini_p) @@ -352,11 +352,11 @@ make_frame (int mini_p) 0, 0); } - f->root_window = root_window; - f->selected_window = root_window; + FVAR (f, root_window) = root_window; + FVAR (f, selected_window) = root_window; /* Make sure this window seems more recently used than a newly-created, never-selected window. */ - XWINDOW (f->selected_window)->use_time = ++window_select_count; + XWINDOW (FVAR (f, selected_window))->use_time = ++window_select_count; return f; } @@ -398,10 +398,11 @@ make_frame_without_minibuffer (register Lisp_Object mini_window, KBOARD *kb, Lis UNGCPRO; } - mini_window = XFRAME (KVAR (kb, Vdefault_minibuffer_frame))->minibuffer_window; + mini_window = FVAR (XFRAME (KVAR (kb, Vdefault_minibuffer_frame)), + minibuffer_window); } - f->minibuffer_window = mini_window; + FVAR (f, minibuffer_window) = mini_window; /* Make the chosen minibuffer window display the proper minibuffer, unless it is already showing a minibuffer. */ @@ -436,7 +437,7 @@ make_minibuffer_frame (void) Avoid infinite looping on the window chain by marking next pointer as nil. */ - mini_window = f->minibuffer_window = f->root_window; + 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; @@ -477,7 +478,7 @@ make_initial_frame (void) Vframe_list = Fcons (frame, Vframe_list); tty_frame_count = 1; - f->name = build_pure_c_string ("F1"); + FVAR (f, name) = build_pure_c_string ("F1"); f->visible = 1; f->async_visible = 1; @@ -518,7 +519,7 @@ make_terminal_frame (struct terminal *terminal) XSETFRAME (frame, f); Vframe_list = Fcons (frame, Vframe_list); - f->name = make_formatted_string (name, "F%"pMd, ++tty_frame_count); + FVAR (f, name) = make_formatted_string (name, "F%"pMd, ++tty_frame_count); f->visible = 1; /* FRAME_SET_VISIBLE wd set frame_garbaged. */ f->async_visible = 1; /* Don't let visible be cleared later. */ @@ -569,7 +570,7 @@ get_future_frame_param (Lisp_Object parameter, result = Fassq (parameter, supplied_parms); if (NILP (result)) - result = Fassq (parameter, XFRAME (selected_frame)->param_alist); + result = Fassq (parameter, FVAR (XFRAME (selected_frame), param_alist)); if (NILP (result) && current_value != NULL) result = build_string (current_value); if (!NILP (result) && !STRINGP (result)) @@ -688,11 +689,11 @@ affects all frames on the same terminal device. */) /* Make the frame face alist be frame-specific, so that each frame could change its face definitions independently. */ - f->face_alist = Fcopy_alist (sf->face_alist); + FVAR (f, face_alist) = Fcopy_alist (FVAR (sf, face_alist)); /* Simple Fcopy_alist isn't enough, because we need the contents of the vectors which are the CDRs of associations in face_alist to be copied as well. */ - for (tem = f->face_alist; CONSP (tem); tem = XCDR (tem)) + for (tem = FVAR (f, face_alist); CONSP (tem); tem = XCDR (tem)) XSETCDR (XCAR (tem), Fcopy_sequence (XCDR (XCAR (tem)))); return frame; } @@ -796,7 +797,7 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor if (! FRAME_MINIBUF_ONLY_P (XFRAME (selected_frame))) last_nonminibuf_frame = XFRAME (selected_frame); - Fselect_window (XFRAME (frame)->selected_window, norecord); + Fselect_window (FVAR (XFRAME (frame), selected_window), norecord); /* We want to make sure that the next event generates a frame-switch event to the appropriate frame. This seems kludgy to me, but @@ -1237,11 +1238,11 @@ delete_frame (Lisp_Object frame, Lisp_Object force) } /* Don't allow minibuf_window to remain on a deleted frame. */ - if (EQ (f->minibuffer_window, minibuf_window)) + if (EQ (FVAR (f, minibuffer_window), minibuf_window)) { - Fset_window_buffer (sf->minibuffer_window, + Fset_window_buffer (FVAR (sf, minibuffer_window), XWINDOW (minibuf_window)->buffer, Qnil); - minibuf_window = sf->minibuffer_window; + minibuf_window = FVAR (sf, minibuffer_window); /* If the dying minibuffer window was selected, select the new one. */ @@ -1250,8 +1251,8 @@ delete_frame (Lisp_Object frame, Lisp_Object force) } /* Don't let echo_area_window to remain on a deleted frame. */ - if (EQ (f->minibuffer_window, echo_area_window)) - echo_area_window = sf->minibuffer_window; + if (EQ (FVAR (f, minibuffer_window), echo_area_window)) + echo_area_window = FVAR (sf, minibuffer_window); /* Clear any X selections for this frame. */ #ifdef HAVE_X_WINDOWS @@ -1272,8 +1273,8 @@ delete_frame (Lisp_Object frame, Lisp_Object force) /* Mark all the windows that used to be on FRAME as deleted, and then remove the reference to them. */ - delete_all_child_windows (f->root_window); - f->root_window = Qnil; + delete_all_child_windows (FVAR (f, root_window)); + FVAR (f, root_window) = Qnil; Vframe_list = Fdelq (frame, Vframe_list); FRAME_SET_VISIBLE (f, 0); @@ -1282,7 +1283,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) garbage collection. The frame object itself may not be garbage collected until much later, because recent_keys and other data structures can still refer to it. */ - f->menu_bar_vector = Qnil; + FVAR (f, menu_bar_vector) = Qnil; free_font_driver_list (f); xfree (f->namebuf); @@ -1655,7 +1656,7 @@ If omitted, FRAME defaults to the currently selected frame. */) } #endif - make_frame_visible_1 (XFRAME (frame)->root_window); + make_frame_visible_1 (FVAR (XFRAME (frame), root_window)); /* Make menu bar update for the Buffers and Frames menus. */ windows_or_buffers_changed++; @@ -1709,12 +1710,12 @@ displayed in the terminal. */) error ("Attempt to make invisible the sole visible or iconified frame"); /* Don't allow minibuf_window to remain on a deleted frame. */ - if (EQ (XFRAME (frame)->minibuffer_window, minibuf_window)) + if (EQ (FVAR (XFRAME (frame), minibuffer_window), minibuf_window)) { struct frame *sf = XFRAME (selected_frame); - Fset_window_buffer (sf->minibuffer_window, + Fset_window_buffer (FVAR (sf, minibuffer_window), XWINDOW (minibuf_window)->buffer, Qnil); - minibuf_window = sf->minibuffer_window; + minibuf_window = FVAR (sf, minibuffer_window); } /* I think this should be done with a hook. */ @@ -1747,12 +1748,12 @@ If omitted, FRAME defaults to the currently selected frame. */) #endif /* Don't allow minibuf_window to remain on a deleted frame. */ - if (EQ (XFRAME (frame)->minibuffer_window, minibuf_window)) + if (EQ (FVAR (XFRAME (frame), minibuffer_window), minibuf_window)) { struct frame *sf = XFRAME (selected_frame); - Fset_window_buffer (sf->minibuffer_window, + Fset_window_buffer (FVAR (sf, minibuffer_window), XWINDOW (minibuf_window)->buffer, Qnil); - minibuf_window = sf->minibuffer_window; + minibuf_window = FVAR (sf, minibuffer_window); } /* I think this should be done with a hook. */ @@ -1906,7 +1907,7 @@ The redirection lasts until `redirect-frame-focus' is called to change it. */) f = XFRAME (frame); - f->focus_frame = focus_frame; + FVAR (f, focus_frame) = focus_frame; if (FRAME_TERMINAL (f)->frame_rehighlight_hook) (*FRAME_TERMINAL (f)->frame_rehighlight_hook) (f); @@ -1939,7 +1940,7 @@ get_frame_param (register struct frame *frame, Lisp_Object prop) { register Lisp_Object tem; - tem = Fassq (prop, frame->param_alist); + tem = Fassq (prop, FVAR (frame, param_alist)); if (EQ (tem, Qnil)) return tem; return Fcdr (tem); @@ -1951,7 +1952,7 @@ get_frame_param (register struct frame *frame, Lisp_Object prop) Lisp_Object frame_buffer_predicate (Lisp_Object frame) { - return XFRAME (frame)->buffer_predicate; + return FVAR (XFRAME (frame), buffer_predicate); } /* Return the buffer-list of the selected frame. */ @@ -1959,7 +1960,7 @@ frame_buffer_predicate (Lisp_Object frame) static Lisp_Object frame_buffer_list (Lisp_Object frame) { - return XFRAME (frame)->buffer_list; + return FVAR (XFRAME (frame), buffer_list); } /* Discard BUFFER from the buffer-list and buried-buffer-list of each frame. */ @@ -1971,10 +1972,10 @@ frames_discard_buffer (Lisp_Object buffer) FOR_EACH_FRAME (tail, frame) { - XFRAME (frame)->buffer_list - = Fdelq (buffer, XFRAME (frame)->buffer_list); - XFRAME (frame)->buried_buffer_list - = Fdelq (buffer, XFRAME (frame)->buried_buffer_list); + FVAR (XFRAME (frame), buffer_list) + = Fdelq (buffer, FVAR (XFRAME (frame), buffer_list)); + FVAR (XFRAME (frame), buried_buffer_list) + = Fdelq (buffer, FVAR (XFRAME (frame), buried_buffer_list)); } } @@ -2022,8 +2023,8 @@ set_term_frame_name (struct frame *f, Lisp_Object name) /* Check for no change needed in this very common case before we do any consing. */ - if (frame_name_fnn_p (SSDATA (f->name), - SBYTES (f->name))) + if (frame_name_fnn_p (SSDATA (FVAR (f, name)), + SBYTES (FVAR (f, name)))) return; name = make_formatted_string (namebuf, "F%"pMd, ++tty_frame_count); @@ -2033,7 +2034,7 @@ set_term_frame_name (struct frame *f, Lisp_Object name) CHECK_STRING (name); /* Don't change the name if it's already NAME. */ - if (! NILP (Fstring_equal (name, f->name))) + if (! NILP (Fstring_equal (name, FVAR (f, name)))) return; /* Don't allow the user to set the frame name to F<num>, so it @@ -2042,7 +2043,7 @@ set_term_frame_name (struct frame *f, Lisp_Object name) error ("Frame names of the form F<num> are usurped by Emacs"); } - f->name = name; + FVAR (f, name) = name; update_mode_lines = 1; } @@ -2059,7 +2060,7 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val) for (; CONSP (val); val = XCDR (val)) if (!NILP (Fbuffer_live_p (XCAR (val)))) list = Fcons (XCAR (val), list); - f->buffer_list = Fnreverse (list); + FVAR (f, buffer_list) = Fnreverse (list); return; } if (EQ (prop, Qburied_buffer_list)) @@ -2068,7 +2069,7 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val) for (; CONSP (val); val = XCDR (val)) if (!NILP (Fbuffer_live_p (XCAR (val)))) list = Fcons (XCAR (val), list); - f->buried_buffer_list = Fnreverse (list); + FVAR (f, buried_buffer_list) = Fnreverse (list); return; } @@ -2103,9 +2104,9 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val) FRAME_TTY (f)->previous_frame = NULL; /* Update the frame parameter alist. */ - old_alist_elt = Fassq (prop, f->param_alist); + old_alist_elt = Fassq (prop, FVAR (f, param_alist)); if (EQ (old_alist_elt, Qnil)) - f->param_alist = Fcons (Fcons (prop, val), f->param_alist); + FVAR (f, param_alist) = Fcons (Fcons (prop, val), FVAR (f, param_alist)); else Fsetcdr (old_alist_elt, val); @@ -2113,7 +2114,7 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val) in addition to the alist. */ if (EQ (prop, Qbuffer_predicate)) - f->buffer_predicate = val; + FVAR (f, buffer_predicate) = val; if (! FRAME_WINDOW_P (f)) { @@ -2129,11 +2130,11 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val) error ("Surrogate minibuffer windows must be minibuffer windows"); if ((FRAME_HAS_MINIBUF_P (f) || FRAME_MINIBUF_ONLY_P (f)) - && !EQ (val, f->minibuffer_window)) + && !EQ (val, FVAR (f, minibuffer_window))) error ("Can't change the surrogate minibuffer of a frame with its own minibuffer"); /* Install the chosen minibuffer window, with proper buffer. */ - f->minibuffer_window = val; + FVAR (f, minibuffer_window) = val; } } @@ -2158,7 +2159,7 @@ If FRAME is omitted, return information on the currently selected frame. */) if (!FRAME_LIVE_P (f)) return Qnil; - alist = Fcopy_alist (f->param_alist); + alist = Fcopy_alist (FVAR (f, param_alist)); GCPRO1 (alist); if (!FRAME_WINDOW_P (f)) @@ -2204,7 +2205,7 @@ If FRAME is omitted, return information on the currently selected frame. */) : FRAME_W32_P (f) ? "w32term" :"tty")); } - store_in_alist (&alist, Qname, f->name); + store_in_alist (&alist, Qname, FVAR (f, name)); height = (f->new_text_lines ? f->new_text_lines : FRAME_LINES (f)); store_in_alist (&alist, Qheight, make_number (height)); width = (f->new_text_cols ? f->new_text_cols : FRAME_COLS (f)); @@ -2216,7 +2217,8 @@ If FRAME is omitted, return information on the currently selected frame. */) : FRAME_MINIBUF_WINDOW (f))); store_in_alist (&alist, Qunsplittable, (FRAME_NO_SPLIT_P (f) ? Qt : Qnil)); store_in_alist (&alist, Qbuffer_list, frame_buffer_list (frame)); - store_in_alist (&alist, Qburied_buffer_list, XFRAME (frame)->buried_buffer_list); + store_in_alist (&alist, Qburied_buffer_list, + FVAR (XFRAME (frame), buried_buffer_list)); /* I think this should be done with a hook. */ #ifdef HAVE_WINDOW_SYSTEM @@ -2257,7 +2259,7 @@ If FRAME is nil, describe the currently selected frame. */) { /* Avoid consing in frequent cases. */ if (EQ (parameter, Qname)) - value = f->name; + value = FVAR (f, name); #ifdef HAVE_X_WINDOWS else if (EQ (parameter, Qdisplay) && FRAME_X_P (f)) value = XCAR (FRAME_X_DISPLAY_INFO (f)->name_list_element); @@ -2265,7 +2267,7 @@ If FRAME is nil, describe the currently selected frame. */) else if (EQ (parameter, Qbackground_color) || EQ (parameter, Qforeground_color)) { - value = Fassq (parameter, f->param_alist); + value = Fassq (parameter, FVAR (f, param_alist)); if (CONSP (value)) { value = XCDR (value); @@ -2303,7 +2305,7 @@ If FRAME is nil, describe the currently selected frame. */) } else if (EQ (parameter, Qdisplay_type) || EQ (parameter, Qbackground_mode)) - value = Fcdr (Fassq (parameter, f->param_alist)); + value = Fcdr (Fassq (parameter, FVAR (f, param_alist))); else /* FIXME: Avoid this code path at all (as well as code duplication) by sharing more code with Fframe_parameters. */ @@ -2889,14 +2891,14 @@ x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist) if (! TYPE_RANGED_INTEGERP (int, icon_left)) { icon_left_no_change = 1; - icon_left = Fcdr (Fassq (Qicon_left, f->param_alist)); + icon_left = Fcdr (Fassq (Qicon_left, FVAR (f, param_alist))); if (NILP (icon_left)) XSETINT (icon_left, 0); } if (! TYPE_RANGED_INTEGERP (int, icon_top)) { icon_top_no_change = 1; - icon_top = Fcdr (Fassq (Qicon_top, f->param_alist)); + icon_top = Fcdr (Fassq (Qicon_top, FVAR (f, param_alist))); if (NILP (icon_top)) XSETINT (icon_top, 0); } @@ -3056,7 +3058,7 @@ x_report_frame_params (struct frame *f, Lisp_Object *alistptr) store_in_alist (alistptr, Qouter_window_id, make_formatted_string (buf, "%lu", w)); #endif - store_in_alist (alistptr, Qicon_name, f->icon_name); + store_in_alist (alistptr, Qicon_name, FVAR (f, icon_name)); FRAME_SAMPLE_VISIBILITY (f); store_in_alist (alistptr, Qvisibility, (FRAME_VISIBLE_P (f) ? Qt @@ -3070,7 +3072,7 @@ x_report_frame_params (struct frame *f, Lisp_Object *alistptr) XSETFASTINT (tem, FRAME_X_OUTPUT (f)->parent_desc); store_in_alist (alistptr, Qexplicit_name, (f->explicit_name ? Qt : Qnil)); store_in_alist (alistptr, Qparent_id, tem); - store_in_alist (alistptr, Qtool_bar_position, f->tool_bar_position); + store_in_alist (alistptr, Qtool_bar_position, FVAR (f, tool_bar_position)); } @@ -3130,7 +3132,7 @@ x_set_screen_gamma (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu signal_error ("Invalid screen-gamma", new_value); /* Apply the new gamma value to the frame background. */ - bgcolor = Fassq (Qbackground_color, f->param_alist); + bgcolor = Fassq (Qbackground_color, FVAR (f, param_alist)); if (CONSP (bgcolor) && (bgcolor = XCDR (bgcolor), STRINGP (bgcolor))) { Lisp_Object parm_index = Fget (Qbackground_color, Qx_frame_parameter); @@ -3459,7 +3461,7 @@ x_icon_type (FRAME_PTR f) { Lisp_Object tem; - tem = assq_no_quit (Qicon_type, f->param_alist); + tem = assq_no_quit (Qicon_type, FVAR (f, param_alist)); if (CONSP (tem)) return XCDR (tem); else diff --git a/src/frame.h b/src/frame.h index 1a8bff7c3e7..1a1f8873348 100644 --- a/src/frame.h +++ b/src/frame.h @@ -80,6 +80,10 @@ struct terminal; struct font_driver_list; +/* Most code should use this macro to access Lisp fields in struct frame. */ + +#define FVAR(frame, field) ((frame)->INTERNAL_FIELD (field)) + struct frame { struct vectorlike_header header; @@ -89,15 +93,15 @@ struct frame /* Name of this frame: a Lisp string. It is used for looking up resources, as well as for the title in some cases. */ - Lisp_Object name; + Lisp_Object INTERNAL_FIELD (name); /* The name to use for the icon, the last time it was refreshed. nil means not explicitly specified. */ - Lisp_Object icon_name; + Lisp_Object INTERNAL_FIELD (icon_name); /* This is the frame title specified explicitly, if any. Usually it is nil. */ - Lisp_Object title; + Lisp_Object INTERNAL_FIELD (title); /* The frame which should receive keystrokes that occur in this frame, or nil if they should go to the frame itself. This is @@ -110,29 +114,29 @@ struct frame to shift from one frame to the other, any redirections to the original frame are shifted to the newly selected frame; if focus_frame is nil, Fselect_frame will leave it alone. */ - Lisp_Object focus_frame; + Lisp_Object INTERNAL_FIELD (focus_frame); /* This frame's root window. Every frame has one. If the frame has only a minibuffer window, this is it. Otherwise, if the frame has a minibuffer window, this is its sibling. */ - Lisp_Object root_window; + Lisp_Object INTERNAL_FIELD (root_window); /* This frame's selected window. Each frame has its own window hierarchy and one of the windows in it is selected within the frame. The selected window of the selected frame is Emacs's selected window. */ - Lisp_Object selected_window; + Lisp_Object INTERNAL_FIELD (selected_window); /* This frame's minibuffer window. Most frames have their own minibuffer windows, but only the selected frame's minibuffer window can actually appear to exist. */ - Lisp_Object minibuffer_window; + Lisp_Object INTERNAL_FIELD (minibuffer_window); /* Parameter alist of this frame. These are the parameters specified when creating the frame or modified with modify-frame-parameters. */ - Lisp_Object param_alist; + Lisp_Object INTERNAL_FIELD (param_alist); /* List of scroll bars on this frame. Actually, we don't specify exactly what is stored here at all; the @@ -141,50 +145,51 @@ struct frame instead of in the `device' structure so that the garbage collector doesn't need to look inside the window-system-dependent structure. */ - Lisp_Object scroll_bars; - Lisp_Object condemned_scroll_bars; + Lisp_Object INTERNAL_FIELD (scroll_bars); + Lisp_Object INTERNAL_FIELD (condemned_scroll_bars); /* Vector describing the items to display in the menu bar. Each item has four elements in this vector. They are KEY, STRING, SUBMAP, and HPOS. (HPOS is not used in when the X toolkit is in use.) There are four additional elements of nil at the end, to terminate. */ - Lisp_Object menu_bar_items; + Lisp_Object INTERNAL_FIELD (menu_bar_items); /* Alist of elements (FACE-NAME . FACE-VECTOR-DATA). */ - Lisp_Object face_alist; + Lisp_Object INTERNAL_FIELD (face_alist); /* A vector that records the entire structure of this frame's menu bar. For the format of the data, see extensive comments in xmenu.c. Only the X toolkit version uses this. */ - Lisp_Object menu_bar_vector; + Lisp_Object INTERNAL_FIELD (menu_bar_vector); /* Predicate for selecting buffers for other-buffer. */ - Lisp_Object buffer_predicate; + Lisp_Object INTERNAL_FIELD (buffer_predicate); /* List of buffers viewed in this frame, for other-buffer. */ - Lisp_Object buffer_list; + Lisp_Object INTERNAL_FIELD (buffer_list); /* List of buffers that were viewed, then buried in this frame. The most recently buried buffer is first. For last-buffer. */ - Lisp_Object buried_buffer_list; + Lisp_Object INTERNAL_FIELD (buried_buffer_list); /* A dummy window used to display menu bars under X when no X toolkit support is available. */ - Lisp_Object menu_bar_window; + Lisp_Object INTERNAL_FIELD (menu_bar_window); /* A window used to display the tool-bar of a frame. */ - Lisp_Object tool_bar_window; + Lisp_Object INTERNAL_FIELD (tool_bar_window); /* Desired and current tool-bar items. */ - Lisp_Object tool_bar_items; + Lisp_Object INTERNAL_FIELD (tool_bar_items); /* Where tool bar is, can be left, right, top or bottom. The native tool bar only supports top. */ - Lisp_Object tool_bar_position; + Lisp_Object INTERNAL_FIELD (tool_bar_position); /* Desired and current contents displayed in tool_bar_window. */ - Lisp_Object desired_tool_bar_string, current_tool_bar_string; + Lisp_Object INTERNAL_FIELD (desired_tool_bar_string); + Lisp_Object INTERNAL_FIELD (current_tool_bar_string); /* Beyond here, there should be no more Lisp_Object components. */ @@ -635,13 +640,13 @@ typedef struct frame *FRAME_PTR; #define FRAME_WINDOW_SIZES_CHANGED(f) (f)->window_sizes_changed /* The minibuffer window of frame F, if it has one; otherwise nil. */ -#define FRAME_MINIBUF_WINDOW(f) (f)->minibuffer_window +#define FRAME_MINIBUF_WINDOW(f) FVAR (f, minibuffer_window) /* The root window of the window tree of frame F. */ -#define FRAME_ROOT_WINDOW(f) (f)->root_window +#define FRAME_ROOT_WINDOW(f) FVAR (f, root_window) /* The currently selected window of the window tree of frame F. */ -#define FRAME_SELECTED_WINDOW(f) (f)->selected_window +#define FRAME_SELECTED_WINDOW(f) FVAR (f, selected_window) #define FRAME_INSERT_COST(f) (f)->insert_line_cost #define FRAME_DELETE_COST(f) (f)->delete_line_cost @@ -649,7 +654,7 @@ typedef struct frame *FRAME_PTR; #define FRAME_DELETEN_COST(f) (f)->delete_n_lines_cost #define FRAME_MESSAGE_BUF(f) (f)->message_buf #define FRAME_SCROLL_BOTTOM_VPOS(f) (f)->scroll_bottom_vpos -#define FRAME_FOCUS_FRAME(f) (f)->focus_frame +#define FRAME_FOCUS_FRAME(f) FVAR (f, focus_frame) /* Nonzero if frame F supports scroll bars. If this is zero, then it is impossible to enable scroll bars @@ -750,10 +755,10 @@ typedef struct frame *FRAME_PTR; /* Nonzero if frame F has scroll bars. */ -#define FRAME_SCROLL_BARS(f) ((f)->scroll_bars) +#define FRAME_SCROLL_BARS(f) (FVAR (f, scroll_bars)) -#define FRAME_CONDEMNED_SCROLL_BARS(f) ((f)->condemned_scroll_bars) -#define FRAME_MENU_BAR_ITEMS(f) ((f)->menu_bar_items) +#define FRAME_CONDEMNED_SCROLL_BARS(f) (FVAR (f, condemned_scroll_bars)) +#define FRAME_MENU_BAR_ITEMS(f) (FVAR (f, menu_bar_items)) #define FRAME_COST_BAUD_RATE(f) ((f)->cost_calculation_baud_rate) #define FRAME_DESIRED_CURSOR(f) ((f)->desired_cursor) diff --git a/src/fringe.c b/src/fringe.c index 97d03a2bfae..8ee4ae7bf1e 100644 --- a/src/fringe.c +++ b/src/fringe.c @@ -1338,8 +1338,8 @@ compute_fringe_widths (struct frame *f, int redraw) int o_right = FRAME_RIGHT_FRINGE_WIDTH (f); int o_cols = FRAME_FRINGE_COLS (f); - Lisp_Object left_fringe = Fassq (Qleft_fringe, f->param_alist); - Lisp_Object right_fringe = Fassq (Qright_fringe, f->param_alist); + Lisp_Object left_fringe = Fassq (Qleft_fringe, FVAR (f, param_alist)); + Lisp_Object right_fringe = Fassq (Qright_fringe, FVAR (f, param_alist)); int left_fringe_width, right_fringe_width; if (!NILP (left_fringe)) diff --git a/src/gtkutil.c b/src/gtkutil.c index d81f63a6808..aca5d65f0e3 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -1148,8 +1148,10 @@ xg_create_frame_widgets (FRAME_PTR f) gtk_widget_set_name (wfixed, SSDATA (Vx_resource_name)); /* If this frame has a title or name, set it in the title bar. */ - if (! NILP (f->title)) title = SSDATA (ENCODE_UTF_8 (f->title)); - else if (! NILP (f->name)) title = SSDATA (ENCODE_UTF_8 (f->name)); + if (! NILP (FVAR (f, title))) + title = SSDATA (ENCODE_UTF_8 (FVAR (f, title))); + else if (! NILP (FVAR (f, name))) + title = SSDATA (ENCODE_UTF_8 (FVAR (f, name))); if (title) gtk_window_set_title (GTK_WINDOW (wtop), title); @@ -2059,7 +2061,7 @@ make_cl_data (xg_menu_cb_data *cl_data, FRAME_PTR f, GCallback highlight_cb) { cl_data = xmalloc (sizeof *cl_data); cl_data->f = f; - cl_data->menu_bar_vector = f->menu_bar_vector; + cl_data->menu_bar_vector = FVAR (f, menu_bar_vector); cl_data->menu_bar_items_used = f->menu_bar_items_used; cl_data->highlight_cb = highlight_cb; cl_data->ref_count = 0; @@ -2091,7 +2093,7 @@ update_cl_data (xg_menu_cb_data *cl_data, if (cl_data) { cl_data->f = f; - cl_data->menu_bar_vector = f->menu_bar_vector; + cl_data->menu_bar_vector = FVAR (f, menu_bar_vector); cl_data->menu_bar_items_used = f->menu_bar_items_used; cl_data->highlight_cb = highlight_cb; } @@ -3808,12 +3810,12 @@ xg_tool_bar_callback (GtkWidget *w, gpointer client_data) struct input_event event; EVENT_INIT (event); - if (! f || ! f->n_tool_bar_items || NILP (f->tool_bar_items)) + if (! f || ! f->n_tool_bar_items || NILP (FVAR (f, tool_bar_items))) return; idx *= TOOL_BAR_ITEM_NSLOTS; - key = AREF (f->tool_bar_items, idx + TOOL_BAR_ITEM_KEY); + key = AREF (FVAR (f, tool_bar_items), idx + TOOL_BAR_ITEM_KEY); XSETFRAME (frame, f); /* We generate two events here. The first one is to set the prefix @@ -4084,16 +4086,16 @@ xg_tool_bar_help_callback (GtkWidget *w, FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA); Lisp_Object help, frame; - if (! f || ! f->n_tool_bar_items || NILP (f->tool_bar_items)) + if (! f || ! f->n_tool_bar_items || NILP (FVAR (f, tool_bar_items))) return FALSE; if (event->type == GDK_ENTER_NOTIFY) { idx *= TOOL_BAR_ITEM_NSLOTS; - help = AREF (f->tool_bar_items, idx + TOOL_BAR_ITEM_HELP); + help = AREF (FVAR (f, tool_bar_items), idx + TOOL_BAR_ITEM_HELP); if (NILP (help)) - help = AREF (f->tool_bar_items, idx + TOOL_BAR_ITEM_CAPTION); + help = AREF (FVAR (f, tool_bar_items), idx + TOOL_BAR_ITEM_CAPTION); } else help = Qnil; @@ -4221,7 +4223,7 @@ xg_create_tool_bar (FRAME_PTR f) } -#define PROP(IDX) AREF (f->tool_bar_items, i * TOOL_BAR_ITEM_NSLOTS + (IDX)) +#define PROP(IDX) AREF (FVAR (f, tool_bar_items), i * TOOL_BAR_ITEM_NSLOTS + (IDX)) /* Find the right-to-left image named by RTL in the tool bar images for F. Returns IMAGE if RTL is not found. */ @@ -4704,7 +4706,7 @@ update_frame_tool_bar (FRAME_PTR f) if (f->n_tool_bar_items != 0) { if (pack_tool_bar) - xg_pack_tool_bar (f, f->tool_bar_position); + xg_pack_tool_bar (f, FVAR (f, tool_bar_position)); gtk_widget_show_all (GTK_WIDGET (x->handlebox_widget)); if (xg_update_tool_bar_sizes (f)) xg_height_or_width_changed (f); diff --git a/src/keyboard.h b/src/keyboard.h index 752064a6121..4006c67d68e 100644 --- a/src/keyboard.h +++ b/src/keyboard.h @@ -19,14 +19,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "systime.h" /* for EMACS_TIME, Time */ #include "coding.h" /* for ENCODE_UTF_8 and ENCODE_SYSTEM */ -/* Lisp fields in struct keyboard are hidden from most code and accessed - via the KVAR macro, below. Only select pieces of code, like the GC, - are allowed to use KBOARD_INTERNAL_FIELD. */ -#define KBOARD_INTERNAL_FIELD(field) field ## _ +/* Most code should use this macro to access Lisp fields in struct kboard. */ -/* Most code should use this macro to access Lisp fields in struct - kboard. */ -#define KVAR(kboard, field) ((kboard)->KBOARD_INTERNAL_FIELD (field)) +#define KVAR(kboard, field) ((kboard)->INTERNAL_FIELD (field)) /* Each KBOARD represents one logical input stream from which Emacs gets input. If we are using ordinary terminals, it has one KBOARD @@ -79,32 +74,32 @@ struct kboard can effectively wait for input in the any-kboard state, and hence avoid blocking out the other KBOARDs. See universal-argument in lisp/simple.el for an example. */ - Lisp_Object KBOARD_INTERNAL_FIELD (Voverriding_terminal_local_map); + Lisp_Object INTERNAL_FIELD (Voverriding_terminal_local_map); /* Last command executed by the editor command loop, not counting commands that set the prefix argument. */ - Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_command); + Lisp_Object INTERNAL_FIELD (Vlast_command); /* Normally same as last-command, but never modified by other commands. */ - Lisp_Object KBOARD_INTERNAL_FIELD (Vreal_last_command); + Lisp_Object INTERNAL_FIELD (Vreal_last_command); /* User-supplied table to translate input characters through. */ - Lisp_Object KBOARD_INTERNAL_FIELD (Vkeyboard_translate_table); + Lisp_Object INTERNAL_FIELD (Vkeyboard_translate_table); /* Last command that may be repeated by `repeat'. */ - Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_repeatable_command); + Lisp_Object INTERNAL_FIELD (Vlast_repeatable_command); /* The prefix argument for the next command, in raw form. */ - Lisp_Object KBOARD_INTERNAL_FIELD (Vprefix_arg); + Lisp_Object INTERNAL_FIELD (Vprefix_arg); /* Saved prefix argument for the last command, in raw form. */ - Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_prefix_arg); + Lisp_Object INTERNAL_FIELD (Vlast_prefix_arg); /* Unread events specific to this kboard. */ - Lisp_Object KBOARD_INTERNAL_FIELD (kbd_queue); + Lisp_Object INTERNAL_FIELD (kbd_queue); /* Non-nil while a kbd macro is being defined. */ - Lisp_Object KBOARD_INTERNAL_FIELD (defining_kbd_macro); + Lisp_Object INTERNAL_FIELD (defining_kbd_macro); /* The start of storage for the current keyboard macro. */ Lisp_Object *kbd_macro_buffer; @@ -126,28 +121,28 @@ struct kboard ptrdiff_t kbd_macro_bufsize; /* Last anonymous kbd macro defined. */ - Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_kbd_macro); + Lisp_Object INTERNAL_FIELD (Vlast_kbd_macro); /* Alist of system-specific X windows key symbols. */ - Lisp_Object KBOARD_INTERNAL_FIELD (Vsystem_key_alist); + Lisp_Object INTERNAL_FIELD (Vsystem_key_alist); /* Cache for modify_event_symbol. */ - Lisp_Object KBOARD_INTERNAL_FIELD (system_key_syms); + Lisp_Object INTERNAL_FIELD (system_key_syms); /* The kind of display: x, w32, ... */ - Lisp_Object KBOARD_INTERNAL_FIELD (Vwindow_system); + Lisp_Object INTERNAL_FIELD (Vwindow_system); /* Keymap mapping keys to alternative preferred forms. See the DEFVAR for more documentation. */ - Lisp_Object KBOARD_INTERNAL_FIELD (Vlocal_function_key_map); + Lisp_Object INTERNAL_FIELD (Vlocal_function_key_map); /* Keymap mapping ASCII function key sequences onto their preferred forms. Initialized by the terminal-specific lisp files. See the DEFVAR for more documentation. */ - Lisp_Object KBOARD_INTERNAL_FIELD (Vinput_decode_map); + Lisp_Object INTERNAL_FIELD (Vinput_decode_map); /* Minibufferless frames on this display use this frame's minibuffer. */ - Lisp_Object KBOARD_INTERNAL_FIELD (Vdefault_minibuffer_frame); + Lisp_Object INTERNAL_FIELD (Vdefault_minibuffer_frame); /* Number of displays using this KBOARD. Normally 1, but can be larger when you have multiple screens on a single X display. */ @@ -155,7 +150,7 @@ struct kboard /* The text we're echoing in the modeline - partial key sequences, usually. This is nil when not echoing. */ - Lisp_Object KBOARD_INTERNAL_FIELD (echo_string); + Lisp_Object INTERNAL_FIELD (echo_string); /* This flag indicates that events were put into kbd_queue while Emacs was running for some other KBOARD. diff --git a/src/lisp.h b/src/lisp.h index 2d9359abacf..147a4781937 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -622,8 +622,13 @@ clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper) #define CHECK_TYPE(ok, Qxxxp, x) \ do { if (!(ok)) wrong_type_argument (Qxxxp, (x)); } while (0) +/* Lisp fields are usually hidden from most code and accessed + via special macros. Only select pieces of code, like the GC, + are allowed to use INTERNAL_FIELD directly. Objects which + aren't using this convention should be fixed. */ + +#define INTERNAL_FIELD(field) field ## _ - /* See the macros in intervals.h. */ typedef struct interval *INTERVAL; diff --git a/src/minibuf.c b/src/minibuf.c index 7e47be39bc9..5ece9d5d0dd 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -102,14 +102,14 @@ choose_minibuf_frame (void) { if (FRAMEP (selected_frame) && FRAME_LIVE_P (XFRAME (selected_frame)) - && !EQ (minibuf_window, XFRAME (selected_frame)->minibuffer_window)) + && !EQ (minibuf_window, FVAR (XFRAME (selected_frame), minibuffer_window))) { struct frame *sf = XFRAME (selected_frame); Lisp_Object buffer; /* I don't think that any frames may validly have a null minibuffer window anymore. */ - if (NILP (sf->minibuffer_window)) + if (NILP (FVAR (sf, minibuffer_window))) abort (); /* Under X, we come here with minibuf_window being the @@ -117,8 +117,8 @@ choose_minibuf_frame (void) init_window_once. That window doesn't have a buffer. */ buffer = XWINDOW (minibuf_window)->buffer; if (BUFFERP (buffer)) - Fset_window_buffer (sf->minibuffer_window, buffer, Qnil); - minibuf_window = sf->minibuffer_window; + Fset_window_buffer (FVAR (sf, minibuffer_window), buffer, Qnil); + minibuf_window = FVAR (sf, minibuffer_window); } /* Make sure no other frame has a minibuffer as its selected window, diff --git a/src/nsfns.m b/src/nsfns.m index 7c8f673d9ae..420121a8215 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -586,12 +586,12 @@ x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name) { NSTRACE (x_set_title); /* Don't change the title if it's already NAME. */ - if (EQ (name, f->title)) + if (EQ (name, FVAR (f, title))) return; update_mode_lines = 1; - f->title = name; + FVAR (f, title) = name; if (NILP (name)) name = f->name; diff --git a/src/nsterm.m b/src/nsterm.m index d92ab8160c3..5681dc2e1c8 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -2125,8 +2125,8 @@ ns_after_update_window_line (struct glyph_row *desired_row) int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); /* Internal border is drawn below the tool bar. */ - if (WINDOWP (f->tool_bar_window) - && w == XWINDOW (f->tool_bar_window)) + if (WINDOWP (FVAR (f, tool_bar_window)) + && w == XWINDOW (FVAR (f, tool_bar_window))) y -= width; /* end copy from other terms */ diff --git a/src/print.c b/src/print.c index fc435efe7c5..0734245c248 100644 --- a/src/print.c +++ b/src/print.c @@ -1897,7 +1897,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag else if (FRAMEP (obj)) { int len; - Lisp_Object frame_name = XFRAME (obj)->name; + Lisp_Object frame_name = FVAR (XFRAME (obj), name); strout ((FRAME_LIVE_P (XFRAME (obj)) ? "#<frame " : "#<dead frame "), diff --git a/src/term.c b/src/term.c index f24caeffebb..803bb6458b6 100644 --- a/src/term.c +++ b/src/term.c @@ -2192,7 +2192,7 @@ set_tty_color_mode (struct tty_display_info *tty, struct frame *f) Lisp_Object tty_color_mode_alist = Fintern_soft (build_string ("tty-color-mode-alist"), Qnil); - tem = assq_no_quit (Qtty_color_mode, f->param_alist); + tem = assq_no_quit (Qtty_color_mode, FVAR (f, param_alist)); val = CONSP (tem) ? XCDR (tem) : Qnil; if (INTEGERP (val)) diff --git a/src/w32fns.c b/src/w32fns.c index 91744e2691f..57d3c732246 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -1489,7 +1489,7 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) else if (!NILP (arg) || NILP (oldval)) return; - f->icon_name = arg; + FVAR (f, icon_name) = arg; #if 0 if (f->output_data.w32->icon_bitmap != 0) @@ -1498,11 +1498,11 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) BLOCK_INPUT; result = x_text_icon (f, - SSDATA ((!NILP (f->icon_name) - ? f->icon_name - : !NILP (f->title) - ? f->title - : f->name))); + SSDATA ((!NILP (FVAR (f, icon_name)) + ? FVAR (f, icon_name) + : !NILP (FVAR (f, title)) + ? FVAR (f, title) + : FVAR (f, name)))); if (result) { @@ -1631,8 +1631,8 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) } UNBLOCK_INPUT; - if (WINDOWP (f->tool_bar_window)) - clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix); + if (WINDOWP (FVAR (f, tool_bar_window))) + clear_glyph_matrix (XWINDOW (FVAR (f, tool_bar_window))->current_matrix); } run_window_configuration_change_hook (f); @@ -1674,7 +1674,7 @@ x_set_name (struct frame *f, Lisp_Object name, int explicit) /* Check for no change needed in this very common case before we do any consing. */ if (!strcmp (FRAME_W32_DISPLAY_INFO (f)->w32_id_name, - SDATA (f->name))) + SDATA (FVAR (f, name)))) return; name = build_string (FRAME_W32_DISPLAY_INFO (f)->w32_id_name); } @@ -1682,15 +1682,15 @@ x_set_name (struct frame *f, Lisp_Object name, int explicit) CHECK_STRING (name); /* Don't change the name if it's already NAME. */ - if (! NILP (Fstring_equal (name, f->name))) + if (! NILP (Fstring_equal (name, FVAR (f, name)))) return; - f->name = name; + FVAR (f, name) = name; /* For setting the frame title, the title parameter should override the name parameter. */ - if (! NILP (f->title)) - name = f->title; + if (! NILP (FVAR (f, title))) + name = FVAR (f, title); if (FRAME_W32_WINDOW (f)) { @@ -1728,15 +1728,15 @@ void x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name) { /* Don't change the title if it's already NAME. */ - if (EQ (name, f->title)) + if (EQ (name, FVAR (f, title))) return; update_mode_lines = 1; - f->title = name; + FVAR (f, title) = name; if (NILP (name)) - name = f->name; + name = FVAR (f, name); if (FRAME_W32_WINDOW (f)) { @@ -3896,8 +3896,8 @@ w32_window (struct frame *f, long window_prompting, int minibuffer_only) int explicit = f->explicit_name; f->explicit_name = 0; - name = f->name; - f->name = Qnil; + name = FVAR (f, name); + FVAR (f, name) = Qnil; x_set_name (f, name, explicit); } @@ -3944,9 +3944,9 @@ x_icon (struct frame *f, Lisp_Object parms) ? IconicState : NormalState)); - x_text_icon (f, SSDATA ((!NILP (f->icon_name) - ? f->icon_name - : f->name))); + x_text_icon (f, SSDATA ((!NILP (FVAR (f, icon_name)) + ? FVAR (f, icon_name) + : FVAR (f, name)))); #endif UNBLOCK_INPUT; @@ -4146,11 +4146,11 @@ This function is an internal primitive--use `make-frame' instead. */) f->output_data.w32 = xzalloc (sizeof (struct w32_output)); FRAME_FONTSET (f) = -1; - f->icon_name + FVAR (f, icon_name) = x_get_arg (dpyinfo, parameters, Qicon_name, "iconName", "Title", RES_TYPE_STRING); - if (! STRINGP (f->icon_name)) - f->icon_name = Qnil; + if (! STRINGP (FVAR (f, icon_name))) + FVAR (f, icon_name) = Qnil; /* FRAME_W32_DISPLAY_INFO (f) = dpyinfo; */ @@ -4179,12 +4179,12 @@ This function is an internal primitive--use `make-frame' instead. */) be set. */ if (EQ (name, Qunbound) || NILP (name)) { - f->name = build_string (dpyinfo->w32_id_name); + FVAR (f, name) = build_string (dpyinfo->w32_id_name); f->explicit_name = 0; } else { - f->name = name; + FVAR (f, name) = name; f->explicit_name = 1; /* use the frame's title when getting resources for this frame. */ specbind (Qx_resource_name, name); @@ -4359,7 +4359,7 @@ This function is an internal primitive--use `make-frame' instead. */) by x_get_arg and friends, now go in the misc. alist of the frame. */ for (tem = parameters; CONSP (tem); tem = XCDR (tem)) if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem)))) - f->param_alist = Fcons (XCAR (tem), f->param_alist); + FVAR (f, param_alist) = Fcons (XCAR (tem), FVAR (f, param_alist)); UNGCPRO; @@ -5231,7 +5231,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, f->output_data.w32 = xzalloc (sizeof (struct w32_output)); FRAME_FONTSET (f) = -1; - f->icon_name = Qnil; + FVAR (f, icon_name) = Qnil; #ifdef GLYPH_DEBUG image_cache_refcount = @@ -5246,12 +5246,12 @@ x_create_tip_frame (struct w32_display_info *dpyinfo, be set. */ if (EQ (name, Qunbound) || NILP (name)) { - f->name = build_string (dpyinfo->w32_id_name); + FVAR (f, name) = build_string (dpyinfo->w32_id_name); f->explicit_name = 0; } else { - f->name = name; + FVAR (f, name) = name; f->explicit_name = 1; /* use the frame's title when getting resources for this frame. */ specbind (Qx_resource_name, name); diff --git a/src/w32menu.c b/src/w32menu.c index 09484d74b79..27d8bb2ad9d 100644 --- a/src/w32menu.c +++ b/src/w32menu.c @@ -277,7 +277,7 @@ menubar_selection_callback (FRAME_PTR f, void * client_data) return; entry = Qnil; subprefix_stack = (Lisp_Object *) alloca (f->menu_bar_items_used * sizeof (Lisp_Object)); - vector = f->menu_bar_vector; + vector = FVAR (f, menu_bar_vector); prefix = Qnil; i = 0; while (i < f->menu_bar_items_used) @@ -419,14 +419,14 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) /* Save the frame's previous menu bar contents data. */ if (previous_menu_items_used) - memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents, + memcpy (previous_items, XVECTOR (FVAR (f, menu_bar_vector))->contents, previous_menu_items_used * sizeof (Lisp_Object)); /* Fill in menu_items with the current menu bar contents. This can evaluate Lisp code. */ save_menu_items (); - menu_items = f->menu_bar_vector; + menu_items = FVAR (f, menu_bar_vector); menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0; submenu_start = (int *) alloca (ASIZE (items) * sizeof (int)); submenu_end = (int *) alloca (ASIZE (items) * sizeof (int)); @@ -500,7 +500,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) return; } - f->menu_bar_vector = menu_items; + FVAR (f, menu_bar_vector) = menu_items; f->menu_bar_items_used = menu_items_used; /* This undoes save_menu_items. */ @@ -854,7 +854,7 @@ w32_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, wv_title->name = SSDATA (title); wv_title->enabled = TRUE; - wv_title->title = TRUE; + FVAR (wv_title, title) = TRUE; wv_title->button_type = BUTTON_TYPE_NONE; wv_title->help = Qnil; wv_title->next = wv_sep; diff --git a/src/w32term.c b/src/w32term.c index 7c4860d5139..9fc2cfb5ef7 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -4189,7 +4189,7 @@ w32_read_socket (struct terminal *terminal, int expected, /* We may get paint messages even though the client area is clipped - these are not expose events. */ DebPrint (("clipped frame %p (%s) got WM_PAINT - ignored\n", f, - SDATA (f->name))); + SDATA (FVAR (f, name)))); } else if (f->async_visible != 1) { @@ -4198,7 +4198,7 @@ w32_read_socket (struct terminal *terminal, int expected, f->async_iconified = 0; SET_FRAME_GARBAGED (f); DebPrint (("frame %p (%s) reexposed by WM_PAINT\n", f, - SDATA (f->name))); + SDATA (FVAR (f, name)))); /* WM_PAINT serves as MapNotify as well, so report visibility changes properly. */ @@ -4254,7 +4254,7 @@ w32_read_socket (struct terminal *terminal, int expected, if (f && !f->iconified) { if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) - && !EQ (f->tool_bar_window, hlinfo->mouse_face_window)) + && !EQ (FVAR (f, tool_bar_window), hlinfo->mouse_face_window)) { clear_mouse_face (hlinfo); hlinfo->mouse_face_hidden = 1; @@ -4279,7 +4279,7 @@ w32_read_socket (struct terminal *terminal, int expected, if (f && !f->iconified) { if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) - && !EQ (f->tool_bar_window, hlinfo->mouse_face_window)) + && !EQ (FVAR (f, tool_bar_window), hlinfo->mouse_face_window)) { clear_mouse_face (hlinfo); hlinfo->mouse_face_hidden = 1; @@ -4357,7 +4357,7 @@ w32_read_socket (struct terminal *terminal, int expected, if (f && !f->iconified) { if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) - && !EQ (f->tool_bar_window, hlinfo->mouse_face_window)) + && !EQ (FVAR (f, tool_bar_window), hlinfo->mouse_face_window)) { clear_mouse_face (hlinfo); hlinfo->mouse_face_hidden = 1; @@ -4481,8 +4481,8 @@ w32_read_socket (struct terminal *terminal, int expected, construct_mouse_click (&inev, &msg, f); /* Is this in the tool-bar? */ - if (WINDOWP (f->tool_bar_window) - && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window))) + if (WINDOWP (FVAR (f, tool_bar_window)) + && WINDOW_TOTAL_LINES (XWINDOW (FVAR (f, tool_bar_window)))) { Lisp_Object window; int x = XFASTINT (inev.x); @@ -4490,7 +4490,7 @@ w32_read_socket (struct terminal *terminal, int expected, window = window_from_coordinates (f, x, y, 0, 1); - if (EQ (window, f->tool_bar_window)) + if (EQ (window, FVAR (f, tool_bar_window))) { w32_handle_tool_bar_click (f, &inev); tool_bar_p = 1; @@ -4935,7 +4935,7 @@ w32_read_socket (struct terminal *terminal, int expected, if (!FRAME_OBSCURED_P (f)) { DebPrint (("frame %p (%s) obscured\n", f, - SDATA (f->name))); + SDATA (FVAR (f, name)))); } } else @@ -4947,7 +4947,7 @@ w32_read_socket (struct terminal *terminal, int expected, { SET_FRAME_GARBAGED (f); DebPrint (("obscured frame %p (%s) found to be visible\n", f, - SDATA (f->name))); + SDATA (FVAR (f, name)))); /* Force a redisplay sooner or later. */ record_asynch_buffer_change (); @@ -5595,7 +5595,7 @@ x_set_window_size (struct frame *f, int change_gravity, int cols, int rows) SET_FRAME_GARBAGED (f); /* If cursor was outside the new size, mark it as off. */ - mark_window_cursors_off (XWINDOW (f->root_window)); + mark_window_cursors_off (XWINDOW (FVAR (f, root_window))); /* Clear out any recollection of where the mouse highlighting was, since it might be in a place that's outside the new frame size. diff --git a/src/window.c b/src/window.c index e80462ae945..ae0aad7084f 100644 --- a/src/window.c +++ b/src/window.c @@ -191,13 +191,13 @@ With a window argument, return the root window of that window's frame. */) Lisp_Object window; if (NILP (frame_or_window)) - window = SELECTED_FRAME ()->root_window; + window = FVAR (SELECTED_FRAME (), root_window); else if (WINDOWP (frame_or_window)) - window = XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window)))->root_window; + window = FVAR (XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window))), root_window); else { CHECK_LIVE_FRAME (frame_or_window); - window = XFRAME (frame_or_window)->root_window; + window = FVAR (XFRAME (frame_or_window), root_window); } return window; @@ -235,13 +235,13 @@ the first window of that frame. */) Lisp_Object window; if (NILP (frame_or_window)) - window = SELECTED_FRAME ()->root_window; + window = FVAR (SELECTED_FRAME (), root_window); else if (WINDOWP (frame_or_window)) - window = XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window)))->root_window; + window = FVAR (XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window))), root_window); else { CHECK_LIVE_FRAME (frame_or_window); - window = XFRAME (frame_or_window)->root_window; + window = FVAR (XFRAME (frame_or_window), root_window); } while (NILP (XWINDOW (window)->buffer)) @@ -269,13 +269,14 @@ the selected window of that frame. */) Lisp_Object window; if (NILP (frame_or_window)) - window = SELECTED_FRAME ()->selected_window; + window = FVAR (SELECTED_FRAME (), selected_window); else if (WINDOWP (frame_or_window)) - window = XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window)))->selected_window; + window = FVAR (XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window))), + selected_window); else { CHECK_LIVE_FRAME (frame_or_window); - window = XFRAME (frame_or_window)->selected_window; + window = FVAR (XFRAME (frame_or_window), selected_window); } return window; @@ -303,7 +304,7 @@ Return WINDOW. */) if (EQ (frame, selected_frame)) return Fselect_window (window, norecord); else - return XFRAME (frame)->selected_window = window; + return FVAR (XFRAME (frame), selected_window) = window; } DEFUN ("selected-window", Fselected_window, Sselected_window, 0, 0, 0, @@ -346,7 +347,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) sf = SELECTED_FRAME (); if (XFRAME (WINDOW_FRAME (w)) != sf) { - XFRAME (WINDOW_FRAME (w))->selected_window = window; + FVAR (XFRAME (WINDOW_FRAME (w)), selected_window) = window; /* Use this rather than Fhandle_switch_frame so that FRAME_FOCUS_FRAME is moved appropriately as we move around in the state where a minibuffer in a separate @@ -357,7 +358,7 @@ select_window (Lisp_Object window, Lisp_Object norecord, int inhibit_point_swap) return window; } else - sf->selected_window = window; + FVAR (sf, selected_window) = window; /* Store the current buffer's actual point into the old selected window. It belongs to that window, @@ -1219,13 +1220,13 @@ window_from_coordinates (struct frame *f, int x, int y, bar exists. */ if (NILP (window) && tool_bar_p - && WINDOWP (f->tool_bar_window) - && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window)) > 0 - && (coordinates_in_window (XWINDOW (f->tool_bar_window), x, y) + && WINDOWP (FVAR (f, tool_bar_window)) + && WINDOW_TOTAL_LINES (XWINDOW (FVAR (f, tool_bar_window))) > 0 + && (coordinates_in_window (XWINDOW (FVAR (f, tool_bar_window)), x, y) != ON_NOTHING)) { *part = ON_TEXT; - window = f->tool_bar_window; + window = FVAR (f, tool_bar_window); } return window; @@ -2319,7 +2320,7 @@ MINIBUF neither nil nor t means never include the minibuffer window. */) (Lisp_Object frame, Lisp_Object minibuf, Lisp_Object window) { if (NILP (window)) - window = FRAMEP (frame) ? XFRAME (frame)->selected_window : selected_window; + window = FRAMEP (frame) ? FVAR (XFRAME (frame), selected_window) : selected_window; CHECK_WINDOW (window); if (NILP (frame)) frame = selected_frame; @@ -3555,9 +3556,9 @@ be applied on the Elisp level. */) void resize_frame_windows (struct frame *f, int size, int horflag) { - Lisp_Object root = f->root_window; + Lisp_Object root = FVAR (f, root_window); struct window *r = XWINDOW (root); - Lisp_Object mini = f->minibuffer_window; + Lisp_Object mini = FVAR (f, minibuffer_window); struct window *m; /* new_size is the new size of the frame's root window. */ int new_size = (horflag @@ -3603,7 +3604,7 @@ resize_frame_windows (struct frame *f, int size, int horflag) { /* We lost. Delete all windows but the frame's selected one. */ - root = f->selected_window; + root = FVAR (f, selected_window); Fdelete_other_windows_internal (root, Qnil); if (horflag) XSETFASTINT (XWINDOW (root)->total_cols, new_size); @@ -6464,8 +6465,8 @@ init_window_once (void) struct frame *f = make_initial_frame (); XSETFRAME (selected_frame, f); Vterminal_frame = selected_frame; - minibuf_window = f->minibuffer_window; - selected_window = f->selected_window; + minibuf_window = FVAR (f, minibuffer_window); + selected_window = FVAR (f, selected_window); last_nonminibuf_frame = f; window_initialized = 1; diff --git a/src/window.h b/src/window.h index 10cabed979b..16aecd0f01d 100644 --- a/src/window.h +++ b/src/window.h @@ -460,14 +460,14 @@ struct window /* 1 if W is a menu bar window. */ #define WINDOW_MENU_BAR_P(W) \ - (WINDOWP (WINDOW_XFRAME (W)->menu_bar_window) \ - && (W) == XWINDOW (WINDOW_XFRAME (W)->menu_bar_window)) + (WINDOWP (FVAR (WINDOW_XFRAME (W), menu_bar_window)) \ + && (W) == XWINDOW (FVAR (WINDOW_XFRAME (W), menu_bar_window))) /* 1 if W is a tool bar window. */ #define WINDOW_TOOL_BAR_P(W) \ - (WINDOWP (WINDOW_XFRAME (W)->tool_bar_window) \ - && (W) == XWINDOW (WINDOW_XFRAME (W)->tool_bar_window)) + (WINDOWP (FVAR (WINDOW_XFRAME (W), tool_bar_window)) \ + && (W) == XWINDOW (FVAR (WINDOW_XFRAME (W), tool_bar_window))) /* Return the frame y-position at which window W starts. This includes a header line, if any. */ diff --git a/src/xdisp.c b/src/xdisp.c index e9bf472696d..36196e876c9 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -10892,7 +10892,7 @@ format_mode_line_unwind_data (struct frame *target_frame, /* Similarly to `with-selected-window', if the operation selects a window on another frame, we must restore that frame's selected window, and (for a tty) the top-frame. */ - ASET (vector, 8, target_frame->selected_window); + ASET (vector, 8, FVAR (target_frame, selected_window)); if (FRAME_TERMCAP_P (target_frame)) ASET (vector, 9, FRAME_TTY (target_frame)->top_frame); } @@ -11052,13 +11052,13 @@ x_consider_frame_title (Lisp_Object frame) format_mode_line_unwind_data (f, current_buffer, selected_window, 0)); - Fselect_window (f->selected_window, Qt); - set_buffer_internal_1 (XBUFFER (XWINDOW (f->selected_window)->buffer)); + Fselect_window (FVAR (f, selected_window), Qt); + set_buffer_internal_1 (XBUFFER (XWINDOW (FVAR (f, selected_window))->buffer)); fmt = FRAME_ICONIFIED_P (f) ? Vicon_title_format : Vframe_title_format; mode_line_target = MODE_LINE_TITLE; title_start = MODE_LINE_NOPROP_LEN (0); - init_iterator (&it, XWINDOW (f->selected_window), -1, -1, + init_iterator (&it, XWINDOW (FVAR (f, selected_window)), -1, -1, NULL, DEFAULT_FACE_ID); display_mode_element (&it, 0, -1, -1, fmt, Qnil, 0); len = MODE_LINE_NOPROP_LEN (title_start); @@ -11070,9 +11070,9 @@ x_consider_frame_title (Lisp_Object frame) already wasted too much time by walking through the list with display_mode_element, then we might need to optimize at a higher level than this.) */ - if (! STRINGP (f->name) - || SBYTES (f->name) != len - || memcmp (title, SDATA (f->name), len) != 0) + if (! STRINGP (FVAR (f, name)) + || SBYTES (FVAR (f, name)) != len + || memcmp (title, SDATA (FVAR (f, name)), len) != 0) x_implicitly_set_name (f, make_string (title, len), Qnil); } } @@ -11172,7 +11172,7 @@ prepare_menu_bars (void) if (windows_or_buffers_changed && FRAME_NS_P (f)) ns_set_doc_edited (f, Fbuffer_modified_p - (XWINDOW (f->selected_window)->buffer)); + (XWINDOW (FVAR (f, selected_window))->buffer)); #endif UNGCPRO; } @@ -11413,8 +11413,8 @@ update_tool_bar (struct frame *f, int save_match_data) #if defined (USE_GTK) || defined (HAVE_NS) int do_update = FRAME_EXTERNAL_TOOL_BAR (f); #else - int do_update = WINDOWP (f->tool_bar_window) - && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window)) > 0; + int do_update = WINDOWP (FVAR (f, tool_bar_window)) + && WINDOW_TOTAL_LINES (XWINDOW (FVAR (f, tool_bar_window))) > 0; #endif if (do_update) @@ -11475,18 +11475,18 @@ update_tool_bar (struct frame *f, int save_match_data) selected_frame = frame; /* Build desired tool-bar items from keymaps. */ - new_tool_bar = tool_bar_items (Fcopy_sequence (f->tool_bar_items), - &new_n_tool_bar); + new_tool_bar = tool_bar_items + (Fcopy_sequence (FVAR (f, tool_bar_items)), &new_n_tool_bar); /* Redisplay the tool-bar if we changed it. */ if (new_n_tool_bar != f->n_tool_bar_items - || NILP (Fequal (new_tool_bar, f->tool_bar_items))) + || NILP (Fequal (new_tool_bar, FVAR (f, tool_bar_items)))) { /* Redisplay that happens asynchronously due to an expose event may access f->tool_bar_items. Make sure we update both variables within BLOCK_INPUT so no such event interrupts. */ BLOCK_INPUT; - f->tool_bar_items = new_tool_bar; + FVAR (f, tool_bar_items) = new_tool_bar; f->n_tool_bar_items = new_n_tool_bar; w->update_mode_line = 1; UNBLOCK_INPUT; @@ -11519,22 +11519,22 @@ build_desired_tool_bar_string (struct frame *f) Otherwise, make a new string. */ /* The size of the string we might be able to reuse. */ - size = (STRINGP (f->desired_tool_bar_string) - ? SCHARS (f->desired_tool_bar_string) + size = (STRINGP (FVAR (f, desired_tool_bar_string)) + ? SCHARS (FVAR (f, desired_tool_bar_string)) : 0); /* We need one space in the string for each image. */ size_needed = f->n_tool_bar_items; /* Reuse f->desired_tool_bar_string, if possible. */ - if (size < size_needed || NILP (f->desired_tool_bar_string)) - f->desired_tool_bar_string = Fmake_string (make_number (size_needed), - make_number (' ')); + if (size < size_needed || NILP (FVAR (f, desired_tool_bar_string))) + FVAR (f, desired_tool_bar_string) + = Fmake_string (make_number (size_needed), make_number (' ')); else { props = list4 (Qdisplay, Qnil, Qmenu_item, Qnil); Fremove_text_properties (make_number (0), make_number (size), - props, f->desired_tool_bar_string); + props, FVAR (f, desired_tool_bar_string)); } /* Put a `display' property on the string for the images to display, @@ -11542,7 +11542,8 @@ build_desired_tool_bar_string (struct frame *f) is the index of the item in F's tool-bar item vector. */ for (i = 0; i < f->n_tool_bar_items; ++i) { -#define PROP(IDX) AREF (f->tool_bar_items, i * TOOL_BAR_ITEM_NSLOTS + (IDX)) +#define PROP(IDX) \ + AREF (FVAR (f, tool_bar_items), i * TOOL_BAR_ITEM_NSLOTS + (IDX)) int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P)); int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P)); @@ -11651,11 +11652,11 @@ build_desired_tool_bar_string (struct frame *f) string. The string can be longer than needed when we reuse a previous string. */ if (i + 1 == f->n_tool_bar_items) - end = SCHARS (f->desired_tool_bar_string); + end = SCHARS (FVAR (f, desired_tool_bar_string)); else end = i + 1; Fadd_text_properties (make_number (i), make_number (end), - props, f->desired_tool_bar_string); + props, FVAR (f, desired_tool_bar_string)); #undef PROP } @@ -11805,7 +11806,7 @@ display_tool_bar_line (struct it *it, int height) static int tool_bar_lines_needed (struct frame *f, int *n_rows) { - struct window *w = XWINDOW (f->tool_bar_window); + struct window *w = XWINDOW (FVAR (f, tool_bar_window)); struct it it; /* tool_bar_lines_needed is called from redisplay_tool_bar after building the desired matrix, so use (unused) mode-line row as temporary row to @@ -11817,7 +11818,7 @@ tool_bar_lines_needed (struct frame *f, int *n_rows) init_iterator (&it, w, -1, -1, temp_row, TOOL_BAR_FACE_ID); it.first_visible_x = 0; it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f); - reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1); + reseat_to_string (&it, NULL, FVAR (f, desired_tool_bar_string), 0, 0, 0, -1); it.paragraph_embedding = L2R; while (!ITERATOR_AT_END_P (&it)) @@ -11851,8 +11852,8 @@ DEFUN ("tool-bar-lines-needed", Ftool_bar_lines_needed, Stool_bar_lines_needed, CHECK_FRAME (frame); f = XFRAME (frame); - if (WINDOWP (f->tool_bar_window) - && (w = XWINDOW (f->tool_bar_window), + if (WINDOWP (FVAR (f, tool_bar_window)) + && (w = XWINDOW (FVAR (f, tool_bar_window)), WINDOW_TOTAL_LINES (w) > 0)) { update_tool_bar (f, 1); @@ -11887,8 +11888,8 @@ redisplay_tool_bar (struct frame *f) do anything. This means you must start with tool-bar-lines non-zero to get the auto-sizing effect. Or in other words, you can turn off tool-bars by specifying tool-bar-lines zero. */ - if (!WINDOWP (f->tool_bar_window) - || (w = XWINDOW (f->tool_bar_window), + if (!WINDOWP (FVAR (f, tool_bar_window)) + || (w = XWINDOW (FVAR (f, tool_bar_window)), WINDOW_TOTAL_LINES (w) == 0)) return 0; @@ -11900,7 +11901,7 @@ redisplay_tool_bar (struct frame *f) /* Build a string that represents the contents of the tool-bar. */ build_desired_tool_bar_string (f); - reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1); + reseat_to_string (&it, NULL, FVAR (f, desired_tool_bar_string), 0, 0, 0, -1); /* FIXME: This should be controlled by a user option. But it doesn't make sense to have an R2L tool bar if the menu bar cannot be drawn also R2L, and making the menu bar R2L is tricky due @@ -12057,14 +12058,14 @@ tool_bar_item_info (struct frame *f, struct glyph *glyph, int *prop_idx) /* This function can be called asynchronously, which means we must exclude any possibility that Fget_text_property signals an error. */ - charpos = min (SCHARS (f->current_tool_bar_string), glyph->charpos); + charpos = min (SCHARS (FVAR (f, current_tool_bar_string)), glyph->charpos); charpos = max (0, charpos); /* Get the text property `menu-item' at pos. The value of that property is the start index of this item's properties in F->tool_bar_items. */ prop = Fget_text_property (make_number (charpos), - Qmenu_item, f->current_tool_bar_string); + Qmenu_item, FVAR (f, current_tool_bar_string)); if (INTEGERP (prop)) { *prop_idx = XINT (prop); @@ -12092,7 +12093,7 @@ get_tool_bar_item (struct frame *f, int x, int y, struct glyph **glyph, int *hpos, int *vpos, int *prop_idx) { Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); - struct window *w = XWINDOW (f->tool_bar_window); + struct window *w = XWINDOW (FVAR (f, tool_bar_window)); int area; /* Find the glyph under X/Y. */ @@ -12106,7 +12107,7 @@ get_tool_bar_item (struct frame *f, int x, int y, struct glyph **glyph, return -1; /* Is mouse on the highlighted item? */ - if (EQ (f->tool_bar_window, hlinfo->mouse_face_window) + if (EQ (FVAR (f, tool_bar_window), hlinfo->mouse_face_window) && *vpos >= hlinfo->mouse_face_beg_row && *vpos <= hlinfo->mouse_face_end_row && (*vpos > hlinfo->mouse_face_beg_row @@ -12131,7 +12132,7 @@ handle_tool_bar_click (struct frame *f, int x, int y, int down_p, int modifiers) { Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); - struct window *w = XWINDOW (f->tool_bar_window); + struct window *w = XWINDOW (FVAR (f, tool_bar_window)); int hpos, vpos, prop_idx; struct glyph *glyph; Lisp_Object enabled_p; @@ -12142,7 +12143,7 @@ handle_tool_bar_click (struct frame *f, int x, int y, int down_p, return; /* If item is disabled, do nothing. */ - enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P); + enabled_p = AREF (FVAR (f, tool_bar_items), prop_idx + TOOL_BAR_ITEM_ENABLED_P); if (NILP (enabled_p)) return; @@ -12163,7 +12164,7 @@ handle_tool_bar_click (struct frame *f, int x, int y, int down_p, show_mouse_face (hlinfo, DRAW_IMAGE_RAISED); hlinfo->mouse_face_image_state = DRAW_IMAGE_RAISED; - key = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_KEY); + key = AREF (FVAR (f, tool_bar_items), prop_idx + TOOL_BAR_ITEM_KEY); XSETFRAME (frame, f); event.kind = TOOL_BAR_EVENT; @@ -12188,7 +12189,7 @@ handle_tool_bar_click (struct frame *f, int x, int y, int down_p, static void note_tool_bar_highlight (struct frame *f, int x, int y) { - Lisp_Object window = f->tool_bar_window; + Lisp_Object window = FVAR (f, tool_bar_window); struct window *w = XWINDOW (window); Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); @@ -12234,7 +12235,7 @@ note_tool_bar_highlight (struct frame *f, int x, int y) draw = mouse_down_p ? DRAW_IMAGE_SUNKEN : DRAW_IMAGE_RAISED; /* If tool-bar item is not enabled, don't highlight it. */ - enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P); + enabled_p = AREF (FVAR (f, tool_bar_items), prop_idx + TOOL_BAR_ITEM_ENABLED_P); if (!NILP (enabled_p)) { /* Compute the x-position of the glyph. In front and past the @@ -12268,9 +12269,9 @@ note_tool_bar_highlight (struct frame *f, int x, int y) XTread_socket does the rest. */ help_echo_object = help_echo_window = Qnil; help_echo_pos = -1; - help_echo_string = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_HELP); + help_echo_string = AREF (FVAR (f, tool_bar_items), prop_idx + TOOL_BAR_ITEM_HELP); if (NILP (help_echo_string)) - help_echo_string = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_CAPTION); + help_echo_string = AREF (FVAR (f, tool_bar_items), prop_idx + TOOL_BAR_ITEM_CAPTION); } #endif /* HAVE_WINDOW_SYSTEM */ @@ -12851,7 +12852,8 @@ select_frame_for_redisplay (Lisp_Object frame) selected_frame = frame; do { - for (tail = XFRAME (frame)->param_alist; CONSP (tail); tail = XCDR (tail)) + for (tail = FVAR (XFRAME (frame), param_alist); + CONSP (tail); tail = XCDR (tail)) if (CONSP (XCAR (tail)) && (tem = XCAR (XCAR (tail)), SYMBOLP (tem)) @@ -13424,7 +13426,7 @@ redisplay_internal (void) if (!f->already_hscrolled_p) { f->already_hscrolled_p = 1; - if (hscroll_windows (f->root_window)) + if (hscroll_windows (FVAR (f, root_window))) goto retry; } @@ -13437,7 +13439,7 @@ redisplay_internal (void) STOP_POLLING; /* Update the display. */ - set_window_update_flags (XWINDOW (f->root_window), 1); + set_window_update_flags (XWINDOW (FVAR (f, root_window)), 1); pending |= update_frame (f, 0, 0); f->updated_p = 1; } @@ -13450,7 +13452,8 @@ redisplay_internal (void) and selected_window to be temporarily out-of-sync but let's make sure this stays contained. */ select_frame_for_redisplay (old_frame); - eassert (EQ (XFRAME (selected_frame)->selected_window, selected_window)); + eassert (EQ (FVAR (XFRAME (selected_frame), selected_window), + selected_window)); if (!pending) { @@ -13462,7 +13465,7 @@ redisplay_internal (void) struct frame *f = XFRAME (frame); if (f->updated_p) { - mark_window_display_accurate (f->root_window, 1); + mark_window_display_accurate (FVAR (f, root_window), 1); if (FRAME_TERMINAL (f)->frame_up_to_date_hook) FRAME_TERMINAL (f)->frame_up_to_date_hook (f); } @@ -16158,7 +16161,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) if (FRAME_EXTERNAL_TOOL_BAR (f)) redisplay_tool_bar (f); #else - if (WINDOWP (f->tool_bar_window) + if (WINDOWP (FVAR (f, tool_bar_window)) && (FRAME_TOOL_BAR_LINES (f) > 0 || !NILP (Vauto_resize_tool_bars)) && redisplay_tool_bar (f)) @@ -18113,7 +18116,7 @@ GLYPH > 1 or omitted means dump glyphs in long form. */) (Lisp_Object row, Lisp_Object glyphs) { struct frame *sf = SELECTED_FRAME (); - struct glyph_matrix *m = XWINDOW (sf->tool_bar_window)->current_matrix; + struct glyph_matrix *m = XWINDOW (FVAR (sf, tool_bar_window))->current_matrix; EMACS_INT vpos; CHECK_NUMBER (row); @@ -20098,8 +20101,8 @@ display_menu_bar (struct window *w) /* Menu bar lines are displayed in the desired matrix of the dummy window menu_bar_window. */ struct window *menu_w; - eassert (WINDOWP (f->menu_bar_window)); - menu_w = XWINDOW (f->menu_bar_window); + eassert (WINDOWP (FVAR (f, menu_bar_window))); + menu_w = XWINDOW (FVAR (f, menu_bar_window)); init_iterator (&it, menu_w, -1, -1, menu_w->desired_matrix->rows, MENU_FACE_ID); it.first_visible_x = 0; @@ -21403,10 +21406,10 @@ decode_mode_spec (struct window *w, register int c, int field_width, case 'F': /* %F displays the frame name. */ - if (!NILP (f->title)) - return SSDATA (f->title); + if (!NILP (FVAR (f, title))) + return SSDATA (FVAR (f, title)); if (f->explicit_name || ! FRAME_WINDOW_P (f)) - return SSDATA (f->name); + return SSDATA (FVAR (f, name)); return "Emacs"; case 'f': @@ -25570,7 +25573,7 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width, } /* Detect a nonselected window or nonselected frame. */ - else if (w != XWINDOW (f->selected_window) + else if (w != XWINDOW (FVAR (f, selected_window)) || f != FRAME_X_DISPLAY_INFO (f)->x_highlight_frame) { *active_cursor = 0; @@ -26112,7 +26115,7 @@ update_cursor_in_window_tree (struct window *w, int on_p) void x_update_cursor (struct frame *f, int on_p) { - update_cursor_in_window_tree (XWINDOW (f->root_window), on_p); + update_cursor_in_window_tree (XWINDOW (FVAR (f, root_window)), on_p); } @@ -26271,7 +26274,7 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw) if (FRAME_WINDOW_P (f)) { if (draw == DRAW_NORMAL_TEXT - && !EQ (hlinfo->mouse_face_window, f->tool_bar_window)) + && !EQ (hlinfo->mouse_face_window, FVAR (f, tool_bar_window))) FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor); else if (draw == DRAW_MOUSE_FACE) FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor); @@ -27627,7 +27630,7 @@ note_mouse_highlight (struct frame *f, int x, int y) #ifdef HAVE_WINDOW_SYSTEM /* Handle tool-bar window differently since it doesn't display a buffer. */ - if (EQ (window, f->tool_bar_window)) + if (EQ (window, FVAR (f, tool_bar_window))) { note_tool_bar_highlight (f, x, y); return; @@ -28537,18 +28540,18 @@ expose_frame (struct frame *f, int x, int y, int w, int h) } TRACE ((stderr, "(%d, %d, %d, %d)\n", r.x, r.y, r.width, r.height)); - mouse_face_overwritten_p = expose_window_tree (XWINDOW (f->root_window), &r); + mouse_face_overwritten_p = expose_window_tree (XWINDOW (FVAR (f, root_window)), &r); - if (WINDOWP (f->tool_bar_window)) + if (WINDOWP (FVAR (f, tool_bar_window))) mouse_face_overwritten_p - |= expose_window (XWINDOW (f->tool_bar_window), &r); + |= expose_window (XWINDOW (FVAR (f, tool_bar_window)), &r); #ifdef HAVE_X_WINDOWS #ifndef MSDOS #ifndef USE_X_TOOLKIT - if (WINDOWP (f->menu_bar_window)) + if (WINDOWP (FVAR (f, menu_bar_window))) mouse_face_overwritten_p - |= expose_window (XWINDOW (f->menu_bar_window), &r); + |= expose_window (XWINDOW (FVAR (f, menu_bar_window)), &r); #endif /* not USE_X_TOOLKIT */ #endif #endif diff --git a/src/xfaces.c b/src/xfaces.c index 6a34c3c8893..3d5ea9e1152 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -2051,7 +2051,7 @@ lface_from_face_name_no_resolve (struct frame *f, Lisp_Object face_name, Lisp_Object lface; if (f) - lface = assq_no_quit (face_name, f->face_alist); + lface = assq_no_quit (face_name, FVAR (f, face_alist)); else lface = assq_no_quit (face_name, Vface_new_frame_defaults); @@ -2678,7 +2678,8 @@ Value is a vector of face attributes. */) lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE), Qunspecified); ASET (lface, 0, Qface); - f->face_alist = Fcons (Fcons (face, lface), f->face_alist); + FVAR (f, face_alist) = Fcons (Fcons (face, lface), FVAR (f, + face_alist)); } else for (i = 1; i < LFACE_VECTOR_SIZE; ++i) @@ -3357,7 +3358,7 @@ update_face_from_frame_parameter (struct frame *f, Lisp_Object param, /* If there are no faces yet, give up. This is the case when called from Fx_create_frame, and we do the necessary things later in face-set-after-frame-defaults. */ - if (NILP (f->face_alist)) + if (NILP (FVAR (f, face_alist))) return; if (EQ (param, Qforeground_color)) @@ -4043,7 +4044,7 @@ For internal use only. */) (Lisp_Object frame) { struct frame *f = frame_or_selected_frame (frame, 0); - return f->face_alist; + return FVAR (f, face_alist); } @@ -4334,7 +4335,7 @@ free_realized_faces (struct face_cache *c) matrices as invalid because they will reference faces freed above. This function is also called when a frame is destroyed. In this case, the root window of F is nil. */ - if (WINDOWP (f->root_window)) + if (WINDOWP (FVAR (f, root_window))) { clear_current_matrices (f); ++windows_or_buffers_changed; @@ -5107,7 +5108,7 @@ face for italic. */) { frame = XCAR (fl_tail); if (!NILP (Fequal (Fcdr (Fassq (Qdisplay, - XFRAME (frame)->param_alist)), + FVAR (XFRAME (frame), param_alist))), display))) break; } @@ -5403,7 +5404,7 @@ realize_default_face (struct frame *f) { /* This function is called so early that colors are not yet set in the frame parameter list. */ - Lisp_Object color = Fassq (Qforeground_color, f->param_alist); + Lisp_Object color = Fassq (Qforeground_color, FVAR (f, param_alist)); if (CONSP (color) && STRINGP (XCDR (color))) LFACE_FOREGROUND (lface) = XCDR (color); @@ -5419,7 +5420,7 @@ realize_default_face (struct frame *f) { /* This function is called so early that colors are not yet set in the frame parameter list. */ - Lisp_Object color = Fassq (Qbackground_color, f->param_alist); + Lisp_Object color = Fassq (Qbackground_color, FVAR (f, param_alist)); if (CONSP (color) && STRINGP (XCDR (color))) LFACE_BACKGROUND (lface) = XCDR (color); else if (FRAME_WINDOW_P (f)) diff --git a/src/xfns.c b/src/xfns.c index bca43dbd306..da7f6067a96 100644 --- a/src/xfns.c +++ b/src/xfns.c @@ -665,7 +665,7 @@ x_set_tool_bar_position (struct frame *f, #ifdef USE_GTK if (xg_change_toolbar_position (f, new_value)) - f->tool_bar_position = new_value; + FVAR (f, tool_bar_position) = new_value; #endif } @@ -1123,9 +1123,9 @@ x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval) BLOCK_INPUT; if (NILP (arg)) result = x_text_icon (f, - SSDATA ((!NILP (f->icon_name) - ? f->icon_name - : f->name))); + SSDATA ((!NILP (FVAR (f, icon_name)) + ? FVAR (f, icon_name) + : FVAR (f, name)))); else result = x_bitmap_icon (f, arg); @@ -1152,7 +1152,7 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) else if (!NILP (arg) || NILP (oldval)) return; - f->icon_name = arg; + FVAR (f, icon_name) = arg; if (f->output_data.x->icon_bitmap != 0) return; @@ -1160,11 +1160,11 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval) BLOCK_INPUT; result = x_text_icon (f, - SSDATA ((!NILP (f->icon_name) - ? f->icon_name - : !NILP (f->title) - ? f->title - : f->name))); + SSDATA ((!NILP (FVAR (f, icon_name)) + ? FVAR (f, icon_name) + : !NILP (FVAR (f, title)) + ? FVAR (f, title) + : FVAR (f, name)))); if (result) { @@ -1352,8 +1352,8 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval) UNBLOCK_INPUT; } - if (WINDOWP (f->tool_bar_window)) - clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix); + if (WINDOWP (FVAR (f, tool_bar_window))) + clear_glyph_matrix (XWINDOW (FVAR (f, tool_bar_window))->current_matrix); } run_window_configuration_change_hook (f); @@ -1548,7 +1548,7 @@ x_set_name_internal (FRAME_PTR f, Lisp_Object name) if (text.nitems != bytes) error ("Window name too large"); - if (!STRINGP (f->icon_name)) + if (!STRINGP (FVAR (f, icon_name))) { icon = text; encoded_icon_name = encoded_name; @@ -1556,7 +1556,7 @@ x_set_name_internal (FRAME_PTR f, Lisp_Object name) else { /* See the above comment "Note: Encoding strategy". */ - icon.value = x_encode_text (f->icon_name, coding_system, 0, + icon.value = x_encode_text (FVAR (f, icon_name), coding_system, 0, &bytes, &stringp, &do_free_icon_value); icon.encoding = (stringp ? XA_STRING : FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT); @@ -1565,7 +1565,7 @@ x_set_name_internal (FRAME_PTR f, Lisp_Object name) if (icon.nitems != bytes) error ("Icon name too large"); - encoded_icon_name = ENCODE_UTF_8 (f->icon_name); + encoded_icon_name = ENCODE_UTF_8 (FVAR (f, icon_name)); } #ifdef USE_GTK @@ -1632,7 +1632,7 @@ x_set_name (struct frame *f, Lisp_Object name, int explicit) /* Check for no change needed in this very common case before we do any consing. */ if (!strcmp (FRAME_X_DISPLAY_INFO (f)->x_id_name, - SSDATA (f->name))) + SSDATA (FVAR (f, name)))) return; name = build_string (FRAME_X_DISPLAY_INFO (f)->x_id_name); } @@ -1640,15 +1640,15 @@ x_set_name (struct frame *f, Lisp_Object name, int explicit) CHECK_STRING (name); /* Don't change the name if it's already NAME. */ - if (! NILP (Fstring_equal (name, f->name))) + if (! NILP (Fstring_equal (name, FVAR (f, name)))) return; - f->name = name; + FVAR (f, name) = name; /* For setting the frame title, the title parameter should override the name parameter. */ - if (! NILP (f->title)) - name = f->title; + if (! NILP (FVAR (f, title))) + name = FVAR (f, title); x_set_name_internal (f, name); } @@ -1678,15 +1678,15 @@ static void x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name) { /* Don't change the title if it's already NAME. */ - if (EQ (name, f->title)) + if (EQ (name, FVAR (f, title))) return; update_mode_lines = 1; - f->title = name; + FVAR (f, title) = name; if (NILP (name)) - name = f->name; + name = FVAR (f, name); else CHECK_STRING (name); @@ -2571,8 +2571,8 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only) int explicit = f->explicit_name; f->explicit_name = 0; - name = f->name; - f->name = Qnil; + name = FVAR (f, name); + FVAR (f, name) = Qnil; x_set_name (f, name, explicit); } @@ -2714,8 +2714,8 @@ x_window (struct frame *f) int explicit = f->explicit_name; f->explicit_name = 0; - name = f->name; - f->name = Qnil; + name = FVAR (f, name); + FVAR (f, name) = Qnil; x_set_name (f, name, explicit); } @@ -2791,9 +2791,9 @@ x_icon (struct frame *f, Lisp_Object parms) : NormalState)); #endif - x_text_icon (f, SSDATA ((!NILP (f->icon_name) - ? f->icon_name - : f->name))); + x_text_icon (f, SSDATA ((!NILP (FVAR (f, icon_name)) + ? FVAR (f, icon_name) + : FVAR (f, name)))); UNBLOCK_INPUT; } @@ -3135,11 +3135,11 @@ This function is an internal primitive--use `make-frame' instead. */) f->output_data.x->scroll_bar_bottom_shadow_pixel = -1; #endif /* USE_TOOLKIT_SCROLL_BARS */ - f->icon_name + FVAR (f, icon_name) = x_get_arg (dpyinfo, parms, Qicon_name, "iconName", "Title", RES_TYPE_STRING); - if (! STRINGP (f->icon_name)) - f->icon_name = Qnil; + if (! STRINGP (FVAR (f, icon_name))) + FVAR (f, icon_name) = Qnil; FRAME_X_DISPLAY_INFO (f) = dpyinfo; @@ -3196,12 +3196,12 @@ This function is an internal primitive--use `make-frame' instead. */) be set. */ if (EQ (name, Qunbound) || NILP (name)) { - f->name = build_string (dpyinfo->x_id_name); + FVAR (f, name) = build_string (dpyinfo->x_id_name); f->explicit_name = 0; } else { - f->name = name; + FVAR (f, name) = name; f->explicit_name = 1; /* use the frame's title when getting resources for this frame. */ specbind (Qx_resource_name, name); @@ -3340,7 +3340,7 @@ This function is an internal primitive--use `make-frame' instead. */) x_default_parameter (f, parms, Qfullscreen, Qnil, "fullscreen", "Fullscreen", RES_TYPE_SYMBOL); x_default_parameter (f, parms, Qtool_bar_position, - f->tool_bar_position, 0, 0, RES_TYPE_SYMBOL); + FVAR (f, tool_bar_position), 0, 0, RES_TYPE_SYMBOL); /* Compute the size of the X window. */ window_prompting = x_figure_window_size (f, parms, 1); @@ -3468,7 +3468,7 @@ This function is an internal primitive--use `make-frame' instead. */) by x_get_arg and friends, now go in the misc. alist of the frame. */ for (tem = parms; CONSP (tem); tem = XCDR (tem)) if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem)))) - f->param_alist = Fcons (XCAR (tem), f->param_alist); + FVAR (f, param_alist) = Fcons (XCAR (tem), FVAR (f, param_alist)); UNGCPRO; @@ -4621,7 +4621,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo, f->output_data.x->scroll_bar_top_shadow_pixel = -1; f->output_data.x->scroll_bar_bottom_shadow_pixel = -1; #endif /* USE_TOOLKIT_SCROLL_BARS */ - f->icon_name = Qnil; + FVAR (f, icon_name) = Qnil; FRAME_X_DISPLAY_INFO (f) = dpyinfo; f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window; f->output_data.x->explicit_parent = 0; @@ -4663,12 +4663,12 @@ x_create_tip_frame (struct x_display_info *dpyinfo, be set. */ if (EQ (name, Qunbound) || NILP (name)) { - f->name = build_string (dpyinfo->x_id_name); + FVAR (f, name) = build_string (dpyinfo->x_id_name); f->explicit_name = 0; } else { - f->name = name; + FVAR (f, name) = name; f->explicit_name = 1; /* use the frame's title when getting resources for this frame. */ specbind (Qx_resource_name, name); diff --git a/src/xmenu.c b/src/xmenu.c index c7ec3dc3171..d1b3198cc80 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -835,7 +835,7 @@ menubar_selection_callback (Widget widget, LWLIB_ID id, XtPointer client_data) if (!f) return; find_and_call_menu_selection (f, f->menu_bar_items_used, - f->menu_bar_vector, client_data); + FVAR (f, menu_bar_vector), client_data); } #endif /* not USE_GTK */ @@ -1014,14 +1014,14 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) /* Save the frame's previous menu bar contents data. */ if (previous_menu_items_used) - memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents, + memcpy (previous_items, XVECTOR (FVAR (f, menu_bar_vector))->contents, previous_menu_items_used * sizeof (Lisp_Object)); /* Fill in menu_items with the current menu bar contents. This can evaluate Lisp code. */ save_menu_items (); - menu_items = f->menu_bar_vector; + menu_items = FVAR (f, menu_bar_vector); menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0; subitems = ASIZE (items) / 4; submenu_start = alloca ((subitems + 1) * sizeof *submenu_start); @@ -1100,7 +1100,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) } /* The menu items are different, so store them in the frame. */ - f->menu_bar_vector = menu_items; + FVAR (f, menu_bar_vector) = menu_items; f->menu_bar_items_used = menu_items_used; /* This undoes save_menu_items. */ diff --git a/src/xterm.c b/src/xterm.c index 60f65aa9508..0f386b6b6a4 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -6357,7 +6357,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, mouse highlighting. */ if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) && (f == 0 - || !EQ (f->tool_bar_window, hlinfo->mouse_face_window))) + || !EQ (FVAR (f, tool_bar_window), hlinfo->mouse_face_window))) { clear_mouse_face (hlinfo); hlinfo->mouse_face_hidden = 1; @@ -6904,15 +6904,15 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, if (f) { /* Is this in the tool-bar? */ - if (WINDOWP (f->tool_bar_window) - && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window))) + if (WINDOWP (FVAR (f, tool_bar_window)) + && WINDOW_TOTAL_LINES (XWINDOW (FVAR (f, tool_bar_window)))) { Lisp_Object window; int x = event.xbutton.x; int y = event.xbutton.y; window = window_from_coordinates (f, x, y, 0, 1); - tool_bar_p = EQ (window, f->tool_bar_window); + tool_bar_p = EQ (window, FVAR (f, tool_bar_window)); if (tool_bar_p && event.xbutton.button < 4) { @@ -7503,7 +7503,7 @@ x_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, int x, int } #ifdef HAVE_X_I18N - if (w == XWINDOW (f->selected_window)) + if (w == XWINDOW (FVAR (f, selected_window))) if (FRAME_XIC (f) && (FRAME_XIC_STYLE (f) & XIMPreeditPosition)) xic_set_preeditarea (w, x, y); #endif @@ -8154,7 +8154,7 @@ xim_instantiate_callback (Display *display, XPointer client_data, XPointer call_ xic_set_statusarea (f); if (FRAME_XIC_STYLE (f) & XIMPreeditPosition) { - struct window *w = XWINDOW (f->selected_window); + struct window *w = XWINDOW (FVAR (f, selected_window)); xic_set_preeditarea (w, w->cursor.x, w->cursor.y); } } @@ -8942,7 +8942,7 @@ x_set_window_size (struct frame *f, int change_gravity, int cols, int rows) #endif /* not USE_GTK */ /* If cursor was outside the new size, mark it as off. */ - mark_window_cursors_off (XWINDOW (f->root_window)); + mark_window_cursors_off (XWINDOW (FVAR (f, root_window))); /* Clear out any recollection of where the mouse highlighting was, since it might be in a place that's outside the new frame size. @@ -10399,13 +10399,10 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) connection = ConnectionNumber (dpyinfo->display); dpyinfo->connection = connection; - - { - dpyinfo->gray - = XCreatePixmapFromBitmapData (dpyinfo->display, dpyinfo->root_window, - gray_bits, gray_width, gray_height, - 1, 0, 1); - } + dpyinfo->gray + = XCreatePixmapFromBitmapData (dpyinfo->display, dpyinfo->root_window, + gray_bits, gray_width, gray_height, + 1, 0, 1); #ifdef HAVE_X_I18N xim_initialize (dpyinfo, resource_name); |