aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDmitry Antipov2012-07-31 16:36:19 +0400
committerDmitry Antipov2012-07-31 16:36:19 +0400
commite34f7f79833a23586d32fe522b547a0d9a696c13 (patch)
tree4a2d3927202cb91b474bc9648ca9dee2bffaa54a /src
parentc09bfb2f140b2885af17185634451e2abfd6e91c (diff)
downloademacs-e34f7f79833a23586d32fe522b547a0d9a696c13.tar.gz
emacs-e34f7f79833a23586d32fe522b547a0d9a696c13.zip
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/ChangeLog15
-rw-r--r--src/alloc.c10
-rw-r--r--src/buffer.c19
-rw-r--r--src/buffer.h151
-rw-r--r--src/data.c4
-rw-r--r--src/dispnew.c79
-rw-r--r--src/dosfns.c6
-rw-r--r--src/eval.c2
-rw-r--r--src/frame.c128
-rw-r--r--src/frame.h61
-rw-r--r--src/fringe.c4
-rw-r--r--src/gtkutil.c24
-rw-r--r--src/keyboard.h43
-rw-r--r--src/lisp.h7
-rw-r--r--src/minibuf.c8
-rw-r--r--src/nsfns.m4
-rw-r--r--src/nsterm.m4
-rw-r--r--src/print.c2
-rw-r--r--src/term.c2
-rw-r--r--src/w32fns.c60
-rw-r--r--src/w32menu.c10
-rw-r--r--src/w32term.c22
-rw-r--r--src/window.c45
-rw-r--r--src/window.h8
-rw-r--r--src/xdisp.c127
-rw-r--r--src/xfaces.c17
-rw-r--r--src/xfns.c80
-rw-r--r--src/xmenu.c8
-rw-r--r--src/xterm.c25
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 @@
12012-07-31 Dmitry Antipov <dmantipov@yandex.ru> 12012-07-31 Dmitry Antipov <dmantipov@yandex.ru>
2 2
3 Generalize INTERNAL_FIELD between buffers, keyboards and frames.
4 * lisp.h (INTERNAL_FIELD): New macro.
5 * buffer.h (BUFFER_INTERNAL_FIELD): Removed.
6 (BVAR): Change to use INTERNAL_FIELD.
7 * keyboard.h (KBOARD_INTERNAL_FIELD): Likewise.
8 (KVAR): Change to use INTERNAL_FIELD.
9 * frame.h (FVAR): New macro.
10 (struct frame): Use INTERNAL_FIELD for all Lisp_Object fields.
11 * alloc.c, buffer.c, data.c, dispnew.c, dosfns.c, eval.c, frame.c
12 * fringe.c, gtkutil.c, minibuf.c, nsfns.m, nsterm.m, print.c
13 * term.c, w32fns.c, w32menu.c, w32term.c, window.c, window.h,
14 * xdisp.c, xfaces.c, xfns.c, xmenu.c, xterm.c: Users changed.
15
162012-07-31 Dmitry Antipov <dmantipov@yandex.ru>
17
3 Miscellaneous fixes for non-default X toolkits. 18 Miscellaneous fixes for non-default X toolkits.
4 * xfns.c (Fx_file_dialog): Change to SSDATA to avoid warnings. 19 * xfns.c (Fx_file_dialog): Change to SSDATA to avoid warnings.
5 * xterm.c (x_frame_of_widget): Remove redundant prototype. 20 * 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)
4424 must not have been killed. */ 4424 must not have been killed. */
4425 return (m->type == MEM_TYPE_BUFFER 4425 return (m->type == MEM_TYPE_BUFFER
4426 && p == m->start 4426 && p == m->start
4427 && !NILP (((struct buffer *) p)->BUFFER_INTERNAL_FIELD (name))); 4427 && !NILP (((struct buffer *) p)->INTERNAL_FIELD (name)));
4428} 4428}
4429 4429
4430#endif /* GC_MARK_STACK || defined GC_MALLOC_CHECK */ 4430#endif /* GC_MARK_STACK || defined GC_MALLOC_CHECK */
@@ -5549,10 +5549,10 @@ See Info node `(elisp)Garbage Collection'. */)
5549 turned off in that buffer. Calling truncate_undo_list on 5549 turned off in that buffer. Calling truncate_undo_list on
5550 Qt tends to return NULL, which effectively turns undo back on. 5550 Qt tends to return NULL, which effectively turns undo back on.
5551 So don't call truncate_undo_list if undo_list is Qt. */ 5551 So don't call truncate_undo_list if undo_list is Qt. */
5552 if (! EQ (nextb->BUFFER_INTERNAL_FIELD (undo_list), Qt)) 5552 if (! EQ (nextb->INTERNAL_FIELD (undo_list), Qt))
5553 { 5553 {
5554 Lisp_Object tail, prev; 5554 Lisp_Object tail, prev;
5555 tail = nextb->BUFFER_INTERNAL_FIELD (undo_list); 5555 tail = nextb->INTERNAL_FIELD (undo_list);
5556 prev = Qnil; 5556 prev = Qnil;
5557 while (CONSP (tail)) 5557 while (CONSP (tail))
5558 { 5558 {
@@ -5561,7 +5561,7 @@ See Info node `(elisp)Garbage Collection'. */)
5561 && !XMARKER (XCAR (XCAR (tail)))->gcmarkbit) 5561 && !XMARKER (XCAR (XCAR (tail)))->gcmarkbit)
5562 { 5562 {
5563 if (NILP (prev)) 5563 if (NILP (prev))
5564 nextb->BUFFER_INTERNAL_FIELD (undo_list) = tail = XCDR (tail); 5564 nextb->INTERNAL_FIELD (undo_list) = tail = XCDR (tail);
5565 else 5565 else
5566 { 5566 {
5567 tail = XCDR (tail); 5567 tail = XCDR (tail);
@@ -5577,7 +5577,7 @@ See Info node `(elisp)Garbage Collection'. */)
5577 } 5577 }
5578 /* Now that we have stripped the elements that need not be in the 5578 /* Now that we have stripped the elements that need not be in the
5579 undo_list any more, we can finally mark the list. */ 5579 undo_list any more, we can finally mark the list. */
5580 mark_object (nextb->BUFFER_INTERNAL_FIELD (undo_list)); 5580 mark_object (nextb->INTERNAL_FIELD (undo_list));
5581 } 5581 }
5582 5582
5583 gc_sweep (); 5583 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. */)
191 Lisp_Object args[3]; 191 Lisp_Object args[3];
192 192
193 CHECK_FRAME (frame); 193 CHECK_FRAME (frame);
194 framelist = Fcopy_sequence (XFRAME (frame)->buffer_list); 194 framelist = Fcopy_sequence (FVAR (XFRAME (frame), buffer_list));
195 prevlist = Fnreverse (Fcopy_sequence 195 prevlist = Fnreverse (Fcopy_sequence
196 (XFRAME (frame)->buried_buffer_list)); 196 (FVAR (XFRAME (frame), buried_buffer_list)));
197 197
198 /* Remove from GENERAL any buffer that duplicates one in 198 /* Remove from GENERAL any buffer that duplicates one in
199 FRAMELIST or PREVLIST. */ 199 FRAMELIST or PREVLIST. */
@@ -1324,7 +1324,7 @@ exists, return the buffer `*scratch*' (creating it if necessary). */)
1324 1324
1325 pred = frame_buffer_predicate (frame); 1325 pred = frame_buffer_predicate (frame);
1326 /* Consider buffers that have been seen in the frame first. */ 1326 /* Consider buffers that have been seen in the frame first. */
1327 tail = XFRAME (frame)->buffer_list; 1327 tail = FVAR (XFRAME (frame), buffer_list);
1328 for (; CONSP (tail); tail = XCDR (tail)) 1328 for (; CONSP (tail); tail = XCDR (tail))
1329 { 1329 {
1330 buf = XCAR (tail); 1330 buf = XCAR (tail);
@@ -1446,7 +1446,7 @@ compact_buffer (struct buffer *buffer)
1446 1446
1447 /* Skip dead buffers, indirect buffers and buffers 1447 /* Skip dead buffers, indirect buffers and buffers
1448 which aren't changed since last compaction. */ 1448 which aren't changed since last compaction. */
1449 if (!NILP (buffer->BUFFER_INTERNAL_FIELD (name)) 1449 if (!NILP (buffer->INTERNAL_FIELD (name))
1450 && (buffer->base_buffer == NULL) 1450 && (buffer->base_buffer == NULL)
1451 && (buffer->text->compact != buffer->text->modiff)) 1451 && (buffer->text->compact != buffer->text->modiff))
1452 { 1452 {
@@ -1454,7 +1454,7 @@ compact_buffer (struct buffer *buffer)
1454 turned off in that buffer. Calling truncate_undo_list on 1454 turned off in that buffer. Calling truncate_undo_list on
1455 Qt tends to return NULL, which effectively turns undo back on. 1455 Qt tends to return NULL, which effectively turns undo back on.
1456 So don't call truncate_undo_list if undo_list is Qt. */ 1456 So don't call truncate_undo_list if undo_list is Qt. */
1457 if (!EQ (buffer->BUFFER_INTERNAL_FIELD (undo_list), Qt)) 1457 if (!EQ (buffer->INTERNAL_FIELD (undo_list), Qt))
1458 truncate_undo_list (buffer); 1458 truncate_undo_list (buffer);
1459 1459
1460 /* Shrink buffer gaps. */ 1460 /* Shrink buffer gaps. */
@@ -1764,8 +1764,8 @@ record_buffer (Lisp_Object buffer)
1764 Vinhibit_quit = tem; 1764 Vinhibit_quit = tem;
1765 1765
1766 /* Update buffer list of selected frame. */ 1766 /* Update buffer list of selected frame. */
1767 f->buffer_list = Fcons (buffer, Fdelq (buffer, f->buffer_list)); 1767 FVAR (f, buffer_list) = Fcons (buffer, Fdelq (buffer, FVAR (f, buffer_list)));
1768 f->buried_buffer_list = Fdelq (buffer, f->buried_buffer_list); 1768 FVAR (f, buried_buffer_list) = Fdelq (buffer, FVAR (f, buried_buffer_list));
1769 1769
1770 /* Run buffer-list-update-hook. */ 1770 /* Run buffer-list-update-hook. */
1771 if (!NILP (Vrun_hooks)) 1771 if (!NILP (Vrun_hooks))
@@ -1802,8 +1802,9 @@ DEFUN ("bury-buffer-internal", Fbury_buffer_internal, Sbury_buffer_internal,
1802 Vinhibit_quit = tem; 1802 Vinhibit_quit = tem;
1803 1803
1804 /* Update buffer lists of selected frame. */ 1804 /* Update buffer lists of selected frame. */
1805 f->buffer_list = Fdelq (buffer, f->buffer_list); 1805 FVAR (f, buffer_list) = Fdelq (buffer, FVAR (f, buffer_list));
1806 f->buried_buffer_list = Fcons (buffer, Fdelq (buffer, f->buried_buffer_list)); 1806 FVAR (f, buried_buffer_list)
1807 = Fcons (buffer, Fdelq (buffer, FVAR (f, buried_buffer_list)));
1807 1808
1808 /* Run buffer-list-update-hook. */ 1809 /* Run buffer-list-update-hook. */
1809 if (!NILP (Vrun_hooks)) 1810 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
472 int inhibit_shrinking; 472 int inhibit_shrinking;
473 }; 473 };
474 474
475/* Lisp fields in struct buffer are hidden from most code and accessed 475/* Most code should use this macro to access Lisp fields in struct buffer. */
476 via the BVAR macro, below. Only select pieces of code, like the GC,
477 are allowed to use BUFFER_INTERNAL_FIELD. */
478#define BUFFER_INTERNAL_FIELD(field) field ## _
479 476
480/* Most code should use this macro to access Lisp fields in struct 477#define BVAR(buf, field) ((buf)->INTERNAL_FIELD (field))
481 buffer. */
482#define BVAR(buf, field) ((buf)->BUFFER_INTERNAL_FIELD (field))
483 478
484/* This is the structure that the buffer Lisp object points to. */ 479/* This is the structure that the buffer Lisp object points to. */
485 480
@@ -493,17 +488,17 @@ struct buffer
493 struct vectorlike_header header; 488 struct vectorlike_header header;
494 489
495 /* The name of this buffer. */ 490 /* The name of this buffer. */
496 Lisp_Object BUFFER_INTERNAL_FIELD (name); 491 Lisp_Object INTERNAL_FIELD (name);
497 492
498 /* The name of the file visited in this buffer, or nil. */ 493 /* The name of the file visited in this buffer, or nil. */
499 Lisp_Object BUFFER_INTERNAL_FIELD (filename); 494 Lisp_Object INTERNAL_FIELD (filename);
500 495
501 /* Directory for expanding relative file names. */ 496 /* Directory for expanding relative file names. */
502 Lisp_Object BUFFER_INTERNAL_FIELD (directory); 497 Lisp_Object INTERNAL_FIELD (directory);
503 498
504 /* True if this buffer has been backed up (if you write to the visited 499 /* True if this buffer has been backed up (if you write to the visited
505 file and it hasn't been backed up, then a backup will be made). */ 500 file and it hasn't been backed up, then a backup will be made). */
506 Lisp_Object BUFFER_INTERNAL_FIELD (backed_up); 501 Lisp_Object INTERNAL_FIELD (backed_up);
507 502
508 /* Length of file when last read or saved. 503 /* Length of file when last read or saved.
509 -1 means auto saving turned off because buffer shrank a lot. 504 -1 means auto saving turned off because buffer shrank a lot.
@@ -511,132 +506,132 @@ struct buffer
511 (That value is used with buffer-swap-text.) 506 (That value is used with buffer-swap-text.)
512 This is not in the struct buffer_text 507 This is not in the struct buffer_text
513 because it's not used in indirect buffers at all. */ 508 because it's not used in indirect buffers at all. */
514 Lisp_Object BUFFER_INTERNAL_FIELD (save_length); 509 Lisp_Object INTERNAL_FIELD (save_length);
515 510
516 /* File name used for auto-saving this buffer. 511 /* File name used for auto-saving this buffer.
517 This is not in the struct buffer_text 512 This is not in the struct buffer_text
518 because it's not used in indirect buffers at all. */ 513 because it's not used in indirect buffers at all. */
519 Lisp_Object BUFFER_INTERNAL_FIELD (auto_save_file_name); 514 Lisp_Object INTERNAL_FIELD (auto_save_file_name);
520 515
521 /* Non-nil if buffer read-only. */ 516 /* Non-nil if buffer read-only. */
522 Lisp_Object BUFFER_INTERNAL_FIELD (read_only); 517 Lisp_Object INTERNAL_FIELD (read_only);
523 518
524 /* "The mark". This is a marker which may 519 /* "The mark". This is a marker which may
525 point into this buffer or may point nowhere. */ 520 point into this buffer or may point nowhere. */
526 Lisp_Object BUFFER_INTERNAL_FIELD (mark); 521 Lisp_Object INTERNAL_FIELD (mark);
527 522
528 /* Alist of elements (SYMBOL . VALUE-IN-THIS-BUFFER) for all 523 /* Alist of elements (SYMBOL . VALUE-IN-THIS-BUFFER) for all
529 per-buffer variables of this buffer. For locally unbound 524 per-buffer variables of this buffer. For locally unbound
530 symbols, just the symbol appears as the element. */ 525 symbols, just the symbol appears as the element. */
531 Lisp_Object BUFFER_INTERNAL_FIELD (local_var_alist); 526 Lisp_Object INTERNAL_FIELD (local_var_alist);
532 527
533 /* Symbol naming major mode (e.g., lisp-mode). */ 528 /* Symbol naming major mode (e.g., lisp-mode). */
534 Lisp_Object BUFFER_INTERNAL_FIELD (major_mode); 529 Lisp_Object INTERNAL_FIELD (major_mode);
535 530
536 /* Pretty name of major mode (e.g., "Lisp"). */ 531 /* Pretty name of major mode (e.g., "Lisp"). */
537 Lisp_Object BUFFER_INTERNAL_FIELD (mode_name); 532 Lisp_Object INTERNAL_FIELD (mode_name);
538 533
539 /* Mode line element that controls format of mode line. */ 534 /* Mode line element that controls format of mode line. */
540 Lisp_Object BUFFER_INTERNAL_FIELD (mode_line_format); 535 Lisp_Object INTERNAL_FIELD (mode_line_format);
541 536
542 /* Analogous to mode_line_format for the line displayed at the top 537 /* Analogous to mode_line_format for the line displayed at the top
543 of windows. Nil means don't display that line. */ 538 of windows. Nil means don't display that line. */
544 Lisp_Object BUFFER_INTERNAL_FIELD (header_line_format); 539 Lisp_Object INTERNAL_FIELD (header_line_format);
545 540
546 /* Keys that are bound local to this buffer. */ 541 /* Keys that are bound local to this buffer. */
547 Lisp_Object BUFFER_INTERNAL_FIELD (keymap); 542 Lisp_Object INTERNAL_FIELD (keymap);
548 543
549 /* This buffer's local abbrev table. */ 544 /* This buffer's local abbrev table. */
550 Lisp_Object BUFFER_INTERNAL_FIELD (abbrev_table); 545 Lisp_Object INTERNAL_FIELD (abbrev_table);
551 546
552 /* This buffer's syntax table. */ 547 /* This buffer's syntax table. */
553 Lisp_Object BUFFER_INTERNAL_FIELD (syntax_table); 548 Lisp_Object INTERNAL_FIELD (syntax_table);
554 549
555 /* This buffer's category table. */ 550 /* This buffer's category table. */
556 Lisp_Object BUFFER_INTERNAL_FIELD (category_table); 551 Lisp_Object INTERNAL_FIELD (category_table);
557 552
558 /* Values of several buffer-local variables. */ 553 /* Values of several buffer-local variables. */
559 /* tab-width is buffer-local so that redisplay can find it 554 /* tab-width is buffer-local so that redisplay can find it
560 in buffers that are not current. */ 555 in buffers that are not current. */
561 Lisp_Object BUFFER_INTERNAL_FIELD (case_fold_search); 556 Lisp_Object INTERNAL_FIELD (case_fold_search);
562 Lisp_Object BUFFER_INTERNAL_FIELD (tab_width); 557 Lisp_Object INTERNAL_FIELD (tab_width);
563 Lisp_Object BUFFER_INTERNAL_FIELD (fill_column); 558 Lisp_Object INTERNAL_FIELD (fill_column);
564 Lisp_Object BUFFER_INTERNAL_FIELD (left_margin); 559 Lisp_Object INTERNAL_FIELD (left_margin);
565 560
566 /* Function to call when insert space past fill column. */ 561 /* Function to call when insert space past fill column. */
567 Lisp_Object BUFFER_INTERNAL_FIELD (auto_fill_function); 562 Lisp_Object INTERNAL_FIELD (auto_fill_function);
568 563
569 /* Case table for case-conversion in this buffer. 564 /* Case table for case-conversion in this buffer.
570 This char-table maps each char into its lower-case version. */ 565 This char-table maps each char into its lower-case version. */
571 Lisp_Object BUFFER_INTERNAL_FIELD (downcase_table); 566 Lisp_Object INTERNAL_FIELD (downcase_table);
572 567
573 /* Char-table mapping each char to its upper-case version. */ 568 /* Char-table mapping each char to its upper-case version. */
574 Lisp_Object BUFFER_INTERNAL_FIELD (upcase_table); 569 Lisp_Object INTERNAL_FIELD (upcase_table);
575 570
576 /* Char-table for conversion for case-folding search. */ 571 /* Char-table for conversion for case-folding search. */
577 Lisp_Object BUFFER_INTERNAL_FIELD (case_canon_table); 572 Lisp_Object INTERNAL_FIELD (case_canon_table);
578 573
579 /* Char-table of equivalences for case-folding search. */ 574 /* Char-table of equivalences for case-folding search. */
580 Lisp_Object BUFFER_INTERNAL_FIELD (case_eqv_table); 575 Lisp_Object INTERNAL_FIELD (case_eqv_table);
581 576
582 /* Non-nil means do not display continuation lines. */ 577 /* Non-nil means do not display continuation lines. */
583 Lisp_Object BUFFER_INTERNAL_FIELD (truncate_lines); 578 Lisp_Object INTERNAL_FIELD (truncate_lines);
584 579
585 /* Non-nil means to use word wrapping when displaying continuation lines. */ 580 /* Non-nil means to use word wrapping when displaying continuation lines. */
586 Lisp_Object BUFFER_INTERNAL_FIELD (word_wrap); 581 Lisp_Object INTERNAL_FIELD (word_wrap);
587 582
588 /* Non-nil means display ctl chars with uparrow. */ 583 /* Non-nil means display ctl chars with uparrow. */
589 Lisp_Object BUFFER_INTERNAL_FIELD (ctl_arrow); 584 Lisp_Object INTERNAL_FIELD (ctl_arrow);
590 585
591 /* Non-nil means reorder bidirectional text for display in the 586 /* Non-nil means reorder bidirectional text for display in the
592 visual order. */ 587 visual order. */
593 Lisp_Object BUFFER_INTERNAL_FIELD (bidi_display_reordering); 588 Lisp_Object INTERNAL_FIELD (bidi_display_reordering);
594 589
595 /* If non-nil, specifies which direction of text to force in all the 590 /* If non-nil, specifies which direction of text to force in all the
596 paragraphs of the buffer. Nil means determine paragraph 591 paragraphs of the buffer. Nil means determine paragraph
597 direction dynamically for each paragraph. */ 592 direction dynamically for each paragraph. */
598 Lisp_Object BUFFER_INTERNAL_FIELD (bidi_paragraph_direction); 593 Lisp_Object INTERNAL_FIELD (bidi_paragraph_direction);
599 594
600 /* Non-nil means do selective display; 595 /* Non-nil means do selective display;
601 see doc string in syms_of_buffer (buffer.c) for details. */ 596 see doc string in syms_of_buffer (buffer.c) for details. */
602 Lisp_Object BUFFER_INTERNAL_FIELD (selective_display); 597 Lisp_Object INTERNAL_FIELD (selective_display);
603 598
604 /* Non-nil means show ... at end of line followed by invisible lines. */ 599 /* Non-nil means show ... at end of line followed by invisible lines. */
605 Lisp_Object BUFFER_INTERNAL_FIELD (selective_display_ellipses); 600 Lisp_Object INTERNAL_FIELD (selective_display_ellipses);
606 601
607 /* Alist of (FUNCTION . STRING) for each minor mode enabled in buffer. */ 602 /* Alist of (FUNCTION . STRING) for each minor mode enabled in buffer. */
608 Lisp_Object BUFFER_INTERNAL_FIELD (minor_modes); 603 Lisp_Object INTERNAL_FIELD (minor_modes);
609 604
610 /* t if "self-insertion" should overwrite; `binary' if it should also 605 /* t if "self-insertion" should overwrite; `binary' if it should also
611 overwrite newlines and tabs - for editing executables and the like. */ 606 overwrite newlines and tabs - for editing executables and the like. */
612 Lisp_Object BUFFER_INTERNAL_FIELD (overwrite_mode); 607 Lisp_Object INTERNAL_FIELD (overwrite_mode);
613 608
614 /* Non-nil means abbrev mode is on. Expand abbrevs automatically. */ 609 /* Non-nil means abbrev mode is on. Expand abbrevs automatically. */
615 Lisp_Object BUFFER_INTERNAL_FIELD (abbrev_mode); 610 Lisp_Object INTERNAL_FIELD (abbrev_mode);
616 611
617 /* Display table to use for text in this buffer. */ 612 /* Display table to use for text in this buffer. */
618 Lisp_Object BUFFER_INTERNAL_FIELD (display_table); 613 Lisp_Object INTERNAL_FIELD (display_table);
619 614
620 /* t means the mark and region are currently active. */ 615 /* t means the mark and region are currently active. */
621 Lisp_Object BUFFER_INTERNAL_FIELD (mark_active); 616 Lisp_Object INTERNAL_FIELD (mark_active);
622 617
623 /* Non-nil means the buffer contents are regarded as multi-byte 618 /* Non-nil means the buffer contents are regarded as multi-byte
624 form of characters, not a binary code. */ 619 form of characters, not a binary code. */
625 Lisp_Object BUFFER_INTERNAL_FIELD (enable_multibyte_characters); 620 Lisp_Object INTERNAL_FIELD (enable_multibyte_characters);
626 621
627 /* Coding system to be used for encoding the buffer contents on 622 /* Coding system to be used for encoding the buffer contents on
628 saving. */ 623 saving. */
629 Lisp_Object BUFFER_INTERNAL_FIELD (buffer_file_coding_system); 624 Lisp_Object INTERNAL_FIELD (buffer_file_coding_system);
630 625
631 /* List of symbols naming the file format used for visited file. */ 626 /* List of symbols naming the file format used for visited file. */
632 Lisp_Object BUFFER_INTERNAL_FIELD (file_format); 627 Lisp_Object INTERNAL_FIELD (file_format);
633 628
634 /* List of symbols naming the file format used for auto-save file. */ 629 /* List of symbols naming the file format used for auto-save file. */
635 Lisp_Object BUFFER_INTERNAL_FIELD (auto_save_file_format); 630 Lisp_Object INTERNAL_FIELD (auto_save_file_format);
636 631
637 /* True if the newline position cache and width run cache are 632 /* True if the newline position cache and width run cache are
638 enabled. See search.c and indent.c. */ 633 enabled. See search.c and indent.c. */
639 Lisp_Object BUFFER_INTERNAL_FIELD (cache_long_line_scans); 634 Lisp_Object INTERNAL_FIELD (cache_long_line_scans);
640 635
641 /* If the width run cache is enabled, this table contains the 636 /* If the width run cache is enabled, this table contains the
642 character widths width_run_cache (see above) assumes. When we 637 character widths width_run_cache (see above) assumes. When we
@@ -644,102 +639,102 @@ struct buffer
644 current display table to see whether the display table has 639 current display table to see whether the display table has
645 affected the widths of any characters. If it has, we 640 affected the widths of any characters. If it has, we
646 invalidate the width run cache, and re-initialize width_table. */ 641 invalidate the width run cache, and re-initialize width_table. */
647 Lisp_Object BUFFER_INTERNAL_FIELD (width_table); 642 Lisp_Object INTERNAL_FIELD (width_table);
648 643
649 /* In an indirect buffer, or a buffer that is the base of an 644 /* In an indirect buffer, or a buffer that is the base of an
650 indirect buffer, this holds a marker that records 645 indirect buffer, this holds a marker that records
651 PT for this buffer when the buffer is not current. */ 646 PT for this buffer when the buffer is not current. */
652 Lisp_Object BUFFER_INTERNAL_FIELD (pt_marker); 647 Lisp_Object INTERNAL_FIELD (pt_marker);
653 648
654 /* In an indirect buffer, or a buffer that is the base of an 649 /* In an indirect buffer, or a buffer that is the base of an
655 indirect buffer, this holds a marker that records 650 indirect buffer, this holds a marker that records
656 BEGV for this buffer when the buffer is not current. */ 651 BEGV for this buffer when the buffer is not current. */
657 Lisp_Object BUFFER_INTERNAL_FIELD (begv_marker); 652 Lisp_Object INTERNAL_FIELD (begv_marker);
658 653
659 /* In an indirect buffer, or a buffer that is the base of an 654 /* In an indirect buffer, or a buffer that is the base of an
660 indirect buffer, this holds a marker that records 655 indirect buffer, this holds a marker that records
661 ZV for this buffer when the buffer is not current. */ 656 ZV for this buffer when the buffer is not current. */
662 Lisp_Object BUFFER_INTERNAL_FIELD (zv_marker); 657 Lisp_Object INTERNAL_FIELD (zv_marker);
663 658
664 /* This holds the point value before the last scroll operation. 659 /* This holds the point value before the last scroll operation.
665 Explicitly setting point sets this to nil. */ 660 Explicitly setting point sets this to nil. */
666 Lisp_Object BUFFER_INTERNAL_FIELD (point_before_scroll); 661 Lisp_Object INTERNAL_FIELD (point_before_scroll);
667 662
668 /* Truename of the visited file, or nil. */ 663 /* Truename of the visited file, or nil. */
669 Lisp_Object BUFFER_INTERNAL_FIELD (file_truename); 664 Lisp_Object INTERNAL_FIELD (file_truename);
670 665
671 /* Invisibility spec of this buffer. 666 /* Invisibility spec of this buffer.
672 t => any non-nil `invisible' property means invisible. 667 t => any non-nil `invisible' property means invisible.
673 A list => `invisible' property means invisible 668 A list => `invisible' property means invisible
674 if it is memq in that list. */ 669 if it is memq in that list. */
675 Lisp_Object BUFFER_INTERNAL_FIELD (invisibility_spec); 670 Lisp_Object INTERNAL_FIELD (invisibility_spec);
676 671
677 /* This is the last window that was selected with this buffer in it, 672 /* This is the last window that was selected with this buffer in it,
678 or nil if that window no longer displays this buffer. */ 673 or nil if that window no longer displays this buffer. */
679 Lisp_Object BUFFER_INTERNAL_FIELD (last_selected_window); 674 Lisp_Object INTERNAL_FIELD (last_selected_window);
680 675
681 /* Incremented each time the buffer is displayed in a window. */ 676 /* Incremented each time the buffer is displayed in a window. */
682 Lisp_Object BUFFER_INTERNAL_FIELD (display_count); 677 Lisp_Object INTERNAL_FIELD (display_count);
683 678
684 /* Widths of left and right marginal areas for windows displaying 679 /* Widths of left and right marginal areas for windows displaying
685 this buffer. */ 680 this buffer. */
686 Lisp_Object BUFFER_INTERNAL_FIELD (left_margin_cols); 681 Lisp_Object INTERNAL_FIELD (left_margin_cols);
687 Lisp_Object BUFFER_INTERNAL_FIELD (right_margin_cols); 682 Lisp_Object INTERNAL_FIELD (right_margin_cols);
688 683
689 /* Widths of left and right fringe areas for windows displaying 684 /* Widths of left and right fringe areas for windows displaying
690 this buffer. */ 685 this buffer. */
691 Lisp_Object BUFFER_INTERNAL_FIELD (left_fringe_width); 686 Lisp_Object INTERNAL_FIELD (left_fringe_width);
692 Lisp_Object BUFFER_INTERNAL_FIELD (right_fringe_width); 687 Lisp_Object INTERNAL_FIELD (right_fringe_width);
693 688
694 /* Non-nil means fringes are drawn outside display margins; 689 /* Non-nil means fringes are drawn outside display margins;
695 othersize draw them between margin areas and text. */ 690 othersize draw them between margin areas and text. */
696 Lisp_Object BUFFER_INTERNAL_FIELD (fringes_outside_margins); 691 Lisp_Object INTERNAL_FIELD (fringes_outside_margins);
697 692
698 /* Width and type of scroll bar areas for windows displaying 693 /* Width and type of scroll bar areas for windows displaying
699 this buffer. */ 694 this buffer. */
700 Lisp_Object BUFFER_INTERNAL_FIELD (scroll_bar_width); 695 Lisp_Object INTERNAL_FIELD (scroll_bar_width);
701 Lisp_Object BUFFER_INTERNAL_FIELD (vertical_scroll_bar_type); 696 Lisp_Object INTERNAL_FIELD (vertical_scroll_bar_type);
702 697
703 /* Non-nil means indicate lines not displaying text (in a style 698 /* Non-nil means indicate lines not displaying text (in a style
704 like vi). */ 699 like vi). */
705 Lisp_Object BUFFER_INTERNAL_FIELD (indicate_empty_lines); 700 Lisp_Object INTERNAL_FIELD (indicate_empty_lines);
706 701
707 /* Non-nil means indicate buffer boundaries and scrolling. */ 702 /* Non-nil means indicate buffer boundaries and scrolling. */
708 Lisp_Object BUFFER_INTERNAL_FIELD (indicate_buffer_boundaries); 703 Lisp_Object INTERNAL_FIELD (indicate_buffer_boundaries);
709 704
710 /* Logical to physical fringe bitmap mappings. */ 705 /* Logical to physical fringe bitmap mappings. */
711 Lisp_Object BUFFER_INTERNAL_FIELD (fringe_indicator_alist); 706 Lisp_Object INTERNAL_FIELD (fringe_indicator_alist);
712 707
713 /* Logical to physical cursor bitmap mappings. */ 708 /* Logical to physical cursor bitmap mappings. */
714 Lisp_Object BUFFER_INTERNAL_FIELD (fringe_cursor_alist); 709 Lisp_Object INTERNAL_FIELD (fringe_cursor_alist);
715 710
716 /* Time stamp updated each time this buffer is displayed in a window. */ 711 /* Time stamp updated each time this buffer is displayed in a window. */
717 Lisp_Object BUFFER_INTERNAL_FIELD (display_time); 712 Lisp_Object INTERNAL_FIELD (display_time);
718 713
719 /* If scrolling the display because point is below the bottom of a 714 /* If scrolling the display because point is below the bottom of a
720 window showing this buffer, try to choose a window start so 715 window showing this buffer, try to choose a window start so
721 that point ends up this number of lines from the top of the 716 that point ends up this number of lines from the top of the
722 window. Nil means that scrolling method isn't used. */ 717 window. Nil means that scrolling method isn't used. */
723 Lisp_Object BUFFER_INTERNAL_FIELD (scroll_up_aggressively); 718 Lisp_Object INTERNAL_FIELD (scroll_up_aggressively);
724 719
725 /* If scrolling the display because point is above the top of a 720 /* If scrolling the display because point is above the top of a
726 window showing this buffer, try to choose a window start so 721 window showing this buffer, try to choose a window start so
727 that point ends up this number of lines from the bottom of the 722 that point ends up this number of lines from the bottom of the
728 window. Nil means that scrolling method isn't used. */ 723 window. Nil means that scrolling method isn't used. */
729 Lisp_Object BUFFER_INTERNAL_FIELD (scroll_down_aggressively); 724 Lisp_Object INTERNAL_FIELD (scroll_down_aggressively);
730 725
731 /* Desired cursor type in this buffer. See the doc string of 726 /* Desired cursor type in this buffer. See the doc string of
732 per-buffer variable `cursor-type'. */ 727 per-buffer variable `cursor-type'. */
733 Lisp_Object BUFFER_INTERNAL_FIELD (cursor_type); 728 Lisp_Object INTERNAL_FIELD (cursor_type);
734 729
735 /* An integer > 0 means put that number of pixels below text lines 730 /* An integer > 0 means put that number of pixels below text lines
736 in the display of this buffer. */ 731 in the display of this buffer. */
737 Lisp_Object BUFFER_INTERNAL_FIELD (extra_line_spacing); 732 Lisp_Object INTERNAL_FIELD (extra_line_spacing);
738 733
739 /* Cursor type to display in non-selected windows. 734 /* Cursor type to display in non-selected windows.
740 t means to use hollow box cursor. 735 t means to use hollow box cursor.
741 See `cursor-type' for other values. */ 736 See `cursor-type' for other values. */
742 Lisp_Object BUFFER_INTERNAL_FIELD (cursor_in_non_selected_windows); 737 Lisp_Object INTERNAL_FIELD (cursor_in_non_selected_windows);
743 738
744 /* No more Lisp_Object beyond this point. Except undo_list, 739 /* No more Lisp_Object beyond this point. Except undo_list,
745 which is handled specially in Fgarbage_collect . */ 740 which is handled specially in Fgarbage_collect . */
@@ -861,7 +856,7 @@ struct buffer
861 buffer of an indirect buffer. But we can't store it in the 856 buffer of an indirect buffer. But we can't store it in the
862 struct buffer_text because local variables have to be right in 857 struct buffer_text because local variables have to be right in
863 the struct buffer. So we copy it around in set_buffer_internal. */ 858 the struct buffer. So we copy it around in set_buffer_internal. */
864 Lisp_Object BUFFER_INTERNAL_FIELD (undo_list); 859 Lisp_Object INTERNAL_FIELD (undo_list);
865}; 860};
866 861
867 862
@@ -1020,7 +1015,7 @@ extern int last_per_buffer_idx;
1020 from the start of a buffer structure. */ 1015 from the start of a buffer structure. */
1021 1016
1022#define PER_BUFFER_VAR_OFFSET(VAR) \ 1017#define PER_BUFFER_VAR_OFFSET(VAR) \
1023 offsetof (struct buffer, BUFFER_INTERNAL_FIELD (VAR)) 1018 offsetof (struct buffer, INTERNAL_FIELD (VAR))
1024 1019
1025/* Used to iterate over normal Lisp_Object fields of struct buffer (all 1020/* Used to iterate over normal Lisp_Object fields of struct buffer (all
1026 Lisp_Objects except undo_list). If you add, remove, or reorder 1021 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_
1006 XSETSYMBOL (var, symbol); 1006 XSETSYMBOL (var, symbol);
1007 if (blv->frame_local) 1007 if (blv->frame_local)
1008 { 1008 {
1009 tem1 = assq_no_quit (var, XFRAME (selected_frame)->param_alist); 1009 tem1 = assq_no_quit (var, FVAR (XFRAME (selected_frame), param_alist));
1010 blv->where = selected_frame; 1010 blv->where = selected_frame;
1011 } 1011 }
1012 else 1012 else
@@ -1179,7 +1179,7 @@ set_internal (register Lisp_Object symbol, register Lisp_Object newval, register
1179 XSETSYMBOL (symbol, sym); /* May have changed via aliasing. */ 1179 XSETSYMBOL (symbol, sym); /* May have changed via aliasing. */
1180 tem1 = Fassq (symbol, 1180 tem1 = Fassq (symbol,
1181 (blv->frame_local 1181 (blv->frame_local
1182 ? XFRAME (where)->param_alist 1182 ? FVAR (XFRAME (where), param_alist)
1183 : BVAR (XBUFFER (where), local_var_alist))); 1183 : BVAR (XBUFFER (where), local_var_alist)));
1184 blv->where = where; 1184 blv->where = where;
1185 blv->found = 1; 1185 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)
841 /* Clear the matrix of the menu bar window, if such a window exists. 841 /* Clear the matrix of the menu bar window, if such a window exists.
842 The menu bar window is currently used to display menus on X when 842 The menu bar window is currently used to display menus on X when
843 no toolkit support is compiled in. */ 843 no toolkit support is compiled in. */
844 if (WINDOWP (f->menu_bar_window)) 844 if (WINDOWP (FVAR (f, menu_bar_window)))
845 clear_glyph_matrix (XWINDOW (f->menu_bar_window)->current_matrix); 845 clear_glyph_matrix (XWINDOW (FVAR (f, menu_bar_window))->current_matrix);
846 846
847 /* Clear the matrix of the tool-bar window, if any. */ 847 /* Clear the matrix of the tool-bar window, if any. */
848 if (WINDOWP (f->tool_bar_window)) 848 if (WINDOWP (FVAR (f, tool_bar_window)))
849 clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix); 849 clear_glyph_matrix (XWINDOW (FVAR (f, tool_bar_window))->current_matrix);
850 850
851 /* Clear current window matrices. */ 851 /* Clear current window matrices. */
852 eassert (WINDOWP (FRAME_ROOT_WINDOW (f))); 852 eassert (WINDOWP (FRAME_ROOT_WINDOW (f)));
@@ -862,11 +862,11 @@ clear_desired_matrices (register struct frame *f)
862 if (f->desired_matrix) 862 if (f->desired_matrix)
863 clear_glyph_matrix (f->desired_matrix); 863 clear_glyph_matrix (f->desired_matrix);
864 864
865 if (WINDOWP (f->menu_bar_window)) 865 if (WINDOWP (FVAR (f, menu_bar_window)))
866 clear_glyph_matrix (XWINDOW (f->menu_bar_window)->desired_matrix); 866 clear_glyph_matrix (XWINDOW (FVAR (f, menu_bar_window))->desired_matrix);
867 867
868 if (WINDOWP (f->tool_bar_window)) 868 if (WINDOWP (FVAR (f, tool_bar_window)))
869 clear_glyph_matrix (XWINDOW (f->tool_bar_window)->desired_matrix); 869 clear_glyph_matrix (XWINDOW (FVAR (f, tool_bar_window))->desired_matrix);
870 870
871 /* Do it for window matrices. */ 871 /* Do it for window matrices. */
872 eassert (WINDOWP (FRAME_ROOT_WINDOW (f))); 872 eassert (WINDOWP (FRAME_ROOT_WINDOW (f)));
@@ -1901,7 +1901,7 @@ static void
1901adjust_frame_glyphs_initially (void) 1901adjust_frame_glyphs_initially (void)
1902{ 1902{
1903 struct frame *sf = SELECTED_FRAME (); 1903 struct frame *sf = SELECTED_FRAME ();
1904 struct window *root = XWINDOW (sf->root_window); 1904 struct window *root = XWINDOW (FVAR (sf, root_window));
1905 struct window *mini = XWINDOW (root->next); 1905 struct window *mini = XWINDOW (root->next);
1906 int frame_lines = FRAME_LINES (sf); 1906 int frame_lines = FRAME_LINES (sf);
1907 int frame_cols = FRAME_COLS (sf); 1907 int frame_cols = FRAME_COLS (sf);
@@ -2184,15 +2184,15 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f)
2184 { 2184 {
2185 /* Allocate a dummy window if not already done. */ 2185 /* Allocate a dummy window if not already done. */
2186 struct window *w; 2186 struct window *w;
2187 if (NILP (f->menu_bar_window)) 2187 if (NILP (FVAR (f, menu_bar_window)))
2188 { 2188 {
2189 f->menu_bar_window = make_window (); 2189 FVAR (f, menu_bar_window) = make_window ();
2190 w = XWINDOW (f->menu_bar_window); 2190 w = XWINDOW (FVAR (f, menu_bar_window));
2191 XSETFRAME (w->frame, f); 2191 XSETFRAME (w->frame, f);
2192 w->pseudo_window_p = 1; 2192 w->pseudo_window_p = 1;
2193 } 2193 }
2194 else 2194 else
2195 w = XWINDOW (f->menu_bar_window); 2195 w = XWINDOW (FVAR (f, menu_bar_window));
2196 2196
2197 /* Set window dimensions to frame dimensions and allocate or 2197 /* Set window dimensions to frame dimensions and allocate or
2198 adjust glyph matrices of W. */ 2198 adjust glyph matrices of W. */
@@ -2210,15 +2210,15 @@ adjust_frame_glyphs_for_window_redisplay (struct frame *f)
2210 /* Allocate/ reallocate matrices of the tool bar window. If we 2210 /* Allocate/ reallocate matrices of the tool bar window. If we
2211 don't have a tool bar window yet, make one. */ 2211 don't have a tool bar window yet, make one. */
2212 struct window *w; 2212 struct window *w;
2213 if (NILP (f->tool_bar_window)) 2213 if (NILP (FVAR (f, tool_bar_window)))
2214 { 2214 {
2215 f->tool_bar_window = make_window (); 2215 FVAR (f, tool_bar_window) = make_window ();
2216 w = XWINDOW (f->tool_bar_window); 2216 w = XWINDOW (FVAR (f, tool_bar_window));
2217 XSETFRAME (w->frame, f); 2217 XSETFRAME (w->frame, f);
2218 w->pseudo_window_p = 1; 2218 w->pseudo_window_p = 1;
2219 } 2219 }
2220 else 2220 else
2221 w = XWINDOW (f->tool_bar_window); 2221 w = XWINDOW (FVAR (f, tool_bar_window));
2222 2222
2223 XSETFASTINT (w->top_line, FRAME_MENU_BAR_LINES (f)); 2223 XSETFASTINT (w->top_line, FRAME_MENU_BAR_LINES (f));
2224 XSETFASTINT (w->left_col, 0); 2224 XSETFASTINT (w->left_col, 0);
@@ -2278,28 +2278,28 @@ free_glyphs (struct frame *f)
2278 f->glyphs_initialized_p = 0; 2278 f->glyphs_initialized_p = 0;
2279 2279
2280 /* Release window sub-matrices. */ 2280 /* Release window sub-matrices. */
2281 if (!NILP (f->root_window)) 2281 if (!NILP (FVAR (f, root_window)))
2282 free_window_matrices (XWINDOW (f->root_window)); 2282 free_window_matrices (XWINDOW (FVAR (f, root_window)));
2283 2283
2284 /* Free the dummy window for menu bars without X toolkit and its 2284 /* Free the dummy window for menu bars without X toolkit and its
2285 glyph matrices. */ 2285 glyph matrices. */
2286 if (!NILP (f->menu_bar_window)) 2286 if (!NILP (FVAR (f, menu_bar_window)))
2287 { 2287 {
2288 struct window *w = XWINDOW (f->menu_bar_window); 2288 struct window *w = XWINDOW (FVAR (f, menu_bar_window));
2289 free_glyph_matrix (w->desired_matrix); 2289 free_glyph_matrix (w->desired_matrix);
2290 free_glyph_matrix (w->current_matrix); 2290 free_glyph_matrix (w->current_matrix);
2291 w->desired_matrix = w->current_matrix = NULL; 2291 w->desired_matrix = w->current_matrix = NULL;
2292 f->menu_bar_window = Qnil; 2292 FVAR (f, menu_bar_window) = Qnil;
2293 } 2293 }
2294 2294
2295 /* Free the tool bar window and its glyph matrices. */ 2295 /* Free the tool bar window and its glyph matrices. */
2296 if (!NILP (f->tool_bar_window)) 2296 if (!NILP (FVAR (f, tool_bar_window)))
2297 { 2297 {
2298 struct window *w = XWINDOW (f->tool_bar_window); 2298 struct window *w = XWINDOW (FVAR (f, tool_bar_window));
2299 free_glyph_matrix (w->desired_matrix); 2299 free_glyph_matrix (w->desired_matrix);
2300 free_glyph_matrix (w->current_matrix); 2300 free_glyph_matrix (w->current_matrix);
2301 w->desired_matrix = w->current_matrix = NULL; 2301 w->desired_matrix = w->current_matrix = NULL;
2302 f->tool_bar_window = Qnil; 2302 FVAR (f, tool_bar_window) = Qnil;
2303 } 2303 }
2304 2304
2305 /* Release frame glyph matrices. Reset fields to zero in 2305 /* Release frame glyph matrices. Reset fields to zero in
@@ -2722,7 +2722,7 @@ make_current (struct glyph_matrix *desired_matrix, struct glyph_matrix *current_
2722 /* If we are called on frame matrices, perform analogous operations 2722 /* If we are called on frame matrices, perform analogous operations
2723 for window matrices. */ 2723 for window matrices. */
2724 if (frame_matrix_frame) 2724 if (frame_matrix_frame)
2725 mirror_make_current (XWINDOW (frame_matrix_frame->root_window), row); 2725 mirror_make_current (XWINDOW (FVAR (frame_matrix_frame, root_window)), row);
2726} 2726}
2727 2727
2728 2728
@@ -2820,7 +2820,7 @@ mirrored_line_dance (struct glyph_matrix *matrix, int unchanged_at_top, int nlin
2820 2820
2821 /* Do the same for window matrices, if MATRIX is a frame matrix. */ 2821 /* Do the same for window matrices, if MATRIX is a frame matrix. */
2822 if (frame_matrix_frame) 2822 if (frame_matrix_frame)
2823 mirror_line_dance (XWINDOW (frame_matrix_frame->root_window), 2823 mirror_line_dance (XWINDOW (FVAR (frame_matrix_frame, root_window)),
2824 unchanged_at_top, nlines, copy_from, retained_p); 2824 unchanged_at_top, nlines, copy_from, retained_p);
2825} 2825}
2826 2826
@@ -3183,7 +3183,7 @@ update_frame (struct frame *f, int force_p, int inhibit_hairy_id_p)
3183{ 3183{
3184 /* 1 means display has been paused because of pending input. */ 3184 /* 1 means display has been paused because of pending input. */
3185 int paused_p; 3185 int paused_p;
3186 struct window *root_window = XWINDOW (f->root_window); 3186 struct window *root_window = XWINDOW (FVAR (f, root_window));
3187 3187
3188 if (redisplay_dont_pause) 3188 if (redisplay_dont_pause)
3189 force_p = 1; 3189 force_p = 1;
@@ -3218,13 +3218,13 @@ update_frame (struct frame *f, int force_p, int inhibit_hairy_id_p)
3218 3218
3219 /* Update the menu bar on X frames that don't have toolkit 3219 /* Update the menu bar on X frames that don't have toolkit
3220 support. */ 3220 support. */
3221 if (WINDOWP (f->menu_bar_window)) 3221 if (WINDOWP (FVAR (f, menu_bar_window)))
3222 update_window (XWINDOW (f->menu_bar_window), 1); 3222 update_window (XWINDOW (FVAR (f, menu_bar_window)), 1);
3223 3223
3224 /* Update the tool-bar window, if present. */ 3224 /* Update the tool-bar window, if present. */
3225 if (WINDOWP (f->tool_bar_window)) 3225 if (WINDOWP (FVAR (f, tool_bar_window)))
3226 { 3226 {
3227 struct window *w = XWINDOW (f->tool_bar_window); 3227 struct window *w = XWINDOW (FVAR (f, tool_bar_window));
3228 3228
3229 /* Update tool-bar window. */ 3229 /* Update tool-bar window. */
3230 if (w->must_be_updated_p) 3230 if (w->must_be_updated_p)
@@ -3236,9 +3236,10 @@ update_frame (struct frame *f, int force_p, int inhibit_hairy_id_p)
3236 3236
3237 /* Swap tool-bar strings. We swap because we want to 3237 /* Swap tool-bar strings. We swap because we want to
3238 reuse strings. */ 3238 reuse strings. */
3239 tem = f->current_tool_bar_string; 3239 tem = FVAR (f, current_tool_bar_string);
3240 f->current_tool_bar_string = f->desired_tool_bar_string; 3240 FVAR (f, current_tool_bar_string) = FVAR (f,
3241 f->desired_tool_bar_string = tem; 3241 desired_tool_bar_string);
3242 FVAR (f, desired_tool_bar_string) = tem;
3242 } 3243 }
3243 } 3244 }
3244 3245
@@ -5759,8 +5760,8 @@ change_frame_size_1 (register struct frame *f, int newheight, int newwidth, int
5759 if ((FRAME_TERMCAP_P (f) && !pretend) || FRAME_MSDOS_P (f)) 5760 if ((FRAME_TERMCAP_P (f) && !pretend) || FRAME_MSDOS_P (f))
5760 FrameCols (FRAME_TTY (f)) = newwidth; 5761 FrameCols (FRAME_TTY (f)) = newwidth;
5761 5762
5762 if (WINDOWP (f->tool_bar_window)) 5763 if (WINDOWP (FVAR (f, tool_bar_window)))
5763 XSETFASTINT (XWINDOW (f->tool_bar_window)->total_cols, newwidth); 5764 XSETFASTINT (XWINDOW (FVAR (f, tool_bar_window))->total_cols, newwidth);
5764 } 5765 }
5765 5766
5766 FRAME_LINES (f) = newheight; 5767 FRAME_LINES (f) = newheight;
@@ -6084,7 +6085,7 @@ pass nil for VARIABLE. */)
6084 goto changed; 6085 goto changed;
6085 if (vecp == end) 6086 if (vecp == end)
6086 goto changed; 6087 goto changed;
6087 if (!EQ (*vecp++, XFRAME (frame)->name)) 6088 if (!EQ (*vecp++, FVAR (XFRAME (frame), name)))
6088 goto changed; 6089 goto changed;
6089 } 6090 }
6090 /* Check that the buffer info matches. */ 6091 /* Check that the buffer info matches. */
@@ -6141,7 +6142,7 @@ pass nil for VARIABLE. */)
6141 FOR_EACH_FRAME (tail, frame) 6142 FOR_EACH_FRAME (tail, frame)
6142 { 6143 {
6143 *vecp++ = frame; 6144 *vecp++ = frame;
6144 *vecp++ = XFRAME (frame)->name; 6145 *vecp++ = FVAR (XFRAME (frame), name);
6145 } 6146 }
6146 for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail)) 6147 for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail))
6147 { 6148 {
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
468x_set_title (struct frame *f, Lisp_Object name) 468x_set_title (struct frame *f, Lisp_Object name)
469{ 469{
470 /* Don't change the title if it's already NAME. */ 470 /* Don't change the title if it's already NAME. */
471 if (EQ (name, f->title)) 471 if (EQ (name, FVAR (f, title)))
472 return; 472 return;
473 473
474 update_mode_lines = 1; 474 update_mode_lines = 1;
475 475
476 f->title = name; 476 FVAR (f, title) = name;
477 477
478 if (NILP (name)) 478 if (NILP (name))
479 name = f->name; 479 name = FVAR (f, name);
480 480
481 if (FRAME_MSDOS_P (f)) 481 if (FRAME_MSDOS_P (f))
482 { 482 {
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)
3254 local binding, but only if that binding still exists. */ 3254 local binding, but only if that binding still exists. */
3255 else if (BUFFERP (where) 3255 else if (BUFFERP (where)
3256 ? !NILP (Flocal_variable_p (symbol, where)) 3256 ? !NILP (Flocal_variable_p (symbol, where))
3257 : !NILP (Fassq (symbol, XFRAME (where)->param_alist))) 3257 : !NILP (Fassq (symbol, FVAR (XFRAME (where), param_alist))))
3258 set_internal (symbol, this_binding.old_value, where, 1); 3258 set_internal (symbol, this_binding.old_value, where, 1);
3259 } 3259 }
3260 /* If variable has a trivial value (no forwarding), we can 3260 /* 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)
170 windows_or_buffers_changed++; 170 windows_or_buffers_changed++;
171 FRAME_WINDOW_SIZES_CHANGED (f) = 1; 171 FRAME_WINDOW_SIZES_CHANGED (f) = 1;
172 FRAME_MENU_BAR_LINES (f) = nlines; 172 FRAME_MENU_BAR_LINES (f) = nlines;
173 set_menu_bar_lines_1 (f->root_window, nlines - olines); 173 set_menu_bar_lines_1 (FVAR (f, root_window), nlines - olines);
174 adjust_glyphs (f); 174 adjust_glyphs (f);
175 } 175 }
176} 176}
@@ -269,7 +269,7 @@ make_frame (int mini_p)
269 269
270 /* Initialize Lisp data. Note that allocate_frame initializes all 270 /* Initialize Lisp data. Note that allocate_frame initializes all
271 Lisp data to nil, so do it only for slots which should not be nil. */ 271 Lisp data to nil, so do it only for slots which should not be nil. */
272 f->tool_bar_position = Qtop; 272 FVAR (f, tool_bar_position) = Qtop;
273 273
274 /* Initialize non-Lisp data. Note that allocate_frame zeroes out all 274 /* Initialize non-Lisp data. Note that allocate_frame zeroes out all
275 non-Lisp data, so do it only for slots which should not be zero. 275 non-Lisp data, so do it only for slots which should not be zero.
@@ -293,13 +293,13 @@ make_frame (int mini_p)
293 XWINDOW (mini_window)->prev = root_window; 293 XWINDOW (mini_window)->prev = root_window;
294 XWINDOW (mini_window)->mini = 1; 294 XWINDOW (mini_window)->mini = 1;
295 XWINDOW (mini_window)->frame = frame; 295 XWINDOW (mini_window)->frame = frame;
296 f->minibuffer_window = mini_window; 296 FVAR (f, minibuffer_window) = mini_window;
297 } 297 }
298 else 298 else
299 { 299 {
300 mini_window = Qnil; 300 mini_window = Qnil;
301 XWINDOW (root_window)->next = Qnil; 301 XWINDOW (root_window)->next = Qnil;
302 f->minibuffer_window = Qnil; 302 FVAR (f, minibuffer_window) = Qnil;
303 } 303 }
304 304
305 XWINDOW (root_window)->frame = frame; 305 XWINDOW (root_window)->frame = frame;
@@ -339,7 +339,7 @@ make_frame (int mini_p)
339 etc. Running Lisp functions at this point surely ends in a 339 etc. Running Lisp functions at this point surely ends in a
340 SEGV. */ 340 SEGV. */
341 set_window_buffer (root_window, buf, 0, 0); 341 set_window_buffer (root_window, buf, 0, 0);
342 f->buffer_list = Fcons (buf, Qnil); 342 FVAR (f, buffer_list) = Fcons (buf, Qnil);
343 } 343 }
344 344
345 if (mini_p) 345 if (mini_p)
@@ -352,11 +352,11 @@ make_frame (int mini_p)
352 0, 0); 352 0, 0);
353 } 353 }
354 354
355 f->root_window = root_window; 355 FVAR (f, root_window) = root_window;
356 f->selected_window = root_window; 356 FVAR (f, selected_window) = root_window;
357 /* Make sure this window seems more recently used than 357 /* Make sure this window seems more recently used than
358 a newly-created, never-selected window. */ 358 a newly-created, never-selected window. */
359 XWINDOW (f->selected_window)->use_time = ++window_select_count; 359 XWINDOW (FVAR (f, selected_window))->use_time = ++window_select_count;
360 360
361 return f; 361 return f;
362} 362}
@@ -398,10 +398,11 @@ make_frame_without_minibuffer (register Lisp_Object mini_window, KBOARD *kb, Lis
398 UNGCPRO; 398 UNGCPRO;
399 } 399 }
400 400
401 mini_window = XFRAME (KVAR (kb, Vdefault_minibuffer_frame))->minibuffer_window; 401 mini_window = FVAR (XFRAME (KVAR (kb, Vdefault_minibuffer_frame)),
402 minibuffer_window);
402 } 403 }
403 404
404 f->minibuffer_window = mini_window; 405 FVAR (f, minibuffer_window) = mini_window;
405 406
406 /* Make the chosen minibuffer window display the proper minibuffer, 407 /* Make the chosen minibuffer window display the proper minibuffer,
407 unless it is already showing a minibuffer. */ 408 unless it is already showing a minibuffer. */
@@ -436,7 +437,7 @@ make_minibuffer_frame (void)
436 Avoid infinite looping on the window chain by marking next pointer 437 Avoid infinite looping on the window chain by marking next pointer
437 as nil. */ 438 as nil. */
438 439
439 mini_window = f->minibuffer_window = f->root_window; 440 mini_window = FVAR (f, minibuffer_window) = FVAR (f, root_window);
440 XWINDOW (mini_window)->mini = 1; 441 XWINDOW (mini_window)->mini = 1;
441 XWINDOW (mini_window)->next = Qnil; 442 XWINDOW (mini_window)->next = Qnil;
442 XWINDOW (mini_window)->prev = Qnil; 443 XWINDOW (mini_window)->prev = Qnil;
@@ -477,7 +478,7 @@ make_initial_frame (void)
477 Vframe_list = Fcons (frame, Vframe_list); 478 Vframe_list = Fcons (frame, Vframe_list);
478 479
479 tty_frame_count = 1; 480 tty_frame_count = 1;
480 f->name = build_pure_c_string ("F1"); 481 FVAR (f, name) = build_pure_c_string ("F1");
481 482
482 f->visible = 1; 483 f->visible = 1;
483 f->async_visible = 1; 484 f->async_visible = 1;
@@ -518,7 +519,7 @@ make_terminal_frame (struct terminal *terminal)
518 XSETFRAME (frame, f); 519 XSETFRAME (frame, f);
519 Vframe_list = Fcons (frame, Vframe_list); 520 Vframe_list = Fcons (frame, Vframe_list);
520 521
521 f->name = make_formatted_string (name, "F%"pMd, ++tty_frame_count); 522 FVAR (f, name) = make_formatted_string (name, "F%"pMd, ++tty_frame_count);
522 523
523 f->visible = 1; /* FRAME_SET_VISIBLE wd set frame_garbaged. */ 524 f->visible = 1; /* FRAME_SET_VISIBLE wd set frame_garbaged. */
524 f->async_visible = 1; /* Don't let visible be cleared later. */ 525 f->async_visible = 1; /* Don't let visible be cleared later. */
@@ -569,7 +570,7 @@ get_future_frame_param (Lisp_Object parameter,
569 570
570 result = Fassq (parameter, supplied_parms); 571 result = Fassq (parameter, supplied_parms);
571 if (NILP (result)) 572 if (NILP (result))
572 result = Fassq (parameter, XFRAME (selected_frame)->param_alist); 573 result = Fassq (parameter, FVAR (XFRAME (selected_frame), param_alist));
573 if (NILP (result) && current_value != NULL) 574 if (NILP (result) && current_value != NULL)
574 result = build_string (current_value); 575 result = build_string (current_value);
575 if (!NILP (result) && !STRINGP (result)) 576 if (!NILP (result) && !STRINGP (result))
@@ -688,11 +689,11 @@ affects all frames on the same terminal device. */)
688 689
689 /* Make the frame face alist be frame-specific, so that each 690 /* Make the frame face alist be frame-specific, so that each
690 frame could change its face definitions independently. */ 691 frame could change its face definitions independently. */
691 f->face_alist = Fcopy_alist (sf->face_alist); 692 FVAR (f, face_alist) = Fcopy_alist (FVAR (sf, face_alist));
692 /* Simple Fcopy_alist isn't enough, because we need the contents of 693 /* Simple Fcopy_alist isn't enough, because we need the contents of
693 the vectors which are the CDRs of associations in face_alist to 694 the vectors which are the CDRs of associations in face_alist to
694 be copied as well. */ 695 be copied as well. */
695 for (tem = f->face_alist; CONSP (tem); tem = XCDR (tem)) 696 for (tem = FVAR (f, face_alist); CONSP (tem); tem = XCDR (tem))
696 XSETCDR (XCAR (tem), Fcopy_sequence (XCDR (XCAR (tem)))); 697 XSETCDR (XCAR (tem), Fcopy_sequence (XCDR (XCAR (tem))));
697 return frame; 698 return frame;
698} 699}
@@ -796,7 +797,7 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor
796 if (! FRAME_MINIBUF_ONLY_P (XFRAME (selected_frame))) 797 if (! FRAME_MINIBUF_ONLY_P (XFRAME (selected_frame)))
797 last_nonminibuf_frame = XFRAME (selected_frame); 798 last_nonminibuf_frame = XFRAME (selected_frame);
798 799
799 Fselect_window (XFRAME (frame)->selected_window, norecord); 800 Fselect_window (FVAR (XFRAME (frame), selected_window), norecord);
800 801
801 /* We want to make sure that the next event generates a frame-switch 802 /* We want to make sure that the next event generates a frame-switch
802 event to the appropriate frame. This seems kludgy to me, but 803 event to the appropriate frame. This seems kludgy to me, but
@@ -1237,11 +1238,11 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
1237 } 1238 }
1238 1239
1239 /* Don't allow minibuf_window to remain on a deleted frame. */ 1240 /* Don't allow minibuf_window to remain on a deleted frame. */
1240 if (EQ (f->minibuffer_window, minibuf_window)) 1241 if (EQ (FVAR (f, minibuffer_window), minibuf_window))
1241 { 1242 {
1242 Fset_window_buffer (sf->minibuffer_window, 1243 Fset_window_buffer (FVAR (sf, minibuffer_window),
1243 XWINDOW (minibuf_window)->buffer, Qnil); 1244 XWINDOW (minibuf_window)->buffer, Qnil);
1244 minibuf_window = sf->minibuffer_window; 1245 minibuf_window = FVAR (sf, minibuffer_window);
1245 1246
1246 /* If the dying minibuffer window was selected, 1247 /* If the dying minibuffer window was selected,
1247 select the new one. */ 1248 select the new one. */
@@ -1250,8 +1251,8 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
1250 } 1251 }
1251 1252
1252 /* Don't let echo_area_window to remain on a deleted frame. */ 1253 /* Don't let echo_area_window to remain on a deleted frame. */
1253 if (EQ (f->minibuffer_window, echo_area_window)) 1254 if (EQ (FVAR (f, minibuffer_window), echo_area_window))
1254 echo_area_window = sf->minibuffer_window; 1255 echo_area_window = FVAR (sf, minibuffer_window);
1255 1256
1256 /* Clear any X selections for this frame. */ 1257 /* Clear any X selections for this frame. */
1257#ifdef HAVE_X_WINDOWS 1258#ifdef HAVE_X_WINDOWS
@@ -1272,8 +1273,8 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
1272 1273
1273 /* Mark all the windows that used to be on FRAME as deleted, and then 1274 /* Mark all the windows that used to be on FRAME as deleted, and then
1274 remove the reference to them. */ 1275 remove the reference to them. */
1275 delete_all_child_windows (f->root_window); 1276 delete_all_child_windows (FVAR (f, root_window));
1276 f->root_window = Qnil; 1277 FVAR (f, root_window) = Qnil;
1277 1278
1278 Vframe_list = Fdelq (frame, Vframe_list); 1279 Vframe_list = Fdelq (frame, Vframe_list);
1279 FRAME_SET_VISIBLE (f, 0); 1280 FRAME_SET_VISIBLE (f, 0);
@@ -1282,7 +1283,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
1282 garbage collection. The frame object itself may not be garbage 1283 garbage collection. The frame object itself may not be garbage
1283 collected until much later, because recent_keys and other data 1284 collected until much later, because recent_keys and other data
1284 structures can still refer to it. */ 1285 structures can still refer to it. */
1285 f->menu_bar_vector = Qnil; 1286 FVAR (f, menu_bar_vector) = Qnil;
1286 1287
1287 free_font_driver_list (f); 1288 free_font_driver_list (f);
1288 xfree (f->namebuf); 1289 xfree (f->namebuf);
@@ -1655,7 +1656,7 @@ If omitted, FRAME defaults to the currently selected frame. */)
1655 } 1656 }
1656#endif 1657#endif
1657 1658
1658 make_frame_visible_1 (XFRAME (frame)->root_window); 1659 make_frame_visible_1 (FVAR (XFRAME (frame), root_window));
1659 1660
1660 /* Make menu bar update for the Buffers and Frames menus. */ 1661 /* Make menu bar update for the Buffers and Frames menus. */
1661 windows_or_buffers_changed++; 1662 windows_or_buffers_changed++;
@@ -1709,12 +1710,12 @@ displayed in the terminal. */)
1709 error ("Attempt to make invisible the sole visible or iconified frame"); 1710 error ("Attempt to make invisible the sole visible or iconified frame");
1710 1711
1711 /* Don't allow minibuf_window to remain on a deleted frame. */ 1712 /* Don't allow minibuf_window to remain on a deleted frame. */
1712 if (EQ (XFRAME (frame)->minibuffer_window, minibuf_window)) 1713 if (EQ (FVAR (XFRAME (frame), minibuffer_window), minibuf_window))
1713 { 1714 {
1714 struct frame *sf = XFRAME (selected_frame); 1715 struct frame *sf = XFRAME (selected_frame);
1715 Fset_window_buffer (sf->minibuffer_window, 1716 Fset_window_buffer (FVAR (sf, minibuffer_window),
1716 XWINDOW (minibuf_window)->buffer, Qnil); 1717 XWINDOW (minibuf_window)->buffer, Qnil);
1717 minibuf_window = sf->minibuffer_window; 1718 minibuf_window = FVAR (sf, minibuffer_window);
1718 } 1719 }
1719 1720
1720 /* I think this should be done with a hook. */ 1721 /* I think this should be done with a hook. */
@@ -1747,12 +1748,12 @@ If omitted, FRAME defaults to the currently selected frame. */)
1747#endif 1748#endif
1748 1749
1749 /* Don't allow minibuf_window to remain on a deleted frame. */ 1750 /* Don't allow minibuf_window to remain on a deleted frame. */
1750 if (EQ (XFRAME (frame)->minibuffer_window, minibuf_window)) 1751 if (EQ (FVAR (XFRAME (frame), minibuffer_window), minibuf_window))
1751 { 1752 {
1752 struct frame *sf = XFRAME (selected_frame); 1753 struct frame *sf = XFRAME (selected_frame);
1753 Fset_window_buffer (sf->minibuffer_window, 1754 Fset_window_buffer (FVAR (sf, minibuffer_window),
1754 XWINDOW (minibuf_window)->buffer, Qnil); 1755 XWINDOW (minibuf_window)->buffer, Qnil);
1755 minibuf_window = sf->minibuffer_window; 1756 minibuf_window = FVAR (sf, minibuffer_window);
1756 } 1757 }
1757 1758
1758 /* I think this should be done with a hook. */ 1759 /* 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. */)
1906 1907
1907 f = XFRAME (frame); 1908 f = XFRAME (frame);
1908 1909
1909 f->focus_frame = focus_frame; 1910 FVAR (f, focus_frame) = focus_frame;
1910 1911
1911 if (FRAME_TERMINAL (f)->frame_rehighlight_hook) 1912 if (FRAME_TERMINAL (f)->frame_rehighlight_hook)
1912 (*FRAME_TERMINAL (f)->frame_rehighlight_hook) (f); 1913 (*FRAME_TERMINAL (f)->frame_rehighlight_hook) (f);
@@ -1939,7 +1940,7 @@ get_frame_param (register struct frame *frame, Lisp_Object prop)
1939{ 1940{
1940 register Lisp_Object tem; 1941 register Lisp_Object tem;
1941 1942
1942 tem = Fassq (prop, frame->param_alist); 1943 tem = Fassq (prop, FVAR (frame, param_alist));
1943 if (EQ (tem, Qnil)) 1944 if (EQ (tem, Qnil))
1944 return tem; 1945 return tem;
1945 return Fcdr (tem); 1946 return Fcdr (tem);
@@ -1951,7 +1952,7 @@ get_frame_param (register struct frame *frame, Lisp_Object prop)
1951Lisp_Object 1952Lisp_Object
1952frame_buffer_predicate (Lisp_Object frame) 1953frame_buffer_predicate (Lisp_Object frame)
1953{ 1954{
1954 return XFRAME (frame)->buffer_predicate; 1955 return FVAR (XFRAME (frame), buffer_predicate);
1955} 1956}
1956 1957
1957/* Return the buffer-list of the selected frame. */ 1958/* Return the buffer-list of the selected frame. */
@@ -1959,7 +1960,7 @@ frame_buffer_predicate (Lisp_Object frame)
1959static Lisp_Object 1960static Lisp_Object
1960frame_buffer_list (Lisp_Object frame) 1961frame_buffer_list (Lisp_Object frame)
1961{ 1962{
1962 return XFRAME (frame)->buffer_list; 1963 return FVAR (XFRAME (frame), buffer_list);
1963} 1964}
1964 1965
1965/* Discard BUFFER from the buffer-list and buried-buffer-list of each frame. */ 1966/* Discard BUFFER from the buffer-list and buried-buffer-list of each frame. */
@@ -1971,10 +1972,10 @@ frames_discard_buffer (Lisp_Object buffer)
1971 1972
1972 FOR_EACH_FRAME (tail, frame) 1973 FOR_EACH_FRAME (tail, frame)
1973 { 1974 {
1974 XFRAME (frame)->buffer_list 1975 FVAR (XFRAME (frame), buffer_list)
1975 = Fdelq (buffer, XFRAME (frame)->buffer_list); 1976 = Fdelq (buffer, FVAR (XFRAME (frame), buffer_list));
1976 XFRAME (frame)->buried_buffer_list 1977 FVAR (XFRAME (frame), buried_buffer_list)
1977 = Fdelq (buffer, XFRAME (frame)->buried_buffer_list); 1978 = Fdelq (buffer, FVAR (XFRAME (frame), buried_buffer_list));
1978 } 1979 }
1979} 1980}
1980 1981
@@ -2022,8 +2023,8 @@ set_term_frame_name (struct frame *f, Lisp_Object name)
2022 2023
2023 /* Check for no change needed in this very common case 2024 /* Check for no change needed in this very common case
2024 before we do any consing. */ 2025 before we do any consing. */
2025 if (frame_name_fnn_p (SSDATA (f->name), 2026 if (frame_name_fnn_p (SSDATA (FVAR (f, name)),
2026 SBYTES (f->name))) 2027 SBYTES (FVAR (f, name))))
2027 return; 2028 return;
2028 2029
2029 name = make_formatted_string (namebuf, "F%"pMd, ++tty_frame_count); 2030 name = make_formatted_string (namebuf, "F%"pMd, ++tty_frame_count);
@@ -2033,7 +2034,7 @@ set_term_frame_name (struct frame *f, Lisp_Object name)
2033 CHECK_STRING (name); 2034 CHECK_STRING (name);
2034 2035
2035 /* Don't change the name if it's already NAME. */ 2036 /* Don't change the name if it's already NAME. */
2036 if (! NILP (Fstring_equal (name, f->name))) 2037 if (! NILP (Fstring_equal (name, FVAR (f, name))))
2037 return; 2038 return;
2038 2039
2039 /* Don't allow the user to set the frame name to F<num>, so it 2040 /* 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)
2042 error ("Frame names of the form F<num> are usurped by Emacs"); 2043 error ("Frame names of the form F<num> are usurped by Emacs");
2043 } 2044 }
2044 2045
2045 f->name = name; 2046 FVAR (f, name) = name;
2046 update_mode_lines = 1; 2047 update_mode_lines = 1;
2047} 2048}
2048 2049
@@ -2059,7 +2060,7 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val)
2059 for (; CONSP (val); val = XCDR (val)) 2060 for (; CONSP (val); val = XCDR (val))
2060 if (!NILP (Fbuffer_live_p (XCAR (val)))) 2061 if (!NILP (Fbuffer_live_p (XCAR (val))))
2061 list = Fcons (XCAR (val), list); 2062 list = Fcons (XCAR (val), list);
2062 f->buffer_list = Fnreverse (list); 2063 FVAR (f, buffer_list) = Fnreverse (list);
2063 return; 2064 return;
2064 } 2065 }
2065 if (EQ (prop, Qburied_buffer_list)) 2066 if (EQ (prop, Qburied_buffer_list))
@@ -2068,7 +2069,7 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val)
2068 for (; CONSP (val); val = XCDR (val)) 2069 for (; CONSP (val); val = XCDR (val))
2069 if (!NILP (Fbuffer_live_p (XCAR (val)))) 2070 if (!NILP (Fbuffer_live_p (XCAR (val))))
2070 list = Fcons (XCAR (val), list); 2071 list = Fcons (XCAR (val), list);
2071 f->buried_buffer_list = Fnreverse (list); 2072 FVAR (f, buried_buffer_list) = Fnreverse (list);
2072 return; 2073 return;
2073 } 2074 }
2074 2075
@@ -2103,9 +2104,9 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val)
2103 FRAME_TTY (f)->previous_frame = NULL; 2104 FRAME_TTY (f)->previous_frame = NULL;
2104 2105
2105 /* Update the frame parameter alist. */ 2106 /* Update the frame parameter alist. */
2106 old_alist_elt = Fassq (prop, f->param_alist); 2107 old_alist_elt = Fassq (prop, FVAR (f, param_alist));
2107 if (EQ (old_alist_elt, Qnil)) 2108 if (EQ (old_alist_elt, Qnil))
2108 f->param_alist = Fcons (Fcons (prop, val), f->param_alist); 2109 FVAR (f, param_alist) = Fcons (Fcons (prop, val), FVAR (f, param_alist));
2109 else 2110 else
2110 Fsetcdr (old_alist_elt, val); 2111 Fsetcdr (old_alist_elt, val);
2111 2112
@@ -2113,7 +2114,7 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val)
2113 in addition to the alist. */ 2114 in addition to the alist. */
2114 2115
2115 if (EQ (prop, Qbuffer_predicate)) 2116 if (EQ (prop, Qbuffer_predicate))
2116 f->buffer_predicate = val; 2117 FVAR (f, buffer_predicate) = val;
2117 2118
2118 if (! FRAME_WINDOW_P (f)) 2119 if (! FRAME_WINDOW_P (f))
2119 { 2120 {
@@ -2129,11 +2130,11 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val)
2129 error ("Surrogate minibuffer windows must be minibuffer windows"); 2130 error ("Surrogate minibuffer windows must be minibuffer windows");
2130 2131
2131 if ((FRAME_HAS_MINIBUF_P (f) || FRAME_MINIBUF_ONLY_P (f)) 2132 if ((FRAME_HAS_MINIBUF_P (f) || FRAME_MINIBUF_ONLY_P (f))
2132 && !EQ (val, f->minibuffer_window)) 2133 && !EQ (val, FVAR (f, minibuffer_window)))
2133 error ("Can't change the surrogate minibuffer of a frame with its own minibuffer"); 2134 error ("Can't change the surrogate minibuffer of a frame with its own minibuffer");
2134 2135
2135 /* Install the chosen minibuffer window, with proper buffer. */ 2136 /* Install the chosen minibuffer window, with proper buffer. */
2136 f->minibuffer_window = val; 2137 FVAR (f, minibuffer_window) = val;
2137 } 2138 }
2138} 2139}
2139 2140
@@ -2158,7 +2159,7 @@ If FRAME is omitted, return information on the currently selected frame. */)
2158 if (!FRAME_LIVE_P (f)) 2159 if (!FRAME_LIVE_P (f))
2159 return Qnil; 2160 return Qnil;
2160 2161
2161 alist = Fcopy_alist (f->param_alist); 2162 alist = Fcopy_alist (FVAR (f, param_alist));
2162 GCPRO1 (alist); 2163 GCPRO1 (alist);
2163 2164
2164 if (!FRAME_WINDOW_P (f)) 2165 if (!FRAME_WINDOW_P (f))
@@ -2204,7 +2205,7 @@ If FRAME is omitted, return information on the currently selected frame. */)
2204 : FRAME_W32_P (f) ? "w32term" 2205 : FRAME_W32_P (f) ? "w32term"
2205 :"tty")); 2206 :"tty"));
2206 } 2207 }
2207 store_in_alist (&alist, Qname, f->name); 2208 store_in_alist (&alist, Qname, FVAR (f, name));
2208 height = (f->new_text_lines ? f->new_text_lines : FRAME_LINES (f)); 2209 height = (f->new_text_lines ? f->new_text_lines : FRAME_LINES (f));
2209 store_in_alist (&alist, Qheight, make_number (height)); 2210 store_in_alist (&alist, Qheight, make_number (height));
2210 width = (f->new_text_cols ? f->new_text_cols : FRAME_COLS (f)); 2211 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. */)
2216 : FRAME_MINIBUF_WINDOW (f))); 2217 : FRAME_MINIBUF_WINDOW (f)));
2217 store_in_alist (&alist, Qunsplittable, (FRAME_NO_SPLIT_P (f) ? Qt : Qnil)); 2218 store_in_alist (&alist, Qunsplittable, (FRAME_NO_SPLIT_P (f) ? Qt : Qnil));
2218 store_in_alist (&alist, Qbuffer_list, frame_buffer_list (frame)); 2219 store_in_alist (&alist, Qbuffer_list, frame_buffer_list (frame));
2219 store_in_alist (&alist, Qburied_buffer_list, XFRAME (frame)->buried_buffer_list); 2220 store_in_alist (&alist, Qburied_buffer_list,
2221 FVAR (XFRAME (frame), buried_buffer_list));
2220 2222
2221 /* I think this should be done with a hook. */ 2223 /* I think this should be done with a hook. */
2222#ifdef HAVE_WINDOW_SYSTEM 2224#ifdef HAVE_WINDOW_SYSTEM
@@ -2257,7 +2259,7 @@ If FRAME is nil, describe the currently selected frame. */)
2257 { 2259 {
2258 /* Avoid consing in frequent cases. */ 2260 /* Avoid consing in frequent cases. */
2259 if (EQ (parameter, Qname)) 2261 if (EQ (parameter, Qname))
2260 value = f->name; 2262 value = FVAR (f, name);
2261#ifdef HAVE_X_WINDOWS 2263#ifdef HAVE_X_WINDOWS
2262 else if (EQ (parameter, Qdisplay) && FRAME_X_P (f)) 2264 else if (EQ (parameter, Qdisplay) && FRAME_X_P (f))
2263 value = XCAR (FRAME_X_DISPLAY_INFO (f)->name_list_element); 2265 value = XCAR (FRAME_X_DISPLAY_INFO (f)->name_list_element);
@@ -2265,7 +2267,7 @@ If FRAME is nil, describe the currently selected frame. */)
2265 else if (EQ (parameter, Qbackground_color) 2267 else if (EQ (parameter, Qbackground_color)
2266 || EQ (parameter, Qforeground_color)) 2268 || EQ (parameter, Qforeground_color))
2267 { 2269 {
2268 value = Fassq (parameter, f->param_alist); 2270 value = Fassq (parameter, FVAR (f, param_alist));
2269 if (CONSP (value)) 2271 if (CONSP (value))
2270 { 2272 {
2271 value = XCDR (value); 2273 value = XCDR (value);
@@ -2303,7 +2305,7 @@ If FRAME is nil, describe the currently selected frame. */)
2303 } 2305 }
2304 else if (EQ (parameter, Qdisplay_type) 2306 else if (EQ (parameter, Qdisplay_type)
2305 || EQ (parameter, Qbackground_mode)) 2307 || EQ (parameter, Qbackground_mode))
2306 value = Fcdr (Fassq (parameter, f->param_alist)); 2308 value = Fcdr (Fassq (parameter, FVAR (f, param_alist)));
2307 else 2309 else
2308 /* FIXME: Avoid this code path at all (as well as code duplication) 2310 /* FIXME: Avoid this code path at all (as well as code duplication)
2309 by sharing more code with Fframe_parameters. */ 2311 by sharing more code with Fframe_parameters. */
@@ -2889,14 +2891,14 @@ x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist)
2889 if (! TYPE_RANGED_INTEGERP (int, icon_left)) 2891 if (! TYPE_RANGED_INTEGERP (int, icon_left))
2890 { 2892 {
2891 icon_left_no_change = 1; 2893 icon_left_no_change = 1;
2892 icon_left = Fcdr (Fassq (Qicon_left, f->param_alist)); 2894 icon_left = Fcdr (Fassq (Qicon_left, FVAR (f, param_alist)));
2893 if (NILP (icon_left)) 2895 if (NILP (icon_left))
2894 XSETINT (icon_left, 0); 2896 XSETINT (icon_left, 0);
2895 } 2897 }
2896 if (! TYPE_RANGED_INTEGERP (int, icon_top)) 2898 if (! TYPE_RANGED_INTEGERP (int, icon_top))
2897 { 2899 {
2898 icon_top_no_change = 1; 2900 icon_top_no_change = 1;
2899 icon_top = Fcdr (Fassq (Qicon_top, f->param_alist)); 2901 icon_top = Fcdr (Fassq (Qicon_top, FVAR (f, param_alist)));
2900 if (NILP (icon_top)) 2902 if (NILP (icon_top))
2901 XSETINT (icon_top, 0); 2903 XSETINT (icon_top, 0);
2902 } 2904 }
@@ -3056,7 +3058,7 @@ x_report_frame_params (struct frame *f, Lisp_Object *alistptr)
3056 store_in_alist (alistptr, Qouter_window_id, 3058 store_in_alist (alistptr, Qouter_window_id,
3057 make_formatted_string (buf, "%lu", w)); 3059 make_formatted_string (buf, "%lu", w));
3058#endif 3060#endif
3059 store_in_alist (alistptr, Qicon_name, f->icon_name); 3061 store_in_alist (alistptr, Qicon_name, FVAR (f, icon_name));
3060 FRAME_SAMPLE_VISIBILITY (f); 3062 FRAME_SAMPLE_VISIBILITY (f);
3061 store_in_alist (alistptr, Qvisibility, 3063 store_in_alist (alistptr, Qvisibility,
3062 (FRAME_VISIBLE_P (f) ? Qt 3064 (FRAME_VISIBLE_P (f) ? Qt
@@ -3070,7 +3072,7 @@ x_report_frame_params (struct frame *f, Lisp_Object *alistptr)
3070 XSETFASTINT (tem, FRAME_X_OUTPUT (f)->parent_desc); 3072 XSETFASTINT (tem, FRAME_X_OUTPUT (f)->parent_desc);
3071 store_in_alist (alistptr, Qexplicit_name, (f->explicit_name ? Qt : Qnil)); 3073 store_in_alist (alistptr, Qexplicit_name, (f->explicit_name ? Qt : Qnil));
3072 store_in_alist (alistptr, Qparent_id, tem); 3074 store_in_alist (alistptr, Qparent_id, tem);
3073 store_in_alist (alistptr, Qtool_bar_position, f->tool_bar_position); 3075 store_in_alist (alistptr, Qtool_bar_position, FVAR (f, tool_bar_position));
3074} 3076}
3075 3077
3076 3078
@@ -3130,7 +3132,7 @@ x_set_screen_gamma (struct frame *f, Lisp_Object new_value, Lisp_Object old_valu
3130 signal_error ("Invalid screen-gamma", new_value); 3132 signal_error ("Invalid screen-gamma", new_value);
3131 3133
3132 /* Apply the new gamma value to the frame background. */ 3134 /* Apply the new gamma value to the frame background. */
3133 bgcolor = Fassq (Qbackground_color, f->param_alist); 3135 bgcolor = Fassq (Qbackground_color, FVAR (f, param_alist));
3134 if (CONSP (bgcolor) && (bgcolor = XCDR (bgcolor), STRINGP (bgcolor))) 3136 if (CONSP (bgcolor) && (bgcolor = XCDR (bgcolor), STRINGP (bgcolor)))
3135 { 3137 {
3136 Lisp_Object parm_index = Fget (Qbackground_color, Qx_frame_parameter); 3138 Lisp_Object parm_index = Fget (Qbackground_color, Qx_frame_parameter);
@@ -3459,7 +3461,7 @@ x_icon_type (FRAME_PTR f)
3459{ 3461{
3460 Lisp_Object tem; 3462 Lisp_Object tem;
3461 3463
3462 tem = assq_no_quit (Qicon_type, f->param_alist); 3464 tem = assq_no_quit (Qicon_type, FVAR (f, param_alist));
3463 if (CONSP (tem)) 3465 if (CONSP (tem))
3464 return XCDR (tem); 3466 return XCDR (tem);
3465 else 3467 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;
80 80
81struct font_driver_list; 81struct font_driver_list;
82 82
83/* Most code should use this macro to access Lisp fields in struct frame. */
84
85#define FVAR(frame, field) ((frame)->INTERNAL_FIELD (field))
86
83struct frame 87struct frame
84{ 88{
85 struct vectorlike_header header; 89 struct vectorlike_header header;
@@ -89,15 +93,15 @@ struct frame
89 93
90 /* Name of this frame: a Lisp string. It is used for looking up resources, 94 /* Name of this frame: a Lisp string. It is used for looking up resources,
91 as well as for the title in some cases. */ 95 as well as for the title in some cases. */
92 Lisp_Object name; 96 Lisp_Object INTERNAL_FIELD (name);
93 97
94 /* The name to use for the icon, the last time 98 /* The name to use for the icon, the last time
95 it was refreshed. nil means not explicitly specified. */ 99 it was refreshed. nil means not explicitly specified. */
96 Lisp_Object icon_name; 100 Lisp_Object INTERNAL_FIELD (icon_name);
97 101
98 /* This is the frame title specified explicitly, if any. 102 /* This is the frame title specified explicitly, if any.
99 Usually it is nil. */ 103 Usually it is nil. */
100 Lisp_Object title; 104 Lisp_Object INTERNAL_FIELD (title);
101 105
102 /* The frame which should receive keystrokes that occur in this 106 /* The frame which should receive keystrokes that occur in this
103 frame, or nil if they should go to the frame itself. This is 107 frame, or nil if they should go to the frame itself. This is
@@ -110,29 +114,29 @@ struct frame
110 to shift from one frame to the other, any redirections to the 114 to shift from one frame to the other, any redirections to the
111 original frame are shifted to the newly selected frame; if 115 original frame are shifted to the newly selected frame; if
112 focus_frame is nil, Fselect_frame will leave it alone. */ 116 focus_frame is nil, Fselect_frame will leave it alone. */
113 Lisp_Object focus_frame; 117 Lisp_Object INTERNAL_FIELD (focus_frame);
114 118
115 /* This frame's root window. Every frame has one. 119 /* This frame's root window. Every frame has one.
116 If the frame has only a minibuffer window, this is it. 120 If the frame has only a minibuffer window, this is it.
117 Otherwise, if the frame has a minibuffer window, this is its sibling. */ 121 Otherwise, if the frame has a minibuffer window, this is its sibling. */
118 Lisp_Object root_window; 122 Lisp_Object INTERNAL_FIELD (root_window);
119 123
120 /* This frame's selected window. 124 /* This frame's selected window.
121 Each frame has its own window hierarchy 125 Each frame has its own window hierarchy
122 and one of the windows in it is selected within the frame. 126 and one of the windows in it is selected within the frame.
123 The selected window of the selected frame is Emacs's selected window. */ 127 The selected window of the selected frame is Emacs's selected window. */
124 Lisp_Object selected_window; 128 Lisp_Object INTERNAL_FIELD (selected_window);
125 129
126 /* This frame's minibuffer window. 130 /* This frame's minibuffer window.
127 Most frames have their own minibuffer windows, 131 Most frames have their own minibuffer windows,
128 but only the selected frame's minibuffer window 132 but only the selected frame's minibuffer window
129 can actually appear to exist. */ 133 can actually appear to exist. */
130 Lisp_Object minibuffer_window; 134 Lisp_Object INTERNAL_FIELD (minibuffer_window);
131 135
132 /* Parameter alist of this frame. 136 /* Parameter alist of this frame.
133 These are the parameters specified when creating the frame 137 These are the parameters specified when creating the frame
134 or modified with modify-frame-parameters. */ 138 or modified with modify-frame-parameters. */
135 Lisp_Object param_alist; 139 Lisp_Object INTERNAL_FIELD (param_alist);
136 140
137 /* List of scroll bars on this frame. 141 /* List of scroll bars on this frame.
138 Actually, we don't specify exactly what is stored here at all; the 142 Actually, we don't specify exactly what is stored here at all; the
@@ -141,50 +145,51 @@ struct frame
141 instead of in the `device' structure so that the garbage 145 instead of in the `device' structure so that the garbage
142 collector doesn't need to look inside the window-system-dependent 146 collector doesn't need to look inside the window-system-dependent
143 structure. */ 147 structure. */
144 Lisp_Object scroll_bars; 148 Lisp_Object INTERNAL_FIELD (scroll_bars);
145 Lisp_Object condemned_scroll_bars; 149 Lisp_Object INTERNAL_FIELD (condemned_scroll_bars);
146 150
147 /* Vector describing the items to display in the menu bar. 151 /* Vector describing the items to display in the menu bar.
148 Each item has four elements in this vector. 152 Each item has four elements in this vector.
149 They are KEY, STRING, SUBMAP, and HPOS. 153 They are KEY, STRING, SUBMAP, and HPOS.
150 (HPOS is not used in when the X toolkit is in use.) 154 (HPOS is not used in when the X toolkit is in use.)
151 There are four additional elements of nil at the end, to terminate. */ 155 There are four additional elements of nil at the end, to terminate. */
152 Lisp_Object menu_bar_items; 156 Lisp_Object INTERNAL_FIELD (menu_bar_items);
153 157
154 /* Alist of elements (FACE-NAME . FACE-VECTOR-DATA). */ 158 /* Alist of elements (FACE-NAME . FACE-VECTOR-DATA). */
155 Lisp_Object face_alist; 159 Lisp_Object INTERNAL_FIELD (face_alist);
156 160
157 /* A vector that records the entire structure of this frame's menu bar. 161 /* A vector that records the entire structure of this frame's menu bar.
158 For the format of the data, see extensive comments in xmenu.c. 162 For the format of the data, see extensive comments in xmenu.c.
159 Only the X toolkit version uses this. */ 163 Only the X toolkit version uses this. */
160 Lisp_Object menu_bar_vector; 164 Lisp_Object INTERNAL_FIELD (menu_bar_vector);
161 165
162 /* Predicate for selecting buffers for other-buffer. */ 166 /* Predicate for selecting buffers for other-buffer. */
163 Lisp_Object buffer_predicate; 167 Lisp_Object INTERNAL_FIELD (buffer_predicate);
164 168
165 /* List of buffers viewed in this frame, for other-buffer. */ 169 /* List of buffers viewed in this frame, for other-buffer. */
166 Lisp_Object buffer_list; 170 Lisp_Object INTERNAL_FIELD (buffer_list);
167 171
168 /* List of buffers that were viewed, then buried in this frame. The 172 /* List of buffers that were viewed, then buried in this frame. The
169 most recently buried buffer is first. For last-buffer. */ 173 most recently buried buffer is first. For last-buffer. */
170 Lisp_Object buried_buffer_list; 174 Lisp_Object INTERNAL_FIELD (buried_buffer_list);
171 175
172 /* A dummy window used to display menu bars under X when no X 176 /* A dummy window used to display menu bars under X when no X
173 toolkit support is available. */ 177 toolkit support is available. */
174 Lisp_Object menu_bar_window; 178 Lisp_Object INTERNAL_FIELD (menu_bar_window);
175 179
176 /* A window used to display the tool-bar of a frame. */ 180 /* A window used to display the tool-bar of a frame. */
177 Lisp_Object tool_bar_window; 181 Lisp_Object INTERNAL_FIELD (tool_bar_window);
178 182
179 /* Desired and current tool-bar items. */ 183 /* Desired and current tool-bar items. */
180 Lisp_Object tool_bar_items; 184 Lisp_Object INTERNAL_FIELD (tool_bar_items);
181 185
182 /* Where tool bar is, can be left, right, top or bottom. The native 186 /* Where tool bar is, can be left, right, top or bottom. The native
183 tool bar only supports top. */ 187 tool bar only supports top. */
184 Lisp_Object tool_bar_position; 188 Lisp_Object INTERNAL_FIELD (tool_bar_position);
185 189
186 /* Desired and current contents displayed in tool_bar_window. */ 190 /* Desired and current contents displayed in tool_bar_window. */
187 Lisp_Object desired_tool_bar_string, current_tool_bar_string; 191 Lisp_Object INTERNAL_FIELD (desired_tool_bar_string);
192 Lisp_Object INTERNAL_FIELD (current_tool_bar_string);
188 193
189 /* Beyond here, there should be no more Lisp_Object components. */ 194 /* Beyond here, there should be no more Lisp_Object components. */
190 195
@@ -635,13 +640,13 @@ typedef struct frame *FRAME_PTR;
635#define FRAME_WINDOW_SIZES_CHANGED(f) (f)->window_sizes_changed 640#define FRAME_WINDOW_SIZES_CHANGED(f) (f)->window_sizes_changed
636 641
637/* The minibuffer window of frame F, if it has one; otherwise nil. */ 642/* The minibuffer window of frame F, if it has one; otherwise nil. */
638#define FRAME_MINIBUF_WINDOW(f) (f)->minibuffer_window 643#define FRAME_MINIBUF_WINDOW(f) FVAR (f, minibuffer_window)
639 644
640/* The root window of the window tree of frame F. */ 645/* The root window of the window tree of frame F. */
641#define FRAME_ROOT_WINDOW(f) (f)->root_window 646#define FRAME_ROOT_WINDOW(f) FVAR (f, root_window)
642 647
643/* The currently selected window of the window tree of frame F. */ 648/* The currently selected window of the window tree of frame F. */
644#define FRAME_SELECTED_WINDOW(f) (f)->selected_window 649#define FRAME_SELECTED_WINDOW(f) FVAR (f, selected_window)
645 650
646#define FRAME_INSERT_COST(f) (f)->insert_line_cost 651#define FRAME_INSERT_COST(f) (f)->insert_line_cost
647#define FRAME_DELETE_COST(f) (f)->delete_line_cost 652#define FRAME_DELETE_COST(f) (f)->delete_line_cost
@@ -649,7 +654,7 @@ typedef struct frame *FRAME_PTR;
649#define FRAME_DELETEN_COST(f) (f)->delete_n_lines_cost 654#define FRAME_DELETEN_COST(f) (f)->delete_n_lines_cost
650#define FRAME_MESSAGE_BUF(f) (f)->message_buf 655#define FRAME_MESSAGE_BUF(f) (f)->message_buf
651#define FRAME_SCROLL_BOTTOM_VPOS(f) (f)->scroll_bottom_vpos 656#define FRAME_SCROLL_BOTTOM_VPOS(f) (f)->scroll_bottom_vpos
652#define FRAME_FOCUS_FRAME(f) (f)->focus_frame 657#define FRAME_FOCUS_FRAME(f) FVAR (f, focus_frame)
653 658
654/* Nonzero if frame F supports scroll bars. 659/* Nonzero if frame F supports scroll bars.
655 If this is zero, then it is impossible to enable scroll bars 660 If this is zero, then it is impossible to enable scroll bars
@@ -750,10 +755,10 @@ typedef struct frame *FRAME_PTR;
750 755
751/* Nonzero if frame F has scroll bars. */ 756/* Nonzero if frame F has scroll bars. */
752 757
753#define FRAME_SCROLL_BARS(f) ((f)->scroll_bars) 758#define FRAME_SCROLL_BARS(f) (FVAR (f, scroll_bars))
754 759
755#define FRAME_CONDEMNED_SCROLL_BARS(f) ((f)->condemned_scroll_bars) 760#define FRAME_CONDEMNED_SCROLL_BARS(f) (FVAR (f, condemned_scroll_bars))
756#define FRAME_MENU_BAR_ITEMS(f) ((f)->menu_bar_items) 761#define FRAME_MENU_BAR_ITEMS(f) (FVAR (f, menu_bar_items))
757#define FRAME_COST_BAUD_RATE(f) ((f)->cost_calculation_baud_rate) 762#define FRAME_COST_BAUD_RATE(f) ((f)->cost_calculation_baud_rate)
758 763
759#define FRAME_DESIRED_CURSOR(f) ((f)->desired_cursor) 764#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)
1338 int o_right = FRAME_RIGHT_FRINGE_WIDTH (f); 1338 int o_right = FRAME_RIGHT_FRINGE_WIDTH (f);
1339 int o_cols = FRAME_FRINGE_COLS (f); 1339 int o_cols = FRAME_FRINGE_COLS (f);
1340 1340
1341 Lisp_Object left_fringe = Fassq (Qleft_fringe, f->param_alist); 1341 Lisp_Object left_fringe = Fassq (Qleft_fringe, FVAR (f, param_alist));
1342 Lisp_Object right_fringe = Fassq (Qright_fringe, f->param_alist); 1342 Lisp_Object right_fringe = Fassq (Qright_fringe, FVAR (f, param_alist));
1343 int left_fringe_width, right_fringe_width; 1343 int left_fringe_width, right_fringe_width;
1344 1344
1345 if (!NILP (left_fringe)) 1345 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)
1148 gtk_widget_set_name (wfixed, SSDATA (Vx_resource_name)); 1148 gtk_widget_set_name (wfixed, SSDATA (Vx_resource_name));
1149 1149
1150 /* If this frame has a title or name, set it in the title bar. */ 1150 /* If this frame has a title or name, set it in the title bar. */
1151 if (! NILP (f->title)) title = SSDATA (ENCODE_UTF_8 (f->title)); 1151 if (! NILP (FVAR (f, title)))
1152 else if (! NILP (f->name)) title = SSDATA (ENCODE_UTF_8 (f->name)); 1152 title = SSDATA (ENCODE_UTF_8 (FVAR (f, title)));
1153 else if (! NILP (FVAR (f, name)))
1154 title = SSDATA (ENCODE_UTF_8 (FVAR (f, name)));
1153 1155
1154 if (title) gtk_window_set_title (GTK_WINDOW (wtop), title); 1156 if (title) gtk_window_set_title (GTK_WINDOW (wtop), title);
1155 1157
@@ -2059,7 +2061,7 @@ make_cl_data (xg_menu_cb_data *cl_data, FRAME_PTR f, GCallback highlight_cb)
2059 { 2061 {
2060 cl_data = xmalloc (sizeof *cl_data); 2062 cl_data = xmalloc (sizeof *cl_data);
2061 cl_data->f = f; 2063 cl_data->f = f;
2062 cl_data->menu_bar_vector = f->menu_bar_vector; 2064 cl_data->menu_bar_vector = FVAR (f, menu_bar_vector);
2063 cl_data->menu_bar_items_used = f->menu_bar_items_used; 2065 cl_data->menu_bar_items_used = f->menu_bar_items_used;
2064 cl_data->highlight_cb = highlight_cb; 2066 cl_data->highlight_cb = highlight_cb;
2065 cl_data->ref_count = 0; 2067 cl_data->ref_count = 0;
@@ -2091,7 +2093,7 @@ update_cl_data (xg_menu_cb_data *cl_data,
2091 if (cl_data) 2093 if (cl_data)
2092 { 2094 {
2093 cl_data->f = f; 2095 cl_data->f = f;
2094 cl_data->menu_bar_vector = f->menu_bar_vector; 2096 cl_data->menu_bar_vector = FVAR (f, menu_bar_vector);
2095 cl_data->menu_bar_items_used = f->menu_bar_items_used; 2097 cl_data->menu_bar_items_used = f->menu_bar_items_used;
2096 cl_data->highlight_cb = highlight_cb; 2098 cl_data->highlight_cb = highlight_cb;
2097 } 2099 }
@@ -3808,12 +3810,12 @@ xg_tool_bar_callback (GtkWidget *w, gpointer client_data)
3808 struct input_event event; 3810 struct input_event event;
3809 EVENT_INIT (event); 3811 EVENT_INIT (event);
3810 3812
3811 if (! f || ! f->n_tool_bar_items || NILP (f->tool_bar_items)) 3813 if (! f || ! f->n_tool_bar_items || NILP (FVAR (f, tool_bar_items)))
3812 return; 3814 return;
3813 3815
3814 idx *= TOOL_BAR_ITEM_NSLOTS; 3816 idx *= TOOL_BAR_ITEM_NSLOTS;
3815 3817
3816 key = AREF (f->tool_bar_items, idx + TOOL_BAR_ITEM_KEY); 3818 key = AREF (FVAR (f, tool_bar_items), idx + TOOL_BAR_ITEM_KEY);
3817 XSETFRAME (frame, f); 3819 XSETFRAME (frame, f);
3818 3820
3819 /* We generate two events here. The first one is to set the prefix 3821 /* We generate two events here. The first one is to set the prefix
@@ -4084,16 +4086,16 @@ xg_tool_bar_help_callback (GtkWidget *w,
4084 FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA); 4086 FRAME_PTR f = (FRAME_PTR) g_object_get_data (G_OBJECT (w), XG_FRAME_DATA);
4085 Lisp_Object help, frame; 4087 Lisp_Object help, frame;
4086 4088
4087 if (! f || ! f->n_tool_bar_items || NILP (f->tool_bar_items)) 4089 if (! f || ! f->n_tool_bar_items || NILP (FVAR (f, tool_bar_items)))
4088 return FALSE; 4090 return FALSE;
4089 4091
4090 if (event->type == GDK_ENTER_NOTIFY) 4092 if (event->type == GDK_ENTER_NOTIFY)
4091 { 4093 {
4092 idx *= TOOL_BAR_ITEM_NSLOTS; 4094 idx *= TOOL_BAR_ITEM_NSLOTS;
4093 help = AREF (f->tool_bar_items, idx + TOOL_BAR_ITEM_HELP); 4095 help = AREF (FVAR (f, tool_bar_items), idx + TOOL_BAR_ITEM_HELP);
4094 4096
4095 if (NILP (help)) 4097 if (NILP (help))
4096 help = AREF (f->tool_bar_items, idx + TOOL_BAR_ITEM_CAPTION); 4098 help = AREF (FVAR (f, tool_bar_items), idx + TOOL_BAR_ITEM_CAPTION);
4097 } 4099 }
4098 else 4100 else
4099 help = Qnil; 4101 help = Qnil;
@@ -4221,7 +4223,7 @@ xg_create_tool_bar (FRAME_PTR f)
4221} 4223}
4222 4224
4223 4225
4224#define PROP(IDX) AREF (f->tool_bar_items, i * TOOL_BAR_ITEM_NSLOTS + (IDX)) 4226#define PROP(IDX) AREF (FVAR (f, tool_bar_items), i * TOOL_BAR_ITEM_NSLOTS + (IDX))
4225 4227
4226/* Find the right-to-left image named by RTL in the tool bar images for F. 4228/* Find the right-to-left image named by RTL in the tool bar images for F.
4227 Returns IMAGE if RTL is not found. */ 4229 Returns IMAGE if RTL is not found. */
@@ -4704,7 +4706,7 @@ update_frame_tool_bar (FRAME_PTR f)
4704 if (f->n_tool_bar_items != 0) 4706 if (f->n_tool_bar_items != 0)
4705 { 4707 {
4706 if (pack_tool_bar) 4708 if (pack_tool_bar)
4707 xg_pack_tool_bar (f, f->tool_bar_position); 4709 xg_pack_tool_bar (f, FVAR (f, tool_bar_position));
4708 gtk_widget_show_all (GTK_WIDGET (x->handlebox_widget)); 4710 gtk_widget_show_all (GTK_WIDGET (x->handlebox_widget));
4709 if (xg_update_tool_bar_sizes (f)) 4711 if (xg_update_tool_bar_sizes (f))
4710 xg_height_or_width_changed (f); 4712 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/>. */
19#include "systime.h" /* for EMACS_TIME, Time */ 19#include "systime.h" /* for EMACS_TIME, Time */
20#include "coding.h" /* for ENCODE_UTF_8 and ENCODE_SYSTEM */ 20#include "coding.h" /* for ENCODE_UTF_8 and ENCODE_SYSTEM */
21 21
22/* Lisp fields in struct keyboard are hidden from most code and accessed 22/* Most code should use this macro to access Lisp fields in struct kboard. */
23 via the KVAR macro, below. Only select pieces of code, like the GC,
24 are allowed to use KBOARD_INTERNAL_FIELD. */
25#define KBOARD_INTERNAL_FIELD(field) field ## _
26 23
27/* Most code should use this macro to access Lisp fields in struct 24#define KVAR(kboard, field) ((kboard)->INTERNAL_FIELD (field))
28 kboard. */
29#define KVAR(kboard, field) ((kboard)->KBOARD_INTERNAL_FIELD (field))
30 25
31/* Each KBOARD represents one logical input stream from which Emacs 26/* Each KBOARD represents one logical input stream from which Emacs
32 gets input. If we are using ordinary terminals, it has one KBOARD 27 gets input. If we are using ordinary terminals, it has one KBOARD
@@ -79,32 +74,32 @@ struct kboard
79 can effectively wait for input in the any-kboard state, and hence 74 can effectively wait for input in the any-kboard state, and hence
80 avoid blocking out the other KBOARDs. See universal-argument in 75 avoid blocking out the other KBOARDs. See universal-argument in
81 lisp/simple.el for an example. */ 76 lisp/simple.el for an example. */
82 Lisp_Object KBOARD_INTERNAL_FIELD (Voverriding_terminal_local_map); 77 Lisp_Object INTERNAL_FIELD (Voverriding_terminal_local_map);
83 78
84 /* Last command executed by the editor command loop, not counting 79 /* Last command executed by the editor command loop, not counting
85 commands that set the prefix argument. */ 80 commands that set the prefix argument. */
86 Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_command); 81 Lisp_Object INTERNAL_FIELD (Vlast_command);
87 82
88 /* Normally same as last-command, but never modified by other commands. */ 83 /* Normally same as last-command, but never modified by other commands. */
89 Lisp_Object KBOARD_INTERNAL_FIELD (Vreal_last_command); 84 Lisp_Object INTERNAL_FIELD (Vreal_last_command);
90 85
91 /* User-supplied table to translate input characters through. */ 86 /* User-supplied table to translate input characters through. */
92 Lisp_Object KBOARD_INTERNAL_FIELD (Vkeyboard_translate_table); 87 Lisp_Object INTERNAL_FIELD (Vkeyboard_translate_table);
93 88
94 /* Last command that may be repeated by `repeat'. */ 89 /* Last command that may be repeated by `repeat'. */
95 Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_repeatable_command); 90 Lisp_Object INTERNAL_FIELD (Vlast_repeatable_command);
96 91
97 /* The prefix argument for the next command, in raw form. */ 92 /* The prefix argument for the next command, in raw form. */
98 Lisp_Object KBOARD_INTERNAL_FIELD (Vprefix_arg); 93 Lisp_Object INTERNAL_FIELD (Vprefix_arg);
99 94
100 /* Saved prefix argument for the last command, in raw form. */ 95 /* Saved prefix argument for the last command, in raw form. */
101 Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_prefix_arg); 96 Lisp_Object INTERNAL_FIELD (Vlast_prefix_arg);
102 97
103 /* Unread events specific to this kboard. */ 98 /* Unread events specific to this kboard. */
104 Lisp_Object KBOARD_INTERNAL_FIELD (kbd_queue); 99 Lisp_Object INTERNAL_FIELD (kbd_queue);
105 100
106 /* Non-nil while a kbd macro is being defined. */ 101 /* Non-nil while a kbd macro is being defined. */
107 Lisp_Object KBOARD_INTERNAL_FIELD (defining_kbd_macro); 102 Lisp_Object INTERNAL_FIELD (defining_kbd_macro);
108 103
109 /* The start of storage for the current keyboard macro. */ 104 /* The start of storage for the current keyboard macro. */
110 Lisp_Object *kbd_macro_buffer; 105 Lisp_Object *kbd_macro_buffer;
@@ -126,28 +121,28 @@ struct kboard
126 ptrdiff_t kbd_macro_bufsize; 121 ptrdiff_t kbd_macro_bufsize;
127 122
128 /* Last anonymous kbd macro defined. */ 123 /* Last anonymous kbd macro defined. */
129 Lisp_Object KBOARD_INTERNAL_FIELD (Vlast_kbd_macro); 124 Lisp_Object INTERNAL_FIELD (Vlast_kbd_macro);
130 125
131 /* Alist of system-specific X windows key symbols. */ 126 /* Alist of system-specific X windows key symbols. */
132 Lisp_Object KBOARD_INTERNAL_FIELD (Vsystem_key_alist); 127 Lisp_Object INTERNAL_FIELD (Vsystem_key_alist);
133 128
134 /* Cache for modify_event_symbol. */ 129 /* Cache for modify_event_symbol. */
135 Lisp_Object KBOARD_INTERNAL_FIELD (system_key_syms); 130 Lisp_Object INTERNAL_FIELD (system_key_syms);
136 131
137 /* The kind of display: x, w32, ... */ 132 /* The kind of display: x, w32, ... */
138 Lisp_Object KBOARD_INTERNAL_FIELD (Vwindow_system); 133 Lisp_Object INTERNAL_FIELD (Vwindow_system);
139 134
140 /* Keymap mapping keys to alternative preferred forms. 135 /* Keymap mapping keys to alternative preferred forms.
141 See the DEFVAR for more documentation. */ 136 See the DEFVAR for more documentation. */
142 Lisp_Object KBOARD_INTERNAL_FIELD (Vlocal_function_key_map); 137 Lisp_Object INTERNAL_FIELD (Vlocal_function_key_map);
143 138
144 /* Keymap mapping ASCII function key sequences onto their preferred 139 /* Keymap mapping ASCII function key sequences onto their preferred
145 forms. Initialized by the terminal-specific lisp files. See the 140 forms. Initialized by the terminal-specific lisp files. See the
146 DEFVAR for more documentation. */ 141 DEFVAR for more documentation. */
147 Lisp_Object KBOARD_INTERNAL_FIELD (Vinput_decode_map); 142 Lisp_Object INTERNAL_FIELD (Vinput_decode_map);
148 143
149 /* Minibufferless frames on this display use this frame's minibuffer. */ 144 /* Minibufferless frames on this display use this frame's minibuffer. */
150 Lisp_Object KBOARD_INTERNAL_FIELD (Vdefault_minibuffer_frame); 145 Lisp_Object INTERNAL_FIELD (Vdefault_minibuffer_frame);
151 146
152 /* Number of displays using this KBOARD. Normally 1, but can be 147 /* Number of displays using this KBOARD. Normally 1, but can be
153 larger when you have multiple screens on a single X display. */ 148 larger when you have multiple screens on a single X display. */
@@ -155,7 +150,7 @@ struct kboard
155 150
156 /* The text we're echoing in the modeline - partial key sequences, 151 /* The text we're echoing in the modeline - partial key sequences,
157 usually. This is nil when not echoing. */ 152 usually. This is nil when not echoing. */
158 Lisp_Object KBOARD_INTERNAL_FIELD (echo_string); 153 Lisp_Object INTERNAL_FIELD (echo_string);
159 154
160 /* This flag indicates that events were put into kbd_queue 155 /* This flag indicates that events were put into kbd_queue
161 while Emacs was running for some other KBOARD. 156 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)
622#define CHECK_TYPE(ok, Qxxxp, x) \ 622#define CHECK_TYPE(ok, Qxxxp, x) \
623 do { if (!(ok)) wrong_type_argument (Qxxxp, (x)); } while (0) 623 do { if (!(ok)) wrong_type_argument (Qxxxp, (x)); } while (0)
624 624
625/* Lisp fields are usually hidden from most code and accessed
626 via special macros. Only select pieces of code, like the GC,
627 are allowed to use INTERNAL_FIELD directly. Objects which
628 aren't using this convention should be fixed. */
629
630#define INTERNAL_FIELD(field) field ## _
625 631
626
627/* See the macros in intervals.h. */ 632/* See the macros in intervals.h. */
628 633
629typedef struct interval *INTERVAL; 634typedef 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)
102{ 102{
103 if (FRAMEP (selected_frame) 103 if (FRAMEP (selected_frame)
104 && FRAME_LIVE_P (XFRAME (selected_frame)) 104 && FRAME_LIVE_P (XFRAME (selected_frame))
105 && !EQ (minibuf_window, XFRAME (selected_frame)->minibuffer_window)) 105 && !EQ (minibuf_window, FVAR (XFRAME (selected_frame), minibuffer_window)))
106 { 106 {
107 struct frame *sf = XFRAME (selected_frame); 107 struct frame *sf = XFRAME (selected_frame);
108 Lisp_Object buffer; 108 Lisp_Object buffer;
109 109
110 /* I don't think that any frames may validly have a null minibuffer 110 /* I don't think that any frames may validly have a null minibuffer
111 window anymore. */ 111 window anymore. */
112 if (NILP (sf->minibuffer_window)) 112 if (NILP (FVAR (sf, minibuffer_window)))
113 abort (); 113 abort ();
114 114
115 /* Under X, we come here with minibuf_window being the 115 /* Under X, we come here with minibuf_window being the
@@ -117,8 +117,8 @@ choose_minibuf_frame (void)
117 init_window_once. That window doesn't have a buffer. */ 117 init_window_once. That window doesn't have a buffer. */
118 buffer = XWINDOW (minibuf_window)->buffer; 118 buffer = XWINDOW (minibuf_window)->buffer;
119 if (BUFFERP (buffer)) 119 if (BUFFERP (buffer))
120 Fset_window_buffer (sf->minibuffer_window, buffer, Qnil); 120 Fset_window_buffer (FVAR (sf, minibuffer_window), buffer, Qnil);
121 minibuf_window = sf->minibuffer_window; 121 minibuf_window = FVAR (sf, minibuffer_window);
122 } 122 }
123 123
124 /* Make sure no other frame has a minibuffer as its selected window, 124 /* 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)
586{ 586{
587 NSTRACE (x_set_title); 587 NSTRACE (x_set_title);
588 /* Don't change the title if it's already NAME. */ 588 /* Don't change the title if it's already NAME. */
589 if (EQ (name, f->title)) 589 if (EQ (name, FVAR (f, title)))
590 return; 590 return;
591 591
592 update_mode_lines = 1; 592 update_mode_lines = 1;
593 593
594 f->title = name; 594 FVAR (f, title) = name;
595 595
596 if (NILP (name)) 596 if (NILP (name))
597 name = f->name; 597 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)
2125 int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); 2125 int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y));
2126 2126
2127 /* Internal border is drawn below the tool bar. */ 2127 /* Internal border is drawn below the tool bar. */
2128 if (WINDOWP (f->tool_bar_window) 2128 if (WINDOWP (FVAR (f, tool_bar_window))
2129 && w == XWINDOW (f->tool_bar_window)) 2129 && w == XWINDOW (FVAR (f, tool_bar_window)))
2130 y -= width; 2130 y -= width;
2131 /* end copy from other terms */ 2131 /* end copy from other terms */
2132 2132
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
1897 else if (FRAMEP (obj)) 1897 else if (FRAMEP (obj))
1898 { 1898 {
1899 int len; 1899 int len;
1900 Lisp_Object frame_name = XFRAME (obj)->name; 1900 Lisp_Object frame_name = FVAR (XFRAME (obj), name);
1901 1901
1902 strout ((FRAME_LIVE_P (XFRAME (obj)) 1902 strout ((FRAME_LIVE_P (XFRAME (obj))
1903 ? "#<frame " : "#<dead frame "), 1903 ? "#<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)
2192 Lisp_Object tty_color_mode_alist 2192 Lisp_Object tty_color_mode_alist
2193 = Fintern_soft (build_string ("tty-color-mode-alist"), Qnil); 2193 = Fintern_soft (build_string ("tty-color-mode-alist"), Qnil);
2194 2194
2195 tem = assq_no_quit (Qtty_color_mode, f->param_alist); 2195 tem = assq_no_quit (Qtty_color_mode, FVAR (f, param_alist));
2196 val = CONSP (tem) ? XCDR (tem) : Qnil; 2196 val = CONSP (tem) ? XCDR (tem) : Qnil;
2197 2197
2198 if (INTEGERP (val)) 2198 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)
1489 else if (!NILP (arg) || NILP (oldval)) 1489 else if (!NILP (arg) || NILP (oldval))
1490 return; 1490 return;
1491 1491
1492 f->icon_name = arg; 1492 FVAR (f, icon_name) = arg;
1493 1493
1494#if 0 1494#if 0
1495 if (f->output_data.w32->icon_bitmap != 0) 1495 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)
1498 BLOCK_INPUT; 1498 BLOCK_INPUT;
1499 1499
1500 result = x_text_icon (f, 1500 result = x_text_icon (f,
1501 SSDATA ((!NILP (f->icon_name) 1501 SSDATA ((!NILP (FVAR (f, icon_name))
1502 ? f->icon_name 1502 ? FVAR (f, icon_name)
1503 : !NILP (f->title) 1503 : !NILP (FVAR (f, title))
1504 ? f->title 1504 ? FVAR (f, title)
1505 : f->name))); 1505 : FVAR (f, name))));
1506 1506
1507 if (result) 1507 if (result)
1508 { 1508 {
@@ -1631,8 +1631,8 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
1631 } 1631 }
1632 UNBLOCK_INPUT; 1632 UNBLOCK_INPUT;
1633 1633
1634 if (WINDOWP (f->tool_bar_window)) 1634 if (WINDOWP (FVAR (f, tool_bar_window)))
1635 clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix); 1635 clear_glyph_matrix (XWINDOW (FVAR (f, tool_bar_window))->current_matrix);
1636 } 1636 }
1637 1637
1638 run_window_configuration_change_hook (f); 1638 run_window_configuration_change_hook (f);
@@ -1674,7 +1674,7 @@ x_set_name (struct frame *f, Lisp_Object name, int explicit)
1674 /* Check for no change needed in this very common case 1674 /* Check for no change needed in this very common case
1675 before we do any consing. */ 1675 before we do any consing. */
1676 if (!strcmp (FRAME_W32_DISPLAY_INFO (f)->w32_id_name, 1676 if (!strcmp (FRAME_W32_DISPLAY_INFO (f)->w32_id_name,
1677 SDATA (f->name))) 1677 SDATA (FVAR (f, name))))
1678 return; 1678 return;
1679 name = build_string (FRAME_W32_DISPLAY_INFO (f)->w32_id_name); 1679 name = build_string (FRAME_W32_DISPLAY_INFO (f)->w32_id_name);
1680 } 1680 }
@@ -1682,15 +1682,15 @@ x_set_name (struct frame *f, Lisp_Object name, int explicit)
1682 CHECK_STRING (name); 1682 CHECK_STRING (name);
1683 1683
1684 /* Don't change the name if it's already NAME. */ 1684 /* Don't change the name if it's already NAME. */
1685 if (! NILP (Fstring_equal (name, f->name))) 1685 if (! NILP (Fstring_equal (name, FVAR (f, name))))
1686 return; 1686 return;
1687 1687
1688 f->name = name; 1688 FVAR (f, name) = name;
1689 1689
1690 /* For setting the frame title, the title parameter should override 1690 /* For setting the frame title, the title parameter should override
1691 the name parameter. */ 1691 the name parameter. */
1692 if (! NILP (f->title)) 1692 if (! NILP (FVAR (f, title)))
1693 name = f->title; 1693 name = FVAR (f, title);
1694 1694
1695 if (FRAME_W32_WINDOW (f)) 1695 if (FRAME_W32_WINDOW (f))
1696 { 1696 {
@@ -1728,15 +1728,15 @@ void
1728x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name) 1728x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name)
1729{ 1729{
1730 /* Don't change the title if it's already NAME. */ 1730 /* Don't change the title if it's already NAME. */
1731 if (EQ (name, f->title)) 1731 if (EQ (name, FVAR (f, title)))
1732 return; 1732 return;
1733 1733
1734 update_mode_lines = 1; 1734 update_mode_lines = 1;
1735 1735
1736 f->title = name; 1736 FVAR (f, title) = name;
1737 1737
1738 if (NILP (name)) 1738 if (NILP (name))
1739 name = f->name; 1739 name = FVAR (f, name);
1740 1740
1741 if (FRAME_W32_WINDOW (f)) 1741 if (FRAME_W32_WINDOW (f))
1742 { 1742 {
@@ -3896,8 +3896,8 @@ w32_window (struct frame *f, long window_prompting, int minibuffer_only)
3896 int explicit = f->explicit_name; 3896 int explicit = f->explicit_name;
3897 3897
3898 f->explicit_name = 0; 3898 f->explicit_name = 0;
3899 name = f->name; 3899 name = FVAR (f, name);
3900 f->name = Qnil; 3900 FVAR (f, name) = Qnil;
3901 x_set_name (f, name, explicit); 3901 x_set_name (f, name, explicit);
3902 } 3902 }
3903 3903
@@ -3944,9 +3944,9 @@ x_icon (struct frame *f, Lisp_Object parms)
3944 ? IconicState 3944 ? IconicState
3945 : NormalState)); 3945 : NormalState));
3946 3946
3947 x_text_icon (f, SSDATA ((!NILP (f->icon_name) 3947 x_text_icon (f, SSDATA ((!NILP (FVAR (f, icon_name))
3948 ? f->icon_name 3948 ? FVAR (f, icon_name)
3949 : f->name))); 3949 : FVAR (f, name))));
3950#endif 3950#endif
3951 3951
3952 UNBLOCK_INPUT; 3952 UNBLOCK_INPUT;
@@ -4146,11 +4146,11 @@ This function is an internal primitive--use `make-frame' instead. */)
4146 f->output_data.w32 = xzalloc (sizeof (struct w32_output)); 4146 f->output_data.w32 = xzalloc (sizeof (struct w32_output));
4147 FRAME_FONTSET (f) = -1; 4147 FRAME_FONTSET (f) = -1;
4148 4148
4149 f->icon_name 4149 FVAR (f, icon_name)
4150 = x_get_arg (dpyinfo, parameters, Qicon_name, "iconName", "Title", 4150 = x_get_arg (dpyinfo, parameters, Qicon_name, "iconName", "Title",
4151 RES_TYPE_STRING); 4151 RES_TYPE_STRING);
4152 if (! STRINGP (f->icon_name)) 4152 if (! STRINGP (FVAR (f, icon_name)))
4153 f->icon_name = Qnil; 4153 FVAR (f, icon_name) = Qnil;
4154 4154
4155/* FRAME_W32_DISPLAY_INFO (f) = dpyinfo; */ 4155/* FRAME_W32_DISPLAY_INFO (f) = dpyinfo; */
4156 4156
@@ -4179,12 +4179,12 @@ This function is an internal primitive--use `make-frame' instead. */)
4179 be set. */ 4179 be set. */
4180 if (EQ (name, Qunbound) || NILP (name)) 4180 if (EQ (name, Qunbound) || NILP (name))
4181 { 4181 {
4182 f->name = build_string (dpyinfo->w32_id_name); 4182 FVAR (f, name) = build_string (dpyinfo->w32_id_name);
4183 f->explicit_name = 0; 4183 f->explicit_name = 0;
4184 } 4184 }
4185 else 4185 else
4186 { 4186 {
4187 f->name = name; 4187 FVAR (f, name) = name;
4188 f->explicit_name = 1; 4188 f->explicit_name = 1;
4189 /* use the frame's title when getting resources for this frame. */ 4189 /* use the frame's title when getting resources for this frame. */
4190 specbind (Qx_resource_name, name); 4190 specbind (Qx_resource_name, name);
@@ -4359,7 +4359,7 @@ This function is an internal primitive--use `make-frame' instead. */)
4359 by x_get_arg and friends, now go in the misc. alist of the frame. */ 4359 by x_get_arg and friends, now go in the misc. alist of the frame. */
4360 for (tem = parameters; CONSP (tem); tem = XCDR (tem)) 4360 for (tem = parameters; CONSP (tem); tem = XCDR (tem))
4361 if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem)))) 4361 if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem))))
4362 f->param_alist = Fcons (XCAR (tem), f->param_alist); 4362 FVAR (f, param_alist) = Fcons (XCAR (tem), FVAR (f, param_alist));
4363 4363
4364 UNGCPRO; 4364 UNGCPRO;
4365 4365
@@ -5231,7 +5231,7 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
5231 f->output_data.w32 = xzalloc (sizeof (struct w32_output)); 5231 f->output_data.w32 = xzalloc (sizeof (struct w32_output));
5232 5232
5233 FRAME_FONTSET (f) = -1; 5233 FRAME_FONTSET (f) = -1;
5234 f->icon_name = Qnil; 5234 FVAR (f, icon_name) = Qnil;
5235 5235
5236#ifdef GLYPH_DEBUG 5236#ifdef GLYPH_DEBUG
5237 image_cache_refcount = 5237 image_cache_refcount =
@@ -5246,12 +5246,12 @@ x_create_tip_frame (struct w32_display_info *dpyinfo,
5246 be set. */ 5246 be set. */
5247 if (EQ (name, Qunbound) || NILP (name)) 5247 if (EQ (name, Qunbound) || NILP (name))
5248 { 5248 {
5249 f->name = build_string (dpyinfo->w32_id_name); 5249 FVAR (f, name) = build_string (dpyinfo->w32_id_name);
5250 f->explicit_name = 0; 5250 f->explicit_name = 0;
5251 } 5251 }
5252 else 5252 else
5253 { 5253 {
5254 f->name = name; 5254 FVAR (f, name) = name;
5255 f->explicit_name = 1; 5255 f->explicit_name = 1;
5256 /* use the frame's title when getting resources for this frame. */ 5256 /* use the frame's title when getting resources for this frame. */
5257 specbind (Qx_resource_name, name); 5257 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)
277 return; 277 return;
278 entry = Qnil; 278 entry = Qnil;
279 subprefix_stack = (Lisp_Object *) alloca (f->menu_bar_items_used * sizeof (Lisp_Object)); 279 subprefix_stack = (Lisp_Object *) alloca (f->menu_bar_items_used * sizeof (Lisp_Object));
280 vector = f->menu_bar_vector; 280 vector = FVAR (f, menu_bar_vector);
281 prefix = Qnil; 281 prefix = Qnil;
282 i = 0; 282 i = 0;
283 while (i < f->menu_bar_items_used) 283 while (i < f->menu_bar_items_used)
@@ -419,14 +419,14 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
419 419
420 /* Save the frame's previous menu bar contents data. */ 420 /* Save the frame's previous menu bar contents data. */
421 if (previous_menu_items_used) 421 if (previous_menu_items_used)
422 memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents, 422 memcpy (previous_items, XVECTOR (FVAR (f, menu_bar_vector))->contents,
423 previous_menu_items_used * sizeof (Lisp_Object)); 423 previous_menu_items_used * sizeof (Lisp_Object));
424 424
425 /* Fill in menu_items with the current menu bar contents. 425 /* Fill in menu_items with the current menu bar contents.
426 This can evaluate Lisp code. */ 426 This can evaluate Lisp code. */
427 save_menu_items (); 427 save_menu_items ();
428 428
429 menu_items = f->menu_bar_vector; 429 menu_items = FVAR (f, menu_bar_vector);
430 menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0; 430 menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0;
431 submenu_start = (int *) alloca (ASIZE (items) * sizeof (int)); 431 submenu_start = (int *) alloca (ASIZE (items) * sizeof (int));
432 submenu_end = (int *) alloca (ASIZE (items) * sizeof (int)); 432 submenu_end = (int *) alloca (ASIZE (items) * sizeof (int));
@@ -500,7 +500,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
500 return; 500 return;
501 } 501 }
502 502
503 f->menu_bar_vector = menu_items; 503 FVAR (f, menu_bar_vector) = menu_items;
504 f->menu_bar_items_used = menu_items_used; 504 f->menu_bar_items_used = menu_items_used;
505 505
506 /* This undoes save_menu_items. */ 506 /* This undoes save_menu_items. */
@@ -854,7 +854,7 @@ w32_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
854 854
855 wv_title->name = SSDATA (title); 855 wv_title->name = SSDATA (title);
856 wv_title->enabled = TRUE; 856 wv_title->enabled = TRUE;
857 wv_title->title = TRUE; 857 FVAR (wv_title, title) = TRUE;
858 wv_title->button_type = BUTTON_TYPE_NONE; 858 wv_title->button_type = BUTTON_TYPE_NONE;
859 wv_title->help = Qnil; 859 wv_title->help = Qnil;
860 wv_title->next = wv_sep; 860 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,
4189 /* We may get paint messages even though the client 4189 /* We may get paint messages even though the client
4190 area is clipped - these are not expose events. */ 4190 area is clipped - these are not expose events. */
4191 DebPrint (("clipped frame %p (%s) got WM_PAINT - ignored\n", f, 4191 DebPrint (("clipped frame %p (%s) got WM_PAINT - ignored\n", f,
4192 SDATA (f->name))); 4192 SDATA (FVAR (f, name))));
4193 } 4193 }
4194 else if (f->async_visible != 1) 4194 else if (f->async_visible != 1)
4195 { 4195 {
@@ -4198,7 +4198,7 @@ w32_read_socket (struct terminal *terminal, int expected,
4198 f->async_iconified = 0; 4198 f->async_iconified = 0;
4199 SET_FRAME_GARBAGED (f); 4199 SET_FRAME_GARBAGED (f);
4200 DebPrint (("frame %p (%s) reexposed by WM_PAINT\n", f, 4200 DebPrint (("frame %p (%s) reexposed by WM_PAINT\n", f,
4201 SDATA (f->name))); 4201 SDATA (FVAR (f, name))));
4202 4202
4203 /* WM_PAINT serves as MapNotify as well, so report 4203 /* WM_PAINT serves as MapNotify as well, so report
4204 visibility changes properly. */ 4204 visibility changes properly. */
@@ -4254,7 +4254,7 @@ w32_read_socket (struct terminal *terminal, int expected,
4254 if (f && !f->iconified) 4254 if (f && !f->iconified)
4255 { 4255 {
4256 if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) 4256 if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
4257 && !EQ (f->tool_bar_window, hlinfo->mouse_face_window)) 4257 && !EQ (FVAR (f, tool_bar_window), hlinfo->mouse_face_window))
4258 { 4258 {
4259 clear_mouse_face (hlinfo); 4259 clear_mouse_face (hlinfo);
4260 hlinfo->mouse_face_hidden = 1; 4260 hlinfo->mouse_face_hidden = 1;
@@ -4279,7 +4279,7 @@ w32_read_socket (struct terminal *terminal, int expected,
4279 if (f && !f->iconified) 4279 if (f && !f->iconified)
4280 { 4280 {
4281 if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) 4281 if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
4282 && !EQ (f->tool_bar_window, hlinfo->mouse_face_window)) 4282 && !EQ (FVAR (f, tool_bar_window), hlinfo->mouse_face_window))
4283 { 4283 {
4284 clear_mouse_face (hlinfo); 4284 clear_mouse_face (hlinfo);
4285 hlinfo->mouse_face_hidden = 1; 4285 hlinfo->mouse_face_hidden = 1;
@@ -4357,7 +4357,7 @@ w32_read_socket (struct terminal *terminal, int expected,
4357 if (f && !f->iconified) 4357 if (f && !f->iconified)
4358 { 4358 {
4359 if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) 4359 if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
4360 && !EQ (f->tool_bar_window, hlinfo->mouse_face_window)) 4360 && !EQ (FVAR (f, tool_bar_window), hlinfo->mouse_face_window))
4361 { 4361 {
4362 clear_mouse_face (hlinfo); 4362 clear_mouse_face (hlinfo);
4363 hlinfo->mouse_face_hidden = 1; 4363 hlinfo->mouse_face_hidden = 1;
@@ -4481,8 +4481,8 @@ w32_read_socket (struct terminal *terminal, int expected,
4481 construct_mouse_click (&inev, &msg, f); 4481 construct_mouse_click (&inev, &msg, f);
4482 4482
4483 /* Is this in the tool-bar? */ 4483 /* Is this in the tool-bar? */
4484 if (WINDOWP (f->tool_bar_window) 4484 if (WINDOWP (FVAR (f, tool_bar_window))
4485 && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window))) 4485 && WINDOW_TOTAL_LINES (XWINDOW (FVAR (f, tool_bar_window))))
4486 { 4486 {
4487 Lisp_Object window; 4487 Lisp_Object window;
4488 int x = XFASTINT (inev.x); 4488 int x = XFASTINT (inev.x);
@@ -4490,7 +4490,7 @@ w32_read_socket (struct terminal *terminal, int expected,
4490 4490
4491 window = window_from_coordinates (f, x, y, 0, 1); 4491 window = window_from_coordinates (f, x, y, 0, 1);
4492 4492
4493 if (EQ (window, f->tool_bar_window)) 4493 if (EQ (window, FVAR (f, tool_bar_window)))
4494 { 4494 {
4495 w32_handle_tool_bar_click (f, &inev); 4495 w32_handle_tool_bar_click (f, &inev);
4496 tool_bar_p = 1; 4496 tool_bar_p = 1;
@@ -4935,7 +4935,7 @@ w32_read_socket (struct terminal *terminal, int expected,
4935 if (!FRAME_OBSCURED_P (f)) 4935 if (!FRAME_OBSCURED_P (f))
4936 { 4936 {
4937 DebPrint (("frame %p (%s) obscured\n", f, 4937 DebPrint (("frame %p (%s) obscured\n", f,
4938 SDATA (f->name))); 4938 SDATA (FVAR (f, name))));
4939 } 4939 }
4940 } 4940 }
4941 else 4941 else
@@ -4947,7 +4947,7 @@ w32_read_socket (struct terminal *terminal, int expected,
4947 { 4947 {
4948 SET_FRAME_GARBAGED (f); 4948 SET_FRAME_GARBAGED (f);
4949 DebPrint (("obscured frame %p (%s) found to be visible\n", f, 4949 DebPrint (("obscured frame %p (%s) found to be visible\n", f,
4950 SDATA (f->name))); 4950 SDATA (FVAR (f, name))));
4951 4951
4952 /* Force a redisplay sooner or later. */ 4952 /* Force a redisplay sooner or later. */
4953 record_asynch_buffer_change (); 4953 record_asynch_buffer_change ();
@@ -5595,7 +5595,7 @@ x_set_window_size (struct frame *f, int change_gravity, int cols, int rows)
5595 SET_FRAME_GARBAGED (f); 5595 SET_FRAME_GARBAGED (f);
5596 5596
5597 /* If cursor was outside the new size, mark it as off. */ 5597 /* If cursor was outside the new size, mark it as off. */
5598 mark_window_cursors_off (XWINDOW (f->root_window)); 5598 mark_window_cursors_off (XWINDOW (FVAR (f, root_window)));
5599 5599
5600 /* Clear out any recollection of where the mouse highlighting was, 5600 /* Clear out any recollection of where the mouse highlighting was,
5601 since it might be in a place that's outside the new frame size. 5601 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. */)
191 Lisp_Object window; 191 Lisp_Object window;
192 192
193 if (NILP (frame_or_window)) 193 if (NILP (frame_or_window))
194 window = SELECTED_FRAME ()->root_window; 194 window = FVAR (SELECTED_FRAME (), root_window);
195 else if (WINDOWP (frame_or_window)) 195 else if (WINDOWP (frame_or_window))
196 window = XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window)))->root_window; 196 window = FVAR (XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window))), root_window);
197 else 197 else
198 { 198 {
199 CHECK_LIVE_FRAME (frame_or_window); 199 CHECK_LIVE_FRAME (frame_or_window);
200 window = XFRAME (frame_or_window)->root_window; 200 window = FVAR (XFRAME (frame_or_window), root_window);
201 } 201 }
202 202
203 return window; 203 return window;
@@ -235,13 +235,13 @@ the first window of that frame. */)
235 Lisp_Object window; 235 Lisp_Object window;
236 236
237 if (NILP (frame_or_window)) 237 if (NILP (frame_or_window))
238 window = SELECTED_FRAME ()->root_window; 238 window = FVAR (SELECTED_FRAME (), root_window);
239 else if (WINDOWP (frame_or_window)) 239 else if (WINDOWP (frame_or_window))
240 window = XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window)))->root_window; 240 window = FVAR (XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window))), root_window);
241 else 241 else
242 { 242 {
243 CHECK_LIVE_FRAME (frame_or_window); 243 CHECK_LIVE_FRAME (frame_or_window);
244 window = XFRAME (frame_or_window)->root_window; 244 window = FVAR (XFRAME (frame_or_window), root_window);
245 } 245 }
246 246
247 while (NILP (XWINDOW (window)->buffer)) 247 while (NILP (XWINDOW (window)->buffer))
@@ -269,13 +269,14 @@ the selected window of that frame. */)
269 Lisp_Object window; 269 Lisp_Object window;
270 270
271 if (NILP (frame_or_window)) 271 if (NILP (frame_or_window))
272 window = SELECTED_FRAME ()->selected_window; 272 window = FVAR (SELECTED_FRAME (), selected_window);
273 else if (WINDOWP (frame_or_window)) 273 else if (WINDOWP (frame_or_window))
274 window = XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window)))->selected_window; 274 window = FVAR (XFRAME (WINDOW_FRAME (XWINDOW (frame_or_window))),
275 selected_window);
275 else 276 else
276 { 277 {
277 CHECK_LIVE_FRAME (frame_or_window); 278 CHECK_LIVE_FRAME (frame_or_window);
278 window = XFRAME (frame_or_window)->selected_window; 279 window = FVAR (XFRAME (frame_or_window), selected_window);
279 } 280 }
280 281
281 return window; 282 return window;
@@ -303,7 +304,7 @@ Return WINDOW. */)
303 if (EQ (frame, selected_frame)) 304 if (EQ (frame, selected_frame))
304 return Fselect_window (window, norecord); 305 return Fselect_window (window, norecord);
305 else 306 else
306 return XFRAME (frame)->selected_window = window; 307 return FVAR (XFRAME (frame), selected_window) = window;
307} 308}
308 309
309DEFUN ("selected-window", Fselected_window, Sselected_window, 0, 0, 0, 310DEFUN ("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)
346 sf = SELECTED_FRAME (); 347 sf = SELECTED_FRAME ();
347 if (XFRAME (WINDOW_FRAME (w)) != sf) 348 if (XFRAME (WINDOW_FRAME (w)) != sf)
348 { 349 {
349 XFRAME (WINDOW_FRAME (w))->selected_window = window; 350 FVAR (XFRAME (WINDOW_FRAME (w)), selected_window) = window;
350 /* Use this rather than Fhandle_switch_frame 351 /* Use this rather than Fhandle_switch_frame
351 so that FRAME_FOCUS_FRAME is moved appropriately as we 352 so that FRAME_FOCUS_FRAME is moved appropriately as we
352 move around in the state where a minibuffer in a separate 353 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)
357 return window; 358 return window;
358 } 359 }
359 else 360 else
360 sf->selected_window = window; 361 FVAR (sf, selected_window) = window;
361 362
362 /* Store the current buffer's actual point into the 363 /* Store the current buffer's actual point into the
363 old selected window. It belongs to that window, 364 old selected window. It belongs to that window,
@@ -1219,13 +1220,13 @@ window_from_coordinates (struct frame *f, int x, int y,
1219 bar exists. */ 1220 bar exists. */
1220 if (NILP (window) 1221 if (NILP (window)
1221 && tool_bar_p 1222 && tool_bar_p
1222 && WINDOWP (f->tool_bar_window) 1223 && WINDOWP (FVAR (f, tool_bar_window))
1223 && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window)) > 0 1224 && WINDOW_TOTAL_LINES (XWINDOW (FVAR (f, tool_bar_window))) > 0
1224 && (coordinates_in_window (XWINDOW (f->tool_bar_window), x, y) 1225 && (coordinates_in_window (XWINDOW (FVAR (f, tool_bar_window)), x, y)
1225 != ON_NOTHING)) 1226 != ON_NOTHING))
1226 { 1227 {
1227 *part = ON_TEXT; 1228 *part = ON_TEXT;
1228 window = f->tool_bar_window; 1229 window = FVAR (f, tool_bar_window);
1229 } 1230 }
1230 1231
1231 return window; 1232 return window;
@@ -2319,7 +2320,7 @@ MINIBUF neither nil nor t means never include the minibuffer window. */)
2319 (Lisp_Object frame, Lisp_Object minibuf, Lisp_Object window) 2320 (Lisp_Object frame, Lisp_Object minibuf, Lisp_Object window)
2320{ 2321{
2321 if (NILP (window)) 2322 if (NILP (window))
2322 window = FRAMEP (frame) ? XFRAME (frame)->selected_window : selected_window; 2323 window = FRAMEP (frame) ? FVAR (XFRAME (frame), selected_window) : selected_window;
2323 CHECK_WINDOW (window); 2324 CHECK_WINDOW (window);
2324 if (NILP (frame)) 2325 if (NILP (frame))
2325 frame = selected_frame; 2326 frame = selected_frame;
@@ -3555,9 +3556,9 @@ be applied on the Elisp level. */)
3555void 3556void
3556resize_frame_windows (struct frame *f, int size, int horflag) 3557resize_frame_windows (struct frame *f, int size, int horflag)
3557{ 3558{
3558 Lisp_Object root = f->root_window; 3559 Lisp_Object root = FVAR (f, root_window);
3559 struct window *r = XWINDOW (root); 3560 struct window *r = XWINDOW (root);
3560 Lisp_Object mini = f->minibuffer_window; 3561 Lisp_Object mini = FVAR (f, minibuffer_window);
3561 struct window *m; 3562 struct window *m;
3562 /* new_size is the new size of the frame's root window. */ 3563 /* new_size is the new size of the frame's root window. */
3563 int new_size = (horflag 3564 int new_size = (horflag
@@ -3603,7 +3604,7 @@ resize_frame_windows (struct frame *f, int size, int horflag)
3603 { 3604 {
3604 /* We lost. Delete all windows but the frame's 3605 /* We lost. Delete all windows but the frame's
3605 selected one. */ 3606 selected one. */
3606 root = f->selected_window; 3607 root = FVAR (f, selected_window);
3607 Fdelete_other_windows_internal (root, Qnil); 3608 Fdelete_other_windows_internal (root, Qnil);
3608 if (horflag) 3609 if (horflag)
3609 XSETFASTINT (XWINDOW (root)->total_cols, new_size); 3610 XSETFASTINT (XWINDOW (root)->total_cols, new_size);
@@ -6464,8 +6465,8 @@ init_window_once (void)
6464 struct frame *f = make_initial_frame (); 6465 struct frame *f = make_initial_frame ();
6465 XSETFRAME (selected_frame, f); 6466 XSETFRAME (selected_frame, f);
6466 Vterminal_frame = selected_frame; 6467 Vterminal_frame = selected_frame;
6467 minibuf_window = f->minibuffer_window; 6468 minibuf_window = FVAR (f, minibuffer_window);
6468 selected_window = f->selected_window; 6469 selected_window = FVAR (f, selected_window);
6469 last_nonminibuf_frame = f; 6470 last_nonminibuf_frame = f;
6470 6471
6471 window_initialized = 1; 6472 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
460/* 1 if W is a menu bar window. */ 460/* 1 if W is a menu bar window. */
461 461
462#define WINDOW_MENU_BAR_P(W) \ 462#define WINDOW_MENU_BAR_P(W) \
463 (WINDOWP (WINDOW_XFRAME (W)->menu_bar_window) \ 463 (WINDOWP (FVAR (WINDOW_XFRAME (W), menu_bar_window)) \
464 && (W) == XWINDOW (WINDOW_XFRAME (W)->menu_bar_window)) 464 && (W) == XWINDOW (FVAR (WINDOW_XFRAME (W), menu_bar_window)))
465 465
466/* 1 if W is a tool bar window. */ 466/* 1 if W is a tool bar window. */
467 467
468#define WINDOW_TOOL_BAR_P(W) \ 468#define WINDOW_TOOL_BAR_P(W) \
469 (WINDOWP (WINDOW_XFRAME (W)->tool_bar_window) \ 469 (WINDOWP (FVAR (WINDOW_XFRAME (W), tool_bar_window)) \
470 && (W) == XWINDOW (WINDOW_XFRAME (W)->tool_bar_window)) 470 && (W) == XWINDOW (FVAR (WINDOW_XFRAME (W), tool_bar_window)))
471 471
472/* Return the frame y-position at which window W starts. 472/* Return the frame y-position at which window W starts.
473 This includes a header line, if any. */ 473 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,
10892 /* Similarly to `with-selected-window', if the operation selects 10892 /* Similarly to `with-selected-window', if the operation selects
10893 a window on another frame, we must restore that frame's 10893 a window on another frame, we must restore that frame's
10894 selected window, and (for a tty) the top-frame. */ 10894 selected window, and (for a tty) the top-frame. */
10895 ASET (vector, 8, target_frame->selected_window); 10895 ASET (vector, 8, FVAR (target_frame, selected_window));
10896 if (FRAME_TERMCAP_P (target_frame)) 10896 if (FRAME_TERMCAP_P (target_frame))
10897 ASET (vector, 9, FRAME_TTY (target_frame)->top_frame); 10897 ASET (vector, 9, FRAME_TTY (target_frame)->top_frame);
10898 } 10898 }
@@ -11052,13 +11052,13 @@ x_consider_frame_title (Lisp_Object frame)
11052 format_mode_line_unwind_data 11052 format_mode_line_unwind_data
11053 (f, current_buffer, selected_window, 0)); 11053 (f, current_buffer, selected_window, 0));
11054 11054
11055 Fselect_window (f->selected_window, Qt); 11055 Fselect_window (FVAR (f, selected_window), Qt);
11056 set_buffer_internal_1 (XBUFFER (XWINDOW (f->selected_window)->buffer)); 11056 set_buffer_internal_1 (XBUFFER (XWINDOW (FVAR (f, selected_window))->buffer));
11057 fmt = FRAME_ICONIFIED_P (f) ? Vicon_title_format : Vframe_title_format; 11057 fmt = FRAME_ICONIFIED_P (f) ? Vicon_title_format : Vframe_title_format;
11058 11058
11059 mode_line_target = MODE_LINE_TITLE; 11059 mode_line_target = MODE_LINE_TITLE;
11060 title_start = MODE_LINE_NOPROP_LEN (0); 11060 title_start = MODE_LINE_NOPROP_LEN (0);
11061 init_iterator (&it, XWINDOW (f->selected_window), -1, -1, 11061 init_iterator (&it, XWINDOW (FVAR (f, selected_window)), -1, -1,
11062 NULL, DEFAULT_FACE_ID); 11062 NULL, DEFAULT_FACE_ID);
11063 display_mode_element (&it, 0, -1, -1, fmt, Qnil, 0); 11063 display_mode_element (&it, 0, -1, -1, fmt, Qnil, 0);
11064 len = MODE_LINE_NOPROP_LEN (title_start); 11064 len = MODE_LINE_NOPROP_LEN (title_start);
@@ -11070,9 +11070,9 @@ x_consider_frame_title (Lisp_Object frame)
11070 already wasted too much time by walking through the list with 11070 already wasted too much time by walking through the list with
11071 display_mode_element, then we might need to optimize at a 11071 display_mode_element, then we might need to optimize at a
11072 higher level than this.) */ 11072 higher level than this.) */
11073 if (! STRINGP (f->name) 11073 if (! STRINGP (FVAR (f, name))
11074 || SBYTES (f->name) != len 11074 || SBYTES (FVAR (f, name)) != len
11075 || memcmp (title, SDATA (f->name), len) != 0) 11075 || memcmp (title, SDATA (FVAR (f, name)), len) != 0)
11076 x_implicitly_set_name (f, make_string (title, len), Qnil); 11076 x_implicitly_set_name (f, make_string (title, len), Qnil);
11077 } 11077 }
11078} 11078}
@@ -11172,7 +11172,7 @@ prepare_menu_bars (void)
11172 if (windows_or_buffers_changed 11172 if (windows_or_buffers_changed
11173 && FRAME_NS_P (f)) 11173 && FRAME_NS_P (f))
11174 ns_set_doc_edited (f, Fbuffer_modified_p 11174 ns_set_doc_edited (f, Fbuffer_modified_p
11175 (XWINDOW (f->selected_window)->buffer)); 11175 (XWINDOW (FVAR (f, selected_window))->buffer));
11176#endif 11176#endif
11177 UNGCPRO; 11177 UNGCPRO;
11178 } 11178 }
@@ -11413,8 +11413,8 @@ update_tool_bar (struct frame *f, int save_match_data)
11413#if defined (USE_GTK) || defined (HAVE_NS) 11413#if defined (USE_GTK) || defined (HAVE_NS)
11414 int do_update = FRAME_EXTERNAL_TOOL_BAR (f); 11414 int do_update = FRAME_EXTERNAL_TOOL_BAR (f);
11415#else 11415#else
11416 int do_update = WINDOWP (f->tool_bar_window) 11416 int do_update = WINDOWP (FVAR (f, tool_bar_window))
11417 && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window)) > 0; 11417 && WINDOW_TOTAL_LINES (XWINDOW (FVAR (f, tool_bar_window))) > 0;
11418#endif 11418#endif
11419 11419
11420 if (do_update) 11420 if (do_update)
@@ -11475,18 +11475,18 @@ update_tool_bar (struct frame *f, int save_match_data)
11475 selected_frame = frame; 11475 selected_frame = frame;
11476 11476
11477 /* Build desired tool-bar items from keymaps. */ 11477 /* Build desired tool-bar items from keymaps. */
11478 new_tool_bar = tool_bar_items (Fcopy_sequence (f->tool_bar_items), 11478 new_tool_bar = tool_bar_items
11479 &new_n_tool_bar); 11479 (Fcopy_sequence (FVAR (f, tool_bar_items)), &new_n_tool_bar);
11480 11480
11481 /* Redisplay the tool-bar if we changed it. */ 11481 /* Redisplay the tool-bar if we changed it. */
11482 if (new_n_tool_bar != f->n_tool_bar_items 11482 if (new_n_tool_bar != f->n_tool_bar_items
11483 || NILP (Fequal (new_tool_bar, f->tool_bar_items))) 11483 || NILP (Fequal (new_tool_bar, FVAR (f, tool_bar_items))))
11484 { 11484 {
11485 /* Redisplay that happens asynchronously due to an expose event 11485 /* Redisplay that happens asynchronously due to an expose event
11486 may access f->tool_bar_items. Make sure we update both 11486 may access f->tool_bar_items. Make sure we update both
11487 variables within BLOCK_INPUT so no such event interrupts. */ 11487 variables within BLOCK_INPUT so no such event interrupts. */
11488 BLOCK_INPUT; 11488 BLOCK_INPUT;
11489 f->tool_bar_items = new_tool_bar; 11489 FVAR (f, tool_bar_items) = new_tool_bar;
11490 f->n_tool_bar_items = new_n_tool_bar; 11490 f->n_tool_bar_items = new_n_tool_bar;
11491 w->update_mode_line = 1; 11491 w->update_mode_line = 1;
11492 UNBLOCK_INPUT; 11492 UNBLOCK_INPUT;
@@ -11519,22 +11519,22 @@ build_desired_tool_bar_string (struct frame *f)
11519 Otherwise, make a new string. */ 11519 Otherwise, make a new string. */
11520 11520
11521 /* The size of the string we might be able to reuse. */ 11521 /* The size of the string we might be able to reuse. */
11522 size = (STRINGP (f->desired_tool_bar_string) 11522 size = (STRINGP (FVAR (f, desired_tool_bar_string))
11523 ? SCHARS (f->desired_tool_bar_string) 11523 ? SCHARS (FVAR (f, desired_tool_bar_string))
11524 : 0); 11524 : 0);
11525 11525
11526 /* We need one space in the string for each image. */ 11526 /* We need one space in the string for each image. */
11527 size_needed = f->n_tool_bar_items; 11527 size_needed = f->n_tool_bar_items;
11528 11528
11529 /* Reuse f->desired_tool_bar_string, if possible. */ 11529 /* Reuse f->desired_tool_bar_string, if possible. */
11530 if (size < size_needed || NILP (f->desired_tool_bar_string)) 11530 if (size < size_needed || NILP (FVAR (f, desired_tool_bar_string)))
11531 f->desired_tool_bar_string = Fmake_string (make_number (size_needed), 11531 FVAR (f, desired_tool_bar_string)
11532 make_number (' ')); 11532 = Fmake_string (make_number (size_needed), make_number (' '));
11533 else 11533 else
11534 { 11534 {
11535 props = list4 (Qdisplay, Qnil, Qmenu_item, Qnil); 11535 props = list4 (Qdisplay, Qnil, Qmenu_item, Qnil);
11536 Fremove_text_properties (make_number (0), make_number (size), 11536 Fremove_text_properties (make_number (0), make_number (size),
11537 props, f->desired_tool_bar_string); 11537 props, FVAR (f, desired_tool_bar_string));
11538 } 11538 }
11539 11539
11540 /* Put a `display' property on the string for the images to display, 11540 /* Put a `display' property on the string for the images to display,
@@ -11542,7 +11542,8 @@ build_desired_tool_bar_string (struct frame *f)
11542 is the index of the item in F's tool-bar item vector. */ 11542 is the index of the item in F's tool-bar item vector. */
11543 for (i = 0; i < f->n_tool_bar_items; ++i) 11543 for (i = 0; i < f->n_tool_bar_items; ++i)
11544 { 11544 {
11545#define PROP(IDX) AREF (f->tool_bar_items, i * TOOL_BAR_ITEM_NSLOTS + (IDX)) 11545#define PROP(IDX) \
11546 AREF (FVAR (f, tool_bar_items), i * TOOL_BAR_ITEM_NSLOTS + (IDX))
11546 11547
11547 int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P)); 11548 int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P));
11548 int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P)); 11549 int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P));
@@ -11651,11 +11652,11 @@ build_desired_tool_bar_string (struct frame *f)
11651 string. The string can be longer than needed when we reuse a 11652 string. The string can be longer than needed when we reuse a
11652 previous string. */ 11653 previous string. */
11653 if (i + 1 == f->n_tool_bar_items) 11654 if (i + 1 == f->n_tool_bar_items)
11654 end = SCHARS (f->desired_tool_bar_string); 11655 end = SCHARS (FVAR (f, desired_tool_bar_string));
11655 else 11656 else
11656 end = i + 1; 11657 end = i + 1;
11657 Fadd_text_properties (make_number (i), make_number (end), 11658 Fadd_text_properties (make_number (i), make_number (end),
11658 props, f->desired_tool_bar_string); 11659 props, FVAR (f, desired_tool_bar_string));
11659#undef PROP 11660#undef PROP
11660 } 11661 }
11661 11662
@@ -11805,7 +11806,7 @@ display_tool_bar_line (struct it *it, int height)
11805static int 11806static int
11806tool_bar_lines_needed (struct frame *f, int *n_rows) 11807tool_bar_lines_needed (struct frame *f, int *n_rows)
11807{ 11808{
11808 struct window *w = XWINDOW (f->tool_bar_window); 11809 struct window *w = XWINDOW (FVAR (f, tool_bar_window));
11809 struct it it; 11810 struct it it;
11810 /* tool_bar_lines_needed is called from redisplay_tool_bar after building 11811 /* tool_bar_lines_needed is called from redisplay_tool_bar after building
11811 the desired matrix, so use (unused) mode-line row as temporary row to 11812 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)
11817 init_iterator (&it, w, -1, -1, temp_row, TOOL_BAR_FACE_ID); 11818 init_iterator (&it, w, -1, -1, temp_row, TOOL_BAR_FACE_ID);
11818 it.first_visible_x = 0; 11819 it.first_visible_x = 0;
11819 it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f); 11820 it.last_visible_x = FRAME_TOTAL_COLS (f) * FRAME_COLUMN_WIDTH (f);
11820 reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1); 11821 reseat_to_string (&it, NULL, FVAR (f, desired_tool_bar_string), 0, 0, 0, -1);
11821 it.paragraph_embedding = L2R; 11822 it.paragraph_embedding = L2R;
11822 11823
11823 while (!ITERATOR_AT_END_P (&it)) 11824 while (!ITERATOR_AT_END_P (&it))
@@ -11851,8 +11852,8 @@ DEFUN ("tool-bar-lines-needed", Ftool_bar_lines_needed, Stool_bar_lines_needed,
11851 CHECK_FRAME (frame); 11852 CHECK_FRAME (frame);
11852 f = XFRAME (frame); 11853 f = XFRAME (frame);
11853 11854
11854 if (WINDOWP (f->tool_bar_window) 11855 if (WINDOWP (FVAR (f, tool_bar_window))
11855 && (w = XWINDOW (f->tool_bar_window), 11856 && (w = XWINDOW (FVAR (f, tool_bar_window)),
11856 WINDOW_TOTAL_LINES (w) > 0)) 11857 WINDOW_TOTAL_LINES (w) > 0))
11857 { 11858 {
11858 update_tool_bar (f, 1); 11859 update_tool_bar (f, 1);
@@ -11887,8 +11888,8 @@ redisplay_tool_bar (struct frame *f)
11887 do anything. This means you must start with tool-bar-lines 11888 do anything. This means you must start with tool-bar-lines
11888 non-zero to get the auto-sizing effect. Or in other words, you 11889 non-zero to get the auto-sizing effect. Or in other words, you
11889 can turn off tool-bars by specifying tool-bar-lines zero. */ 11890 can turn off tool-bars by specifying tool-bar-lines zero. */
11890 if (!WINDOWP (f->tool_bar_window) 11891 if (!WINDOWP (FVAR (f, tool_bar_window))
11891 || (w = XWINDOW (f->tool_bar_window), 11892 || (w = XWINDOW (FVAR (f, tool_bar_window)),
11892 WINDOW_TOTAL_LINES (w) == 0)) 11893 WINDOW_TOTAL_LINES (w) == 0))
11893 return 0; 11894 return 0;
11894 11895
@@ -11900,7 +11901,7 @@ redisplay_tool_bar (struct frame *f)
11900 11901
11901 /* Build a string that represents the contents of the tool-bar. */ 11902 /* Build a string that represents the contents of the tool-bar. */
11902 build_desired_tool_bar_string (f); 11903 build_desired_tool_bar_string (f);
11903 reseat_to_string (&it, NULL, f->desired_tool_bar_string, 0, 0, 0, -1); 11904 reseat_to_string (&it, NULL, FVAR (f, desired_tool_bar_string), 0, 0, 0, -1);
11904 /* FIXME: This should be controlled by a user option. But it 11905 /* FIXME: This should be controlled by a user option. But it
11905 doesn't make sense to have an R2L tool bar if the menu bar cannot 11906 doesn't make sense to have an R2L tool bar if the menu bar cannot
11906 be drawn also R2L, and making the menu bar R2L is tricky due 11907 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)
12057 /* This function can be called asynchronously, which means we must 12058 /* This function can be called asynchronously, which means we must
12058 exclude any possibility that Fget_text_property signals an 12059 exclude any possibility that Fget_text_property signals an
12059 error. */ 12060 error. */
12060 charpos = min (SCHARS (f->current_tool_bar_string), glyph->charpos); 12061 charpos = min (SCHARS (FVAR (f, current_tool_bar_string)), glyph->charpos);
12061 charpos = max (0, charpos); 12062 charpos = max (0, charpos);
12062 12063
12063 /* Get the text property `menu-item' at pos. The value of that 12064 /* Get the text property `menu-item' at pos. The value of that
12064 property is the start index of this item's properties in 12065 property is the start index of this item's properties in
12065 F->tool_bar_items. */ 12066 F->tool_bar_items. */
12066 prop = Fget_text_property (make_number (charpos), 12067 prop = Fget_text_property (make_number (charpos),
12067 Qmenu_item, f->current_tool_bar_string); 12068 Qmenu_item, FVAR (f, current_tool_bar_string));
12068 if (INTEGERP (prop)) 12069 if (INTEGERP (prop))
12069 { 12070 {
12070 *prop_idx = XINT (prop); 12071 *prop_idx = XINT (prop);
@@ -12092,7 +12093,7 @@ get_tool_bar_item (struct frame *f, int x, int y, struct glyph **glyph,
12092 int *hpos, int *vpos, int *prop_idx) 12093 int *hpos, int *vpos, int *prop_idx)
12093{ 12094{
12094 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); 12095 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
12095 struct window *w = XWINDOW (f->tool_bar_window); 12096 struct window *w = XWINDOW (FVAR (f, tool_bar_window));
12096 int area; 12097 int area;
12097 12098
12098 /* Find the glyph under X/Y. */ 12099 /* Find the glyph under X/Y. */
@@ -12106,7 +12107,7 @@ get_tool_bar_item (struct frame *f, int x, int y, struct glyph **glyph,
12106 return -1; 12107 return -1;
12107 12108
12108 /* Is mouse on the highlighted item? */ 12109 /* Is mouse on the highlighted item? */
12109 if (EQ (f->tool_bar_window, hlinfo->mouse_face_window) 12110 if (EQ (FVAR (f, tool_bar_window), hlinfo->mouse_face_window)
12110 && *vpos >= hlinfo->mouse_face_beg_row 12111 && *vpos >= hlinfo->mouse_face_beg_row
12111 && *vpos <= hlinfo->mouse_face_end_row 12112 && *vpos <= hlinfo->mouse_face_end_row
12112 && (*vpos > hlinfo->mouse_face_beg_row 12113 && (*vpos > hlinfo->mouse_face_beg_row
@@ -12131,7 +12132,7 @@ handle_tool_bar_click (struct frame *f, int x, int y, int down_p,
12131 int modifiers) 12132 int modifiers)
12132{ 12133{
12133 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); 12134 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
12134 struct window *w = XWINDOW (f->tool_bar_window); 12135 struct window *w = XWINDOW (FVAR (f, tool_bar_window));
12135 int hpos, vpos, prop_idx; 12136 int hpos, vpos, prop_idx;
12136 struct glyph *glyph; 12137 struct glyph *glyph;
12137 Lisp_Object enabled_p; 12138 Lisp_Object enabled_p;
@@ -12142,7 +12143,7 @@ handle_tool_bar_click (struct frame *f, int x, int y, int down_p,
12142 return; 12143 return;
12143 12144
12144 /* If item is disabled, do nothing. */ 12145 /* If item is disabled, do nothing. */
12145 enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P); 12146 enabled_p = AREF (FVAR (f, tool_bar_items), prop_idx + TOOL_BAR_ITEM_ENABLED_P);
12146 if (NILP (enabled_p)) 12147 if (NILP (enabled_p))
12147 return; 12148 return;
12148 12149
@@ -12163,7 +12164,7 @@ handle_tool_bar_click (struct frame *f, int x, int y, int down_p,
12163 show_mouse_face (hlinfo, DRAW_IMAGE_RAISED); 12164 show_mouse_face (hlinfo, DRAW_IMAGE_RAISED);
12164 hlinfo->mouse_face_image_state = DRAW_IMAGE_RAISED; 12165 hlinfo->mouse_face_image_state = DRAW_IMAGE_RAISED;
12165 12166
12166 key = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_KEY); 12167 key = AREF (FVAR (f, tool_bar_items), prop_idx + TOOL_BAR_ITEM_KEY);
12167 12168
12168 XSETFRAME (frame, f); 12169 XSETFRAME (frame, f);
12169 event.kind = TOOL_BAR_EVENT; 12170 event.kind = TOOL_BAR_EVENT;
@@ -12188,7 +12189,7 @@ handle_tool_bar_click (struct frame *f, int x, int y, int down_p,
12188static void 12189static void
12189note_tool_bar_highlight (struct frame *f, int x, int y) 12190note_tool_bar_highlight (struct frame *f, int x, int y)
12190{ 12191{
12191 Lisp_Object window = f->tool_bar_window; 12192 Lisp_Object window = FVAR (f, tool_bar_window);
12192 struct window *w = XWINDOW (window); 12193 struct window *w = XWINDOW (window);
12193 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f); 12194 Display_Info *dpyinfo = FRAME_X_DISPLAY_INFO (f);
12194 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); 12195 Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f);
@@ -12234,7 +12235,7 @@ note_tool_bar_highlight (struct frame *f, int x, int y)
12234 draw = mouse_down_p ? DRAW_IMAGE_SUNKEN : DRAW_IMAGE_RAISED; 12235 draw = mouse_down_p ? DRAW_IMAGE_SUNKEN : DRAW_IMAGE_RAISED;
12235 12236
12236 /* If tool-bar item is not enabled, don't highlight it. */ 12237 /* If tool-bar item is not enabled, don't highlight it. */
12237 enabled_p = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_ENABLED_P); 12238 enabled_p = AREF (FVAR (f, tool_bar_items), prop_idx + TOOL_BAR_ITEM_ENABLED_P);
12238 if (!NILP (enabled_p)) 12239 if (!NILP (enabled_p))
12239 { 12240 {
12240 /* Compute the x-position of the glyph. In front and past the 12241 /* 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)
12268 XTread_socket does the rest. */ 12269 XTread_socket does the rest. */
12269 help_echo_object = help_echo_window = Qnil; 12270 help_echo_object = help_echo_window = Qnil;
12270 help_echo_pos = -1; 12271 help_echo_pos = -1;
12271 help_echo_string = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_HELP); 12272 help_echo_string = AREF (FVAR (f, tool_bar_items), prop_idx + TOOL_BAR_ITEM_HELP);
12272 if (NILP (help_echo_string)) 12273 if (NILP (help_echo_string))
12273 help_echo_string = AREF (f->tool_bar_items, prop_idx + TOOL_BAR_ITEM_CAPTION); 12274 help_echo_string = AREF (FVAR (f, tool_bar_items), prop_idx + TOOL_BAR_ITEM_CAPTION);
12274} 12275}
12275 12276
12276#endif /* HAVE_WINDOW_SYSTEM */ 12277#endif /* HAVE_WINDOW_SYSTEM */
@@ -12851,7 +12852,8 @@ select_frame_for_redisplay (Lisp_Object frame)
12851 selected_frame = frame; 12852 selected_frame = frame;
12852 12853
12853 do { 12854 do {
12854 for (tail = XFRAME (frame)->param_alist; CONSP (tail); tail = XCDR (tail)) 12855 for (tail = FVAR (XFRAME (frame), param_alist);
12856 CONSP (tail); tail = XCDR (tail))
12855 if (CONSP (XCAR (tail)) 12857 if (CONSP (XCAR (tail))
12856 && (tem = XCAR (XCAR (tail)), 12858 && (tem = XCAR (XCAR (tail)),
12857 SYMBOLP (tem)) 12859 SYMBOLP (tem))
@@ -13424,7 +13426,7 @@ redisplay_internal (void)
13424 if (!f->already_hscrolled_p) 13426 if (!f->already_hscrolled_p)
13425 { 13427 {
13426 f->already_hscrolled_p = 1; 13428 f->already_hscrolled_p = 1;
13427 if (hscroll_windows (f->root_window)) 13429 if (hscroll_windows (FVAR (f, root_window)))
13428 goto retry; 13430 goto retry;
13429 } 13431 }
13430 13432
@@ -13437,7 +13439,7 @@ redisplay_internal (void)
13437 STOP_POLLING; 13439 STOP_POLLING;
13438 13440
13439 /* Update the display. */ 13441 /* Update the display. */
13440 set_window_update_flags (XWINDOW (f->root_window), 1); 13442 set_window_update_flags (XWINDOW (FVAR (f, root_window)), 1);
13441 pending |= update_frame (f, 0, 0); 13443 pending |= update_frame (f, 0, 0);
13442 f->updated_p = 1; 13444 f->updated_p = 1;
13443 } 13445 }
@@ -13450,7 +13452,8 @@ redisplay_internal (void)
13450 and selected_window to be temporarily out-of-sync but let's make 13452 and selected_window to be temporarily out-of-sync but let's make
13451 sure this stays contained. */ 13453 sure this stays contained. */
13452 select_frame_for_redisplay (old_frame); 13454 select_frame_for_redisplay (old_frame);
13453 eassert (EQ (XFRAME (selected_frame)->selected_window, selected_window)); 13455 eassert (EQ (FVAR (XFRAME (selected_frame), selected_window),
13456 selected_window));
13454 13457
13455 if (!pending) 13458 if (!pending)
13456 { 13459 {
@@ -13462,7 +13465,7 @@ redisplay_internal (void)
13462 struct frame *f = XFRAME (frame); 13465 struct frame *f = XFRAME (frame);
13463 if (f->updated_p) 13466 if (f->updated_p)
13464 { 13467 {
13465 mark_window_display_accurate (f->root_window, 1); 13468 mark_window_display_accurate (FVAR (f, root_window), 1);
13466 if (FRAME_TERMINAL (f)->frame_up_to_date_hook) 13469 if (FRAME_TERMINAL (f)->frame_up_to_date_hook)
13467 FRAME_TERMINAL (f)->frame_up_to_date_hook (f); 13470 FRAME_TERMINAL (f)->frame_up_to_date_hook (f);
13468 } 13471 }
@@ -16158,7 +16161,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
16158 if (FRAME_EXTERNAL_TOOL_BAR (f)) 16161 if (FRAME_EXTERNAL_TOOL_BAR (f))
16159 redisplay_tool_bar (f); 16162 redisplay_tool_bar (f);
16160#else 16163#else
16161 if (WINDOWP (f->tool_bar_window) 16164 if (WINDOWP (FVAR (f, tool_bar_window))
16162 && (FRAME_TOOL_BAR_LINES (f) > 0 16165 && (FRAME_TOOL_BAR_LINES (f) > 0
16163 || !NILP (Vauto_resize_tool_bars)) 16166 || !NILP (Vauto_resize_tool_bars))
16164 && redisplay_tool_bar (f)) 16167 && redisplay_tool_bar (f))
@@ -18113,7 +18116,7 @@ GLYPH > 1 or omitted means dump glyphs in long form. */)
18113 (Lisp_Object row, Lisp_Object glyphs) 18116 (Lisp_Object row, Lisp_Object glyphs)
18114{ 18117{
18115 struct frame *sf = SELECTED_FRAME (); 18118 struct frame *sf = SELECTED_FRAME ();
18116 struct glyph_matrix *m = XWINDOW (sf->tool_bar_window)->current_matrix; 18119 struct glyph_matrix *m = XWINDOW (FVAR (sf, tool_bar_window))->current_matrix;
18117 EMACS_INT vpos; 18120 EMACS_INT vpos;
18118 18121
18119 CHECK_NUMBER (row); 18122 CHECK_NUMBER (row);
@@ -20098,8 +20101,8 @@ display_menu_bar (struct window *w)
20098 /* Menu bar lines are displayed in the desired matrix of the 20101 /* Menu bar lines are displayed in the desired matrix of the
20099 dummy window menu_bar_window. */ 20102 dummy window menu_bar_window. */
20100 struct window *menu_w; 20103 struct window *menu_w;
20101 eassert (WINDOWP (f->menu_bar_window)); 20104 eassert (WINDOWP (FVAR (f, menu_bar_window)));
20102 menu_w = XWINDOW (f->menu_bar_window); 20105 menu_w = XWINDOW (FVAR (f, menu_bar_window));
20103 init_iterator (&it, menu_w, -1, -1, menu_w->desired_matrix->rows, 20106 init_iterator (&it, menu_w, -1, -1, menu_w->desired_matrix->rows,
20104 MENU_FACE_ID); 20107 MENU_FACE_ID);
20105 it.first_visible_x = 0; 20108 it.first_visible_x = 0;
@@ -21403,10 +21406,10 @@ decode_mode_spec (struct window *w, register int c, int field_width,
21403 21406
21404 case 'F': 21407 case 'F':
21405 /* %F displays the frame name. */ 21408 /* %F displays the frame name. */
21406 if (!NILP (f->title)) 21409 if (!NILP (FVAR (f, title)))
21407 return SSDATA (f->title); 21410 return SSDATA (FVAR (f, title));
21408 if (f->explicit_name || ! FRAME_WINDOW_P (f)) 21411 if (f->explicit_name || ! FRAME_WINDOW_P (f))
21409 return SSDATA (f->name); 21412 return SSDATA (FVAR (f, name));
21410 return "Emacs"; 21413 return "Emacs";
21411 21414
21412 case 'f': 21415 case 'f':
@@ -25570,7 +25573,7 @@ get_window_cursor_type (struct window *w, struct glyph *glyph, int *width,
25570 } 25573 }
25571 25574
25572 /* Detect a nonselected window or nonselected frame. */ 25575 /* Detect a nonselected window or nonselected frame. */
25573 else if (w != XWINDOW (f->selected_window) 25576 else if (w != XWINDOW (FVAR (f, selected_window))
25574 || f != FRAME_X_DISPLAY_INFO (f)->x_highlight_frame) 25577 || f != FRAME_X_DISPLAY_INFO (f)->x_highlight_frame)
25575 { 25578 {
25576 *active_cursor = 0; 25579 *active_cursor = 0;
@@ -26112,7 +26115,7 @@ update_cursor_in_window_tree (struct window *w, int on_p)
26112void 26115void
26113x_update_cursor (struct frame *f, int on_p) 26116x_update_cursor (struct frame *f, int on_p)
26114{ 26117{
26115 update_cursor_in_window_tree (XWINDOW (f->root_window), on_p); 26118 update_cursor_in_window_tree (XWINDOW (FVAR (f, root_window)), on_p);
26116} 26119}
26117 26120
26118 26121
@@ -26271,7 +26274,7 @@ show_mouse_face (Mouse_HLInfo *hlinfo, enum draw_glyphs_face draw)
26271 if (FRAME_WINDOW_P (f)) 26274 if (FRAME_WINDOW_P (f))
26272 { 26275 {
26273 if (draw == DRAW_NORMAL_TEXT 26276 if (draw == DRAW_NORMAL_TEXT
26274 && !EQ (hlinfo->mouse_face_window, f->tool_bar_window)) 26277 && !EQ (hlinfo->mouse_face_window, FVAR (f, tool_bar_window)))
26275 FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor); 26278 FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->text_cursor);
26276 else if (draw == DRAW_MOUSE_FACE) 26279 else if (draw == DRAW_MOUSE_FACE)
26277 FRAME_RIF (f)->define_frame_cursor (f, FRAME_X_OUTPUT (f)->hand_cursor); 26280 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)
27627#ifdef HAVE_WINDOW_SYSTEM 27630#ifdef HAVE_WINDOW_SYSTEM
27628 /* Handle tool-bar window differently since it doesn't display a 27631 /* Handle tool-bar window differently since it doesn't display a
27629 buffer. */ 27632 buffer. */
27630 if (EQ (window, f->tool_bar_window)) 27633 if (EQ (window, FVAR (f, tool_bar_window)))
27631 { 27634 {
27632 note_tool_bar_highlight (f, x, y); 27635 note_tool_bar_highlight (f, x, y);
27633 return; 27636 return;
@@ -28537,18 +28540,18 @@ expose_frame (struct frame *f, int x, int y, int w, int h)
28537 } 28540 }
28538 28541
28539 TRACE ((stderr, "(%d, %d, %d, %d)\n", r.x, r.y, r.width, r.height)); 28542 TRACE ((stderr, "(%d, %d, %d, %d)\n", r.x, r.y, r.width, r.height));
28540 mouse_face_overwritten_p = expose_window_tree (XWINDOW (f->root_window), &r); 28543 mouse_face_overwritten_p = expose_window_tree (XWINDOW (FVAR (f, root_window)), &r);
28541 28544
28542 if (WINDOWP (f->tool_bar_window)) 28545 if (WINDOWP (FVAR (f, tool_bar_window)))
28543 mouse_face_overwritten_p 28546 mouse_face_overwritten_p
28544 |= expose_window (XWINDOW (f->tool_bar_window), &r); 28547 |= expose_window (XWINDOW (FVAR (f, tool_bar_window)), &r);
28545 28548
28546#ifdef HAVE_X_WINDOWS 28549#ifdef HAVE_X_WINDOWS
28547#ifndef MSDOS 28550#ifndef MSDOS
28548#ifndef USE_X_TOOLKIT 28551#ifndef USE_X_TOOLKIT
28549 if (WINDOWP (f->menu_bar_window)) 28552 if (WINDOWP (FVAR (f, menu_bar_window)))
28550 mouse_face_overwritten_p 28553 mouse_face_overwritten_p
28551 |= expose_window (XWINDOW (f->menu_bar_window), &r); 28554 |= expose_window (XWINDOW (FVAR (f, menu_bar_window)), &r);
28552#endif /* not USE_X_TOOLKIT */ 28555#endif /* not USE_X_TOOLKIT */
28553#endif 28556#endif
28554#endif 28557#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,
2051 Lisp_Object lface; 2051 Lisp_Object lface;
2052 2052
2053 if (f) 2053 if (f)
2054 lface = assq_no_quit (face_name, f->face_alist); 2054 lface = assq_no_quit (face_name, FVAR (f, face_alist));
2055 else 2055 else
2056 lface = assq_no_quit (face_name, Vface_new_frame_defaults); 2056 lface = assq_no_quit (face_name, Vface_new_frame_defaults);
2057 2057
@@ -2678,7 +2678,8 @@ Value is a vector of face attributes. */)
2678 lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE), 2678 lface = Fmake_vector (make_number (LFACE_VECTOR_SIZE),
2679 Qunspecified); 2679 Qunspecified);
2680 ASET (lface, 0, Qface); 2680 ASET (lface, 0, Qface);
2681 f->face_alist = Fcons (Fcons (face, lface), f->face_alist); 2681 FVAR (f, face_alist) = Fcons (Fcons (face, lface), FVAR (f,
2682 face_alist));
2682 } 2683 }
2683 else 2684 else
2684 for (i = 1; i < LFACE_VECTOR_SIZE; ++i) 2685 for (i = 1; i < LFACE_VECTOR_SIZE; ++i)
@@ -3357,7 +3358,7 @@ update_face_from_frame_parameter (struct frame *f, Lisp_Object param,
3357 /* If there are no faces yet, give up. This is the case when called 3358 /* If there are no faces yet, give up. This is the case when called
3358 from Fx_create_frame, and we do the necessary things later in 3359 from Fx_create_frame, and we do the necessary things later in
3359 face-set-after-frame-defaults. */ 3360 face-set-after-frame-defaults. */
3360 if (NILP (f->face_alist)) 3361 if (NILP (FVAR (f, face_alist)))
3361 return; 3362 return;
3362 3363
3363 if (EQ (param, Qforeground_color)) 3364 if (EQ (param, Qforeground_color))
@@ -4043,7 +4044,7 @@ For internal use only. */)
4043 (Lisp_Object frame) 4044 (Lisp_Object frame)
4044{ 4045{
4045 struct frame *f = frame_or_selected_frame (frame, 0); 4046 struct frame *f = frame_or_selected_frame (frame, 0);
4046 return f->face_alist; 4047 return FVAR (f, face_alist);
4047} 4048}
4048 4049
4049 4050
@@ -4334,7 +4335,7 @@ free_realized_faces (struct face_cache *c)
4334 matrices as invalid because they will reference faces freed 4335 matrices as invalid because they will reference faces freed
4335 above. This function is also called when a frame is 4336 above. This function is also called when a frame is
4336 destroyed. In this case, the root window of F is nil. */ 4337 destroyed. In this case, the root window of F is nil. */
4337 if (WINDOWP (f->root_window)) 4338 if (WINDOWP (FVAR (f, root_window)))
4338 { 4339 {
4339 clear_current_matrices (f); 4340 clear_current_matrices (f);
4340 ++windows_or_buffers_changed; 4341 ++windows_or_buffers_changed;
@@ -5107,7 +5108,7 @@ face for italic. */)
5107 { 5108 {
5108 frame = XCAR (fl_tail); 5109 frame = XCAR (fl_tail);
5109 if (!NILP (Fequal (Fcdr (Fassq (Qdisplay, 5110 if (!NILP (Fequal (Fcdr (Fassq (Qdisplay,
5110 XFRAME (frame)->param_alist)), 5111 FVAR (XFRAME (frame), param_alist))),
5111 display))) 5112 display)))
5112 break; 5113 break;
5113 } 5114 }
@@ -5403,7 +5404,7 @@ realize_default_face (struct frame *f)
5403 { 5404 {
5404 /* This function is called so early that colors are not yet 5405 /* This function is called so early that colors are not yet
5405 set in the frame parameter list. */ 5406 set in the frame parameter list. */
5406 Lisp_Object color = Fassq (Qforeground_color, f->param_alist); 5407 Lisp_Object color = Fassq (Qforeground_color, FVAR (f, param_alist));
5407 5408
5408 if (CONSP (color) && STRINGP (XCDR (color))) 5409 if (CONSP (color) && STRINGP (XCDR (color)))
5409 LFACE_FOREGROUND (lface) = XCDR (color); 5410 LFACE_FOREGROUND (lface) = XCDR (color);
@@ -5419,7 +5420,7 @@ realize_default_face (struct frame *f)
5419 { 5420 {
5420 /* This function is called so early that colors are not yet 5421 /* This function is called so early that colors are not yet
5421 set in the frame parameter list. */ 5422 set in the frame parameter list. */
5422 Lisp_Object color = Fassq (Qbackground_color, f->param_alist); 5423 Lisp_Object color = Fassq (Qbackground_color, FVAR (f, param_alist));
5423 if (CONSP (color) && STRINGP (XCDR (color))) 5424 if (CONSP (color) && STRINGP (XCDR (color)))
5424 LFACE_BACKGROUND (lface) = XCDR (color); 5425 LFACE_BACKGROUND (lface) = XCDR (color);
5425 else if (FRAME_WINDOW_P (f)) 5426 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,
665 665
666#ifdef USE_GTK 666#ifdef USE_GTK
667 if (xg_change_toolbar_position (f, new_value)) 667 if (xg_change_toolbar_position (f, new_value))
668 f->tool_bar_position = new_value; 668 FVAR (f, tool_bar_position) = new_value;
669#endif 669#endif
670} 670}
671 671
@@ -1123,9 +1123,9 @@ x_set_icon_type (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1123 BLOCK_INPUT; 1123 BLOCK_INPUT;
1124 if (NILP (arg)) 1124 if (NILP (arg))
1125 result = x_text_icon (f, 1125 result = x_text_icon (f,
1126 SSDATA ((!NILP (f->icon_name) 1126 SSDATA ((!NILP (FVAR (f, icon_name))
1127 ? f->icon_name 1127 ? FVAR (f, icon_name)
1128 : f->name))); 1128 : FVAR (f, name))));
1129 else 1129 else
1130 result = x_bitmap_icon (f, arg); 1130 result = x_bitmap_icon (f, arg);
1131 1131
@@ -1152,7 +1152,7 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1152 else if (!NILP (arg) || NILP (oldval)) 1152 else if (!NILP (arg) || NILP (oldval))
1153 return; 1153 return;
1154 1154
1155 f->icon_name = arg; 1155 FVAR (f, icon_name) = arg;
1156 1156
1157 if (f->output_data.x->icon_bitmap != 0) 1157 if (f->output_data.x->icon_bitmap != 0)
1158 return; 1158 return;
@@ -1160,11 +1160,11 @@ x_set_icon_name (struct frame *f, Lisp_Object arg, Lisp_Object oldval)
1160 BLOCK_INPUT; 1160 BLOCK_INPUT;
1161 1161
1162 result = x_text_icon (f, 1162 result = x_text_icon (f,
1163 SSDATA ((!NILP (f->icon_name) 1163 SSDATA ((!NILP (FVAR (f, icon_name))
1164 ? f->icon_name 1164 ? FVAR (f, icon_name)
1165 : !NILP (f->title) 1165 : !NILP (FVAR (f, title))
1166 ? f->title 1166 ? FVAR (f, title)
1167 : f->name))); 1167 : FVAR (f, name))));
1168 1168
1169 if (result) 1169 if (result)
1170 { 1170 {
@@ -1352,8 +1352,8 @@ x_set_tool_bar_lines (struct frame *f, Lisp_Object value, Lisp_Object oldval)
1352 UNBLOCK_INPUT; 1352 UNBLOCK_INPUT;
1353 } 1353 }
1354 1354
1355 if (WINDOWP (f->tool_bar_window)) 1355 if (WINDOWP (FVAR (f, tool_bar_window)))
1356 clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix); 1356 clear_glyph_matrix (XWINDOW (FVAR (f, tool_bar_window))->current_matrix);
1357 } 1357 }
1358 1358
1359 run_window_configuration_change_hook (f); 1359 run_window_configuration_change_hook (f);
@@ -1548,7 +1548,7 @@ x_set_name_internal (FRAME_PTR f, Lisp_Object name)
1548 if (text.nitems != bytes) 1548 if (text.nitems != bytes)
1549 error ("Window name too large"); 1549 error ("Window name too large");
1550 1550
1551 if (!STRINGP (f->icon_name)) 1551 if (!STRINGP (FVAR (f, icon_name)))
1552 { 1552 {
1553 icon = text; 1553 icon = text;
1554 encoded_icon_name = encoded_name; 1554 encoded_icon_name = encoded_name;
@@ -1556,7 +1556,7 @@ x_set_name_internal (FRAME_PTR f, Lisp_Object name)
1556 else 1556 else
1557 { 1557 {
1558 /* See the above comment "Note: Encoding strategy". */ 1558 /* See the above comment "Note: Encoding strategy". */
1559 icon.value = x_encode_text (f->icon_name, coding_system, 0, 1559 icon.value = x_encode_text (FVAR (f, icon_name), coding_system, 0,
1560 &bytes, &stringp, &do_free_icon_value); 1560 &bytes, &stringp, &do_free_icon_value);
1561 icon.encoding = (stringp ? XA_STRING 1561 icon.encoding = (stringp ? XA_STRING
1562 : FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT); 1562 : FRAME_X_DISPLAY_INFO (f)->Xatom_COMPOUND_TEXT);
@@ -1565,7 +1565,7 @@ x_set_name_internal (FRAME_PTR f, Lisp_Object name)
1565 if (icon.nitems != bytes) 1565 if (icon.nitems != bytes)
1566 error ("Icon name too large"); 1566 error ("Icon name too large");
1567 1567
1568 encoded_icon_name = ENCODE_UTF_8 (f->icon_name); 1568 encoded_icon_name = ENCODE_UTF_8 (FVAR (f, icon_name));
1569 } 1569 }
1570 1570
1571#ifdef USE_GTK 1571#ifdef USE_GTK
@@ -1632,7 +1632,7 @@ x_set_name (struct frame *f, Lisp_Object name, int explicit)
1632 /* Check for no change needed in this very common case 1632 /* Check for no change needed in this very common case
1633 before we do any consing. */ 1633 before we do any consing. */
1634 if (!strcmp (FRAME_X_DISPLAY_INFO (f)->x_id_name, 1634 if (!strcmp (FRAME_X_DISPLAY_INFO (f)->x_id_name,
1635 SSDATA (f->name))) 1635 SSDATA (FVAR (f, name))))
1636 return; 1636 return;
1637 name = build_string (FRAME_X_DISPLAY_INFO (f)->x_id_name); 1637 name = build_string (FRAME_X_DISPLAY_INFO (f)->x_id_name);
1638 } 1638 }
@@ -1640,15 +1640,15 @@ x_set_name (struct frame *f, Lisp_Object name, int explicit)
1640 CHECK_STRING (name); 1640 CHECK_STRING (name);
1641 1641
1642 /* Don't change the name if it's already NAME. */ 1642 /* Don't change the name if it's already NAME. */
1643 if (! NILP (Fstring_equal (name, f->name))) 1643 if (! NILP (Fstring_equal (name, FVAR (f, name))))
1644 return; 1644 return;
1645 1645
1646 f->name = name; 1646 FVAR (f, name) = name;
1647 1647
1648 /* For setting the frame title, the title parameter should override 1648 /* For setting the frame title, the title parameter should override
1649 the name parameter. */ 1649 the name parameter. */
1650 if (! NILP (f->title)) 1650 if (! NILP (FVAR (f, title)))
1651 name = f->title; 1651 name = FVAR (f, title);
1652 1652
1653 x_set_name_internal (f, name); 1653 x_set_name_internal (f, name);
1654} 1654}
@@ -1678,15 +1678,15 @@ static void
1678x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name) 1678x_set_title (struct frame *f, Lisp_Object name, Lisp_Object old_name)
1679{ 1679{
1680 /* Don't change the title if it's already NAME. */ 1680 /* Don't change the title if it's already NAME. */
1681 if (EQ (name, f->title)) 1681 if (EQ (name, FVAR (f, title)))
1682 return; 1682 return;
1683 1683
1684 update_mode_lines = 1; 1684 update_mode_lines = 1;
1685 1685
1686 f->title = name; 1686 FVAR (f, title) = name;
1687 1687
1688 if (NILP (name)) 1688 if (NILP (name))
1689 name = f->name; 1689 name = FVAR (f, name);
1690 else 1690 else
1691 CHECK_STRING (name); 1691 CHECK_STRING (name);
1692 1692
@@ -2571,8 +2571,8 @@ x_window (struct frame *f, long window_prompting, int minibuffer_only)
2571 int explicit = f->explicit_name; 2571 int explicit = f->explicit_name;
2572 2572
2573 f->explicit_name = 0; 2573 f->explicit_name = 0;
2574 name = f->name; 2574 name = FVAR (f, name);
2575 f->name = Qnil; 2575 FVAR (f, name) = Qnil;
2576 x_set_name (f, name, explicit); 2576 x_set_name (f, name, explicit);
2577 } 2577 }
2578 2578
@@ -2714,8 +2714,8 @@ x_window (struct frame *f)
2714 int explicit = f->explicit_name; 2714 int explicit = f->explicit_name;
2715 2715
2716 f->explicit_name = 0; 2716 f->explicit_name = 0;
2717 name = f->name; 2717 name = FVAR (f, name);
2718 f->name = Qnil; 2718 FVAR (f, name) = Qnil;
2719 x_set_name (f, name, explicit); 2719 x_set_name (f, name, explicit);
2720 } 2720 }
2721 2721
@@ -2791,9 +2791,9 @@ x_icon (struct frame *f, Lisp_Object parms)
2791 : NormalState)); 2791 : NormalState));
2792#endif 2792#endif
2793 2793
2794 x_text_icon (f, SSDATA ((!NILP (f->icon_name) 2794 x_text_icon (f, SSDATA ((!NILP (FVAR (f, icon_name))
2795 ? f->icon_name 2795 ? FVAR (f, icon_name)
2796 : f->name))); 2796 : FVAR (f, name))));
2797 2797
2798 UNBLOCK_INPUT; 2798 UNBLOCK_INPUT;
2799} 2799}
@@ -3135,11 +3135,11 @@ This function is an internal primitive--use `make-frame' instead. */)
3135 f->output_data.x->scroll_bar_bottom_shadow_pixel = -1; 3135 f->output_data.x->scroll_bar_bottom_shadow_pixel = -1;
3136#endif /* USE_TOOLKIT_SCROLL_BARS */ 3136#endif /* USE_TOOLKIT_SCROLL_BARS */
3137 3137
3138 f->icon_name 3138 FVAR (f, icon_name)
3139 = x_get_arg (dpyinfo, parms, Qicon_name, "iconName", "Title", 3139 = x_get_arg (dpyinfo, parms, Qicon_name, "iconName", "Title",
3140 RES_TYPE_STRING); 3140 RES_TYPE_STRING);
3141 if (! STRINGP (f->icon_name)) 3141 if (! STRINGP (FVAR (f, icon_name)))
3142 f->icon_name = Qnil; 3142 FVAR (f, icon_name) = Qnil;
3143 3143
3144 FRAME_X_DISPLAY_INFO (f) = dpyinfo; 3144 FRAME_X_DISPLAY_INFO (f) = dpyinfo;
3145 3145
@@ -3196,12 +3196,12 @@ This function is an internal primitive--use `make-frame' instead. */)
3196 be set. */ 3196 be set. */
3197 if (EQ (name, Qunbound) || NILP (name)) 3197 if (EQ (name, Qunbound) || NILP (name))
3198 { 3198 {
3199 f->name = build_string (dpyinfo->x_id_name); 3199 FVAR (f, name) = build_string (dpyinfo->x_id_name);
3200 f->explicit_name = 0; 3200 f->explicit_name = 0;
3201 } 3201 }
3202 else 3202 else
3203 { 3203 {
3204 f->name = name; 3204 FVAR (f, name) = name;
3205 f->explicit_name = 1; 3205 f->explicit_name = 1;
3206 /* use the frame's title when getting resources for this frame. */ 3206 /* use the frame's title when getting resources for this frame. */
3207 specbind (Qx_resource_name, name); 3207 specbind (Qx_resource_name, name);
@@ -3340,7 +3340,7 @@ This function is an internal primitive--use `make-frame' instead. */)
3340 x_default_parameter (f, parms, Qfullscreen, Qnil, 3340 x_default_parameter (f, parms, Qfullscreen, Qnil,
3341 "fullscreen", "Fullscreen", RES_TYPE_SYMBOL); 3341 "fullscreen", "Fullscreen", RES_TYPE_SYMBOL);
3342 x_default_parameter (f, parms, Qtool_bar_position, 3342 x_default_parameter (f, parms, Qtool_bar_position,
3343 f->tool_bar_position, 0, 0, RES_TYPE_SYMBOL); 3343 FVAR (f, tool_bar_position), 0, 0, RES_TYPE_SYMBOL);
3344 3344
3345 /* Compute the size of the X window. */ 3345 /* Compute the size of the X window. */
3346 window_prompting = x_figure_window_size (f, parms, 1); 3346 window_prompting = x_figure_window_size (f, parms, 1);
@@ -3468,7 +3468,7 @@ This function is an internal primitive--use `make-frame' instead. */)
3468 by x_get_arg and friends, now go in the misc. alist of the frame. */ 3468 by x_get_arg and friends, now go in the misc. alist of the frame. */
3469 for (tem = parms; CONSP (tem); tem = XCDR (tem)) 3469 for (tem = parms; CONSP (tem); tem = XCDR (tem))
3470 if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem)))) 3470 if (CONSP (XCAR (tem)) && !NILP (XCAR (XCAR (tem))))
3471 f->param_alist = Fcons (XCAR (tem), f->param_alist); 3471 FVAR (f, param_alist) = Fcons (XCAR (tem), FVAR (f, param_alist));
3472 3472
3473 UNGCPRO; 3473 UNGCPRO;
3474 3474
@@ -4621,7 +4621,7 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
4621 f->output_data.x->scroll_bar_top_shadow_pixel = -1; 4621 f->output_data.x->scroll_bar_top_shadow_pixel = -1;
4622 f->output_data.x->scroll_bar_bottom_shadow_pixel = -1; 4622 f->output_data.x->scroll_bar_bottom_shadow_pixel = -1;
4623#endif /* USE_TOOLKIT_SCROLL_BARS */ 4623#endif /* USE_TOOLKIT_SCROLL_BARS */
4624 f->icon_name = Qnil; 4624 FVAR (f, icon_name) = Qnil;
4625 FRAME_X_DISPLAY_INFO (f) = dpyinfo; 4625 FRAME_X_DISPLAY_INFO (f) = dpyinfo;
4626 f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window; 4626 f->output_data.x->parent_desc = FRAME_X_DISPLAY_INFO (f)->root_window;
4627 f->output_data.x->explicit_parent = 0; 4627 f->output_data.x->explicit_parent = 0;
@@ -4663,12 +4663,12 @@ x_create_tip_frame (struct x_display_info *dpyinfo,
4663 be set. */ 4663 be set. */
4664 if (EQ (name, Qunbound) || NILP (name)) 4664 if (EQ (name, Qunbound) || NILP (name))
4665 { 4665 {
4666 f->name = build_string (dpyinfo->x_id_name); 4666 FVAR (f, name) = build_string (dpyinfo->x_id_name);
4667 f->explicit_name = 0; 4667 f->explicit_name = 0;
4668 } 4668 }
4669 else 4669 else
4670 { 4670 {
4671 f->name = name; 4671 FVAR (f, name) = name;
4672 f->explicit_name = 1; 4672 f->explicit_name = 1;
4673 /* use the frame's title when getting resources for this frame. */ 4673 /* use the frame's title when getting resources for this frame. */
4674 specbind (Qx_resource_name, name); 4674 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)
835 if (!f) 835 if (!f)
836 return; 836 return;
837 find_and_call_menu_selection (f, f->menu_bar_items_used, 837 find_and_call_menu_selection (f, f->menu_bar_items_used,
838 f->menu_bar_vector, client_data); 838 FVAR (f, menu_bar_vector), client_data);
839} 839}
840#endif /* not USE_GTK */ 840#endif /* not USE_GTK */
841 841
@@ -1014,14 +1014,14 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1014 1014
1015 /* Save the frame's previous menu bar contents data. */ 1015 /* Save the frame's previous menu bar contents data. */
1016 if (previous_menu_items_used) 1016 if (previous_menu_items_used)
1017 memcpy (previous_items, XVECTOR (f->menu_bar_vector)->contents, 1017 memcpy (previous_items, XVECTOR (FVAR (f, menu_bar_vector))->contents,
1018 previous_menu_items_used * sizeof (Lisp_Object)); 1018 previous_menu_items_used * sizeof (Lisp_Object));
1019 1019
1020 /* Fill in menu_items with the current menu bar contents. 1020 /* Fill in menu_items with the current menu bar contents.
1021 This can evaluate Lisp code. */ 1021 This can evaluate Lisp code. */
1022 save_menu_items (); 1022 save_menu_items ();
1023 1023
1024 menu_items = f->menu_bar_vector; 1024 menu_items = FVAR (f, menu_bar_vector);
1025 menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0; 1025 menu_items_allocated = VECTORP (menu_items) ? ASIZE (menu_items) : 0;
1026 subitems = ASIZE (items) / 4; 1026 subitems = ASIZE (items) / 4;
1027 submenu_start = alloca ((subitems + 1) * sizeof *submenu_start); 1027 submenu_start = alloca ((subitems + 1) * sizeof *submenu_start);
@@ -1100,7 +1100,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p)
1100 } 1100 }
1101 1101
1102 /* The menu items are different, so store them in the frame. */ 1102 /* The menu items are different, so store them in the frame. */
1103 f->menu_bar_vector = menu_items; 1103 FVAR (f, menu_bar_vector) = menu_items;
1104 f->menu_bar_items_used = menu_items_used; 1104 f->menu_bar_items_used = menu_items_used;
1105 1105
1106 /* This undoes save_menu_items. */ 1106 /* 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,
6357 mouse highlighting. */ 6357 mouse highlighting. */
6358 if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight) 6358 if (!hlinfo->mouse_face_hidden && INTEGERP (Vmouse_highlight)
6359 && (f == 0 6359 && (f == 0
6360 || !EQ (f->tool_bar_window, hlinfo->mouse_face_window))) 6360 || !EQ (FVAR (f, tool_bar_window), hlinfo->mouse_face_window)))
6361 { 6361 {
6362 clear_mouse_face (hlinfo); 6362 clear_mouse_face (hlinfo);
6363 hlinfo->mouse_face_hidden = 1; 6363 hlinfo->mouse_face_hidden = 1;
@@ -6904,15 +6904,15 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr,
6904 if (f) 6904 if (f)
6905 { 6905 {
6906 /* Is this in the tool-bar? */ 6906 /* Is this in the tool-bar? */
6907 if (WINDOWP (f->tool_bar_window) 6907 if (WINDOWP (FVAR (f, tool_bar_window))
6908 && WINDOW_TOTAL_LINES (XWINDOW (f->tool_bar_window))) 6908 && WINDOW_TOTAL_LINES (XWINDOW (FVAR (f, tool_bar_window))))
6909 { 6909 {
6910 Lisp_Object window; 6910 Lisp_Object window;
6911 int x = event.xbutton.x; 6911 int x = event.xbutton.x;
6912 int y = event.xbutton.y; 6912 int y = event.xbutton.y;
6913 6913
6914 window = window_from_coordinates (f, x, y, 0, 1); 6914 window = window_from_coordinates (f, x, y, 0, 1);
6915 tool_bar_p = EQ (window, f->tool_bar_window); 6915 tool_bar_p = EQ (window, FVAR (f, tool_bar_window));
6916 6916
6917 if (tool_bar_p && event.xbutton.button < 4) 6917 if (tool_bar_p && event.xbutton.button < 4)
6918 { 6918 {
@@ -7503,7 +7503,7 @@ x_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, int x, int
7503 } 7503 }
7504 7504
7505#ifdef HAVE_X_I18N 7505#ifdef HAVE_X_I18N
7506 if (w == XWINDOW (f->selected_window)) 7506 if (w == XWINDOW (FVAR (f, selected_window)))
7507 if (FRAME_XIC (f) && (FRAME_XIC_STYLE (f) & XIMPreeditPosition)) 7507 if (FRAME_XIC (f) && (FRAME_XIC_STYLE (f) & XIMPreeditPosition))
7508 xic_set_preeditarea (w, x, y); 7508 xic_set_preeditarea (w, x, y);
7509#endif 7509#endif
@@ -8154,7 +8154,7 @@ xim_instantiate_callback (Display *display, XPointer client_data, XPointer call_
8154 xic_set_statusarea (f); 8154 xic_set_statusarea (f);
8155 if (FRAME_XIC_STYLE (f) & XIMPreeditPosition) 8155 if (FRAME_XIC_STYLE (f) & XIMPreeditPosition)
8156 { 8156 {
8157 struct window *w = XWINDOW (f->selected_window); 8157 struct window *w = XWINDOW (FVAR (f, selected_window));
8158 xic_set_preeditarea (w, w->cursor.x, w->cursor.y); 8158 xic_set_preeditarea (w, w->cursor.x, w->cursor.y);
8159 } 8159 }
8160 } 8160 }
@@ -8942,7 +8942,7 @@ x_set_window_size (struct frame *f, int change_gravity, int cols, int rows)
8942#endif /* not USE_GTK */ 8942#endif /* not USE_GTK */
8943 8943
8944 /* If cursor was outside the new size, mark it as off. */ 8944 /* If cursor was outside the new size, mark it as off. */
8945 mark_window_cursors_off (XWINDOW (f->root_window)); 8945 mark_window_cursors_off (XWINDOW (FVAR (f, root_window)));
8946 8946
8947 /* Clear out any recollection of where the mouse highlighting was, 8947 /* Clear out any recollection of where the mouse highlighting was,
8948 since it might be in a place that's outside the new frame size. 8948 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)
10399 10399
10400 connection = ConnectionNumber (dpyinfo->display); 10400 connection = ConnectionNumber (dpyinfo->display);
10401 dpyinfo->connection = connection; 10401 dpyinfo->connection = connection;
10402 10402 dpyinfo->gray
10403 { 10403 = XCreatePixmapFromBitmapData (dpyinfo->display, dpyinfo->root_window,
10404 dpyinfo->gray 10404 gray_bits, gray_width, gray_height,
10405 = XCreatePixmapFromBitmapData (dpyinfo->display, dpyinfo->root_window, 10405 1, 0, 1);
10406 gray_bits, gray_width, gray_height,
10407 1, 0, 1);
10408 }
10409 10406
10410#ifdef HAVE_X_I18N 10407#ifdef HAVE_X_I18N
10411 xim_initialize (dpyinfo, resource_name); 10408 xim_initialize (dpyinfo, resource_name);