aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.h
diff options
context:
space:
mode:
authorDmitry Antipov2012-08-06 14:24:26 +0400
committerDmitry Antipov2012-08-06 14:24:26 +0400
commit077288cf3f654776ee44bc9b56954c4e26b10d96 (patch)
tree00bbcb4dab9c879efde73a01786977b1c1364f67 /src/window.h
parent71688bd7f9169c12ea8be54e084470f19d44ce44 (diff)
downloademacs-077288cf3f654776ee44bc9b56954c4e26b10d96.tar.gz
emacs-077288cf3f654776ee44bc9b56954c4e26b10d96.zip
Separate read and write access to Lisp_Object slots of struct window.
* window.h (WGET, WSET): New macros similar to AREF and ASET. * alloc.c, buffer.c, composite.c, dispextern.h, dispnew.c, editfns.c: * fileio.c, font.c, fontset.c, frame.c, frame.h, fringe.c, indent.c: * insdel.c, keyboard.c, keymap.c, lisp.h, minibuf.c, msdos.c, nsfns.m: * nsmenu.m, nsterm.m, print.c, textprop.c, w32fns.c, w32menu.c: * w32term.c, window.c, xdisp.c, xfaces.c, xfns.c, xmenu.c, xterm.c: Adjust users.
Diffstat (limited to 'src/window.h')
-rw-r--r--src/window.h77
1 files changed, 41 insertions, 36 deletions
diff --git a/src/window.h b/src/window.h
index da42250befa..b6a37e2df9e 100644
--- a/src/window.h
+++ b/src/window.h
@@ -86,9 +86,15 @@ struct cursor_pos
86 int hpos, vpos; 86 int hpos, vpos;
87}; 87};
88 88
89/* Most code should use this macro to access Lisp fields in struct window. */ 89/* Most code should use these macros to access Lisp fields
90 in struct window. WGET should not be used as lvalue. */
90 91
91#define WVAR(w, field) ((w)->INTERNAL_FIELD (field)) 92#define WGET(f, field) \
93 (eassert (offsetof (struct window, field ## _) \
94 < offsetof (struct window, current_matrix)), \
95 ((f)->INTERNAL_FIELD (field)))
96
97#define WSET(w, field, value) ((w)->INTERNAL_FIELD (field) = (value))
92 98
93struct window 99struct window
94 { 100 {
@@ -396,13 +402,13 @@ struct window
396 This includes scroll bars and fringes. */ 402 This includes scroll bars and fringes. */
397 403
398#define WINDOW_TOTAL_COLS(W) \ 404#define WINDOW_TOTAL_COLS(W) \
399 (XFASTINT (WVAR (W, total_cols))) 405 (XFASTINT (WGET (W, total_cols)))
400 406
401/* Return the height of window W in canonical line units. 407/* Return the height of window W in canonical line units.
402 This includes header and mode lines, if any. */ 408 This includes header and mode lines, if any. */
403 409
404#define WINDOW_TOTAL_LINES(W) \ 410#define WINDOW_TOTAL_LINES(W) \
405 (XFASTINT (WVAR (W, total_lines))) 411 (XFASTINT (WGET (W, total_lines)))
406 412
407/* Return the total pixel width of window W. */ 413/* Return the total pixel width of window W. */
408 414
@@ -430,7 +436,7 @@ struct window
430 This includes a left-hand scroll bar, if any. */ 436 This includes a left-hand scroll bar, if any. */
431 437
432#define WINDOW_LEFT_EDGE_COL(W) \ 438#define WINDOW_LEFT_EDGE_COL(W) \
433 (XFASTINT (WVAR (W, left_col))) 439 (XFASTINT (WGET (W, left_col)))
434 440
435/* Return the canonical frame column before which window W ends. 441/* Return the canonical frame column before which window W ends.
436 This includes a right-hand scroll bar, if any. */ 442 This includes a right-hand scroll bar, if any. */
@@ -442,7 +448,7 @@ struct window
442 This includes a header line, if any. */ 448 This includes a header line, if any. */
443 449
444#define WINDOW_TOP_EDGE_LINE(W) \ 450#define WINDOW_TOP_EDGE_LINE(W) \
445 (XFASTINT (WVAR (W, top_line))) 451 (XFASTINT (WGET (W, top_line)))
446 452
447/* Return the canonical frame line before which window W ends. 453/* Return the canonical frame line before which window W ends.
448 This includes a mode line, if any. */ 454 This includes a mode line, if any. */
@@ -547,31 +553,31 @@ struct window
547/* Width of left margin area in columns. */ 553/* Width of left margin area in columns. */
548 554
549#define WINDOW_LEFT_MARGIN_COLS(W) \ 555#define WINDOW_LEFT_MARGIN_COLS(W) \
550 (NILP (WVAR (W, left_margin_cols)) \ 556 (NILP (WGET (W, left_margin_cols)) \
551 ? 0 \ 557 ? 0 \
552 : XINT (WVAR (W, left_margin_cols))) 558 : XINT (WGET (W, left_margin_cols)))
553 559
554/* Width of right marginal area in columns. */ 560/* Width of right marginal area in columns. */
555 561
556#define WINDOW_RIGHT_MARGIN_COLS(W) \ 562#define WINDOW_RIGHT_MARGIN_COLS(W) \
557 (NILP (WVAR (W, right_margin_cols)) \ 563 (NILP (WGET (W, right_margin_cols)) \
558 ? 0 \ 564 ? 0 \
559 : XINT (WVAR (W, right_margin_cols))) 565 : XINT (WGET (W, right_margin_cols)))
560 566
561/* Width of left margin area in pixels. */ 567/* Width of left margin area in pixels. */
562 568
563#define WINDOW_LEFT_MARGIN_WIDTH(W) \ 569#define WINDOW_LEFT_MARGIN_WIDTH(W) \
564 (NILP (WVAR (W, left_margin_cols)) \ 570 (NILP (WGET (W, left_margin_cols)) \
565 ? 0 \ 571 ? 0 \
566 : (XINT (WVAR (W, left_margin_cols)) \ 572 : (XINT (WGET (W, left_margin_cols)) \
567 * WINDOW_FRAME_COLUMN_WIDTH (W))) 573 * WINDOW_FRAME_COLUMN_WIDTH (W)))
568 574
569/* Width of right marginal area in pixels. */ 575/* Width of right marginal area in pixels. */
570 576
571#define WINDOW_RIGHT_MARGIN_WIDTH(W) \ 577#define WINDOW_RIGHT_MARGIN_WIDTH(W) \
572 (NILP (WVAR (W, right_margin_cols)) \ 578 (NILP (WGET (W, right_margin_cols)) \
573 ? 0 \ 579 ? 0 \
574 : (XINT (WVAR (W, right_margin_cols)) \ 580 : (XINT (WGET (W, right_margin_cols)) \
575 * WINDOW_FRAME_COLUMN_WIDTH (W))) 581 * WINDOW_FRAME_COLUMN_WIDTH (W)))
576 582
577/* Total width of fringes reserved for drawing truncation bitmaps, 583/* Total width of fringes reserved for drawing truncation bitmaps,
@@ -581,8 +587,8 @@ struct window
581 able to split windows horizontally nicely. */ 587 able to split windows horizontally nicely. */
582 588
583#define WINDOW_FRINGE_COLS(W) \ 589#define WINDOW_FRINGE_COLS(W) \
584 ((INTEGERP (WVAR (W, left_fringe_width)) \ 590 ((INTEGERP (WGET (W, left_fringe_width)) \
585 || INTEGERP (WVAR (W, right_fringe_width))) \ 591 || INTEGERP (WGET (W, right_fringe_width))) \
586 ? ((WINDOW_LEFT_FRINGE_WIDTH (W) \ 592 ? ((WINDOW_LEFT_FRINGE_WIDTH (W) \
587 + WINDOW_RIGHT_FRINGE_WIDTH (W) \ 593 + WINDOW_RIGHT_FRINGE_WIDTH (W) \
588 + WINDOW_FRAME_COLUMN_WIDTH (W) - 1) \ 594 + WINDOW_FRAME_COLUMN_WIDTH (W) - 1) \
@@ -604,13 +610,13 @@ struct window
604/* Pixel-width of the left and right fringe. */ 610/* Pixel-width of the left and right fringe. */
605 611
606#define WINDOW_LEFT_FRINGE_WIDTH(W) \ 612#define WINDOW_LEFT_FRINGE_WIDTH(W) \
607 (INTEGERP (WVAR (W, left_fringe_width)) \ 613 (INTEGERP (WGET (W, left_fringe_width)) \
608 ? XFASTINT (WVAR (W, left_fringe_width)) \ 614 ? XFASTINT (WGET (W, left_fringe_width)) \
609 : FRAME_LEFT_FRINGE_WIDTH (WINDOW_XFRAME (W))) 615 : FRAME_LEFT_FRINGE_WIDTH (WINDOW_XFRAME (W)))
610 616
611#define WINDOW_RIGHT_FRINGE_WIDTH(W) \ 617#define WINDOW_RIGHT_FRINGE_WIDTH(W) \
612 (INTEGERP (WVAR (W, right_fringe_width)) \ 618 (INTEGERP (WGET (W, right_fringe_width)) \
613 ? XFASTINT (WVAR (W, right_fringe_width)) \ 619 ? XFASTINT (WGET (W, right_fringe_width)) \
614 : FRAME_RIGHT_FRINGE_WIDTH (WINDOW_XFRAME (W))) 620 : FRAME_RIGHT_FRINGE_WIDTH (WINDOW_XFRAME (W)))
615 621
616/* Total width of fringes in pixels. */ 622/* Total width of fringes in pixels. */
@@ -627,36 +633,36 @@ struct window
627 and which side they are on. */ 633 and which side they are on. */
628 634
629#define WINDOW_VERTICAL_SCROLL_BAR_TYPE(w) \ 635#define WINDOW_VERTICAL_SCROLL_BAR_TYPE(w) \
630 (EQ (WVAR (w, vertical_scroll_bar_type), Qt) \ 636 (EQ (WGET (w, vertical_scroll_bar_type), Qt) \
631 ? FRAME_VERTICAL_SCROLL_BAR_TYPE (WINDOW_XFRAME (w)) \ 637 ? FRAME_VERTICAL_SCROLL_BAR_TYPE (WINDOW_XFRAME (w)) \
632 : EQ (WVAR (w, vertical_scroll_bar_type), Qleft) \ 638 : EQ (WGET (w, vertical_scroll_bar_type), Qleft) \
633 ? vertical_scroll_bar_left \ 639 ? vertical_scroll_bar_left \
634 : EQ (WVAR (w, vertical_scroll_bar_type), Qright) \ 640 : EQ (WGET (w, vertical_scroll_bar_type), Qright) \
635 ? vertical_scroll_bar_right \ 641 ? vertical_scroll_bar_right \
636 : vertical_scroll_bar_none) \ 642 : vertical_scroll_bar_none) \
637 643
638#define WINDOW_HAS_VERTICAL_SCROLL_BAR(w) \ 644#define WINDOW_HAS_VERTICAL_SCROLL_BAR(w) \
639 (EQ (WVAR (w, vertical_scroll_bar_type), Qt) \ 645 (EQ (WGET (w, vertical_scroll_bar_type), Qt) \
640 ? FRAME_HAS_VERTICAL_SCROLL_BARS (WINDOW_XFRAME (w)) \ 646 ? FRAME_HAS_VERTICAL_SCROLL_BARS (WINDOW_XFRAME (w)) \
641 : !NILP (WVAR (w, vertical_scroll_bar_type))) 647 : !NILP (WGET (w, vertical_scroll_bar_type)))
642 648
643#define WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT(w) \ 649#define WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT(w) \
644 (EQ (WVAR (w, vertical_scroll_bar_type), Qt) \ 650 (EQ (WGET (w, vertical_scroll_bar_type), Qt) \
645 ? FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (WINDOW_XFRAME (w)) \ 651 ? FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (WINDOW_XFRAME (w)) \
646 : EQ (WVAR (w, vertical_scroll_bar_type), Qleft)) 652 : EQ (WGET (w, vertical_scroll_bar_type), Qleft))
647 653
648#define WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT(w) \ 654#define WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT(w) \
649 (EQ (WVAR (w, vertical_scroll_bar_type), Qt) \ 655 (EQ (WGET (w, vertical_scroll_bar_type), Qt) \
650 ? FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (WINDOW_XFRAME (w))\ 656 ? FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (WINDOW_XFRAME (w))\
651 : EQ (WVAR (w, vertical_scroll_bar_type), Qright)) 657 : EQ (WGET (w, vertical_scroll_bar_type), Qright))
652 658
653/* Width that a scroll bar in window W should have, if there is one. 659/* Width that a scroll bar in window W should have, if there is one.
654 Measured in pixels. If scroll bars are turned off, this is still 660 Measured in pixels. If scroll bars are turned off, this is still
655 nonzero. */ 661 nonzero. */
656 662
657#define WINDOW_CONFIG_SCROLL_BAR_WIDTH(w) \ 663#define WINDOW_CONFIG_SCROLL_BAR_WIDTH(w) \
658 (INTEGERP (WVAR (w, scroll_bar_width)) \ 664 (INTEGERP (WGET (w, scroll_bar_width)) \
659 ? XFASTINT (WVAR (w, scroll_bar_width)) \ 665 ? XFASTINT (WGET (w, scroll_bar_width)) \
660 : FRAME_CONFIG_SCROLL_BAR_WIDTH (WINDOW_XFRAME (w))) 666 : FRAME_CONFIG_SCROLL_BAR_WIDTH (WINDOW_XFRAME (w)))
661 667
662/* Width that a scroll bar in window W should have, if there is one. 668/* Width that a scroll bar in window W should have, if there is one.
@@ -664,8 +670,8 @@ struct window
664 this is still nonzero. */ 670 this is still nonzero. */
665 671
666#define WINDOW_CONFIG_SCROLL_BAR_COLS(w) \ 672#define WINDOW_CONFIG_SCROLL_BAR_COLS(w) \
667 (INTEGERP (WVAR (w, scroll_bar_width)) \ 673 (INTEGERP (WGET (w, scroll_bar_width)) \
668 ? ((XFASTINT (WVAR (w, scroll_bar_width)) \ 674 ? ((XFASTINT (WGET (w, scroll_bar_width)) \
669 + WINDOW_FRAME_COLUMN_WIDTH (w) - 1) \ 675 + WINDOW_FRAME_COLUMN_WIDTH (w) - 1) \
670 / WINDOW_FRAME_COLUMN_WIDTH (w)) \ 676 / WINDOW_FRAME_COLUMN_WIDTH (w)) \
671 : FRAME_CONFIG_SCROLL_BAR_COLS (WINDOW_XFRAME (w))) 677 : FRAME_CONFIG_SCROLL_BAR_COLS (WINDOW_XFRAME (w)))
@@ -887,9 +893,8 @@ struct glyph *get_phys_cursor_glyph (struct window *w);
887 893
888/* Value is non-zero if WINDOW is a live window. */ 894/* Value is non-zero if WINDOW is a live window. */
889 895
890#define WINDOW_LIVE_P(WINDOW) \ 896#define WINDOW_LIVE_P(WINDOW) \
891 (WINDOWP ((WINDOW)) && !NILP (WVAR (XWINDOW ((WINDOW)), buffer))) 897 (WINDOWP (WINDOW) && !NILP (WGET (XWINDOW (WINDOW), buffer)))
892
893 898
894/* These used to be in lisp.h. */ 899/* These used to be in lisp.h. */
895 900