diff options
| author | Xue Fuqiao | 2013-09-04 08:39:34 +0800 |
|---|---|---|
| committer | Xue Fuqiao | 2013-09-04 08:39:34 +0800 |
| commit | adf2fc4a01efe77d73cd52bc9173914ed56ff531 (patch) | |
| tree | a5a280a5554a7bffeaf94fccae29fa3ac1a5d066 /src/window.h | |
| parent | 63191d9f2043d2e67657e85a7b3842805dd1dad6 (diff) | |
| parent | 38726039b77db432989fed106c88e9f1aa463281 (diff) | |
| download | emacs-adf2fc4a01efe77d73cd52bc9173914ed56ff531.tar.gz emacs-adf2fc4a01efe77d73cd52bc9173914ed56ff531.zip | |
Merge from mainline.
Diffstat (limited to 'src/window.h')
| -rw-r--r-- | src/window.h | 169 |
1 files changed, 79 insertions, 90 deletions
diff --git a/src/window.h b/src/window.h index 5da6165c48d..efe03737052 100644 --- a/src/window.h +++ b/src/window.h | |||
| @@ -141,32 +141,10 @@ struct window | |||
| 141 | it yet, or if the frame doesn't have any scroll bars, this is nil. */ | 141 | it yet, or if the frame doesn't have any scroll bars, this is nil. */ |
| 142 | Lisp_Object vertical_scroll_bar; | 142 | Lisp_Object vertical_scroll_bar; |
| 143 | 143 | ||
| 144 | /* Width of left and right marginal areas. A value of nil means | ||
| 145 | no margin. */ | ||
| 146 | Lisp_Object left_margin_cols; | ||
| 147 | Lisp_Object right_margin_cols; | ||
| 148 | |||
| 149 | /* Width of left and right fringes. | ||
| 150 | A value of nil or t means use frame values. */ | ||
| 151 | Lisp_Object left_fringe_width; | ||
| 152 | Lisp_Object right_fringe_width; | ||
| 153 | |||
| 154 | /* Pixel width of scroll bars. | ||
| 155 | A value of nil or t means use frame values. */ | ||
| 156 | Lisp_Object scroll_bar_width; | ||
| 157 | |||
| 158 | /* Type of vertical scroll bar. A value of nil means | 144 | /* Type of vertical scroll bar. A value of nil means |
| 159 | no scroll bar. A value of t means use frame value. */ | 145 | no scroll bar. A value of t means use frame value. */ |
| 160 | Lisp_Object vertical_scroll_bar_type; | 146 | Lisp_Object vertical_scroll_bar_type; |
| 161 | 147 | ||
| 162 | /* Z - the buffer position of the last glyph in the current | ||
| 163 | matrix of W. Only valid if window_end_valid is nonzero. */ | ||
| 164 | Lisp_Object window_end_pos; | ||
| 165 | |||
| 166 | /* Glyph matrix row of the last glyph in the current matrix | ||
| 167 | of W. Only valid if window_end_valid is nonzero. */ | ||
| 168 | Lisp_Object window_end_vpos; | ||
| 169 | |||
| 170 | /* Display-table to use for displaying chars in this window. | 148 | /* Display-table to use for displaying chars in this window. |
| 171 | Nil means use the buffer's own display-table. */ | 149 | Nil means use the buffer's own display-table. */ |
| 172 | Lisp_Object display_table; | 150 | Lisp_Object display_table; |
| @@ -251,10 +229,6 @@ struct window | |||
| 251 | as the normal may yield a matrix which is too small. */ | 229 | as the normal may yield a matrix which is too small. */ |
| 252 | int nrows_scale_factor, ncols_scale_factor; | 230 | int nrows_scale_factor, ncols_scale_factor; |
| 253 | 231 | ||
| 254 | /* Cursor position as of last update that completed without | ||
| 255 | pause. This is the position of last_point. */ | ||
| 256 | struct cursor_pos last_cursor; | ||
| 257 | |||
| 258 | /* Intended cursor position. This is a position within the | 232 | /* Intended cursor position. This is a position within the |
| 259 | glyph matrix. */ | 233 | glyph matrix. */ |
| 260 | struct cursor_pos cursor; | 234 | struct cursor_pos cursor; |
| @@ -262,6 +236,13 @@ struct window | |||
| 262 | /* Where the cursor actually is. */ | 236 | /* Where the cursor actually is. */ |
| 263 | struct cursor_pos phys_cursor; | 237 | struct cursor_pos phys_cursor; |
| 264 | 238 | ||
| 239 | /* Internally used for redisplay purposes. */ | ||
| 240 | struct cursor_pos output_cursor; | ||
| 241 | |||
| 242 | /* Vertical cursor position as of last update that completed | ||
| 243 | without pause. This is the position of last_point. */ | ||
| 244 | int last_cursor_vpos; | ||
| 245 | |||
| 265 | /* Cursor type and width of last cursor drawn on the window. | 246 | /* Cursor type and width of last cursor drawn on the window. |
| 266 | Used for X and w32 frames; -1 initially. */ | 247 | Used for X and w32 frames; -1 initially. */ |
| 267 | int phys_cursor_type, phys_cursor_width; | 248 | int phys_cursor_type, phys_cursor_width; |
| @@ -269,6 +250,28 @@ struct window | |||
| 269 | /* This is handy for undrawing the cursor. */ | 250 | /* This is handy for undrawing the cursor. */ |
| 270 | int phys_cursor_ascent, phys_cursor_height; | 251 | int phys_cursor_ascent, phys_cursor_height; |
| 271 | 252 | ||
| 253 | /* Width of left and right fringes, in pixels. | ||
| 254 | A value of -1 means use frame values. */ | ||
| 255 | int left_fringe_width; | ||
| 256 | int right_fringe_width; | ||
| 257 | |||
| 258 | /* Width of left and right marginal areas in columns. | ||
| 259 | A value of 0 means no margin. */ | ||
| 260 | int left_margin_cols; | ||
| 261 | int right_margin_cols; | ||
| 262 | |||
| 263 | /* Pixel width of scroll bars. | ||
| 264 | A value of -1 means use frame values. */ | ||
| 265 | int scroll_bar_width; | ||
| 266 | |||
| 267 | /* Z - the buffer position of the last glyph in the current | ||
| 268 | matrix of W. Only valid if window_end_valid is nonzero. */ | ||
| 269 | ptrdiff_t window_end_pos; | ||
| 270 | |||
| 271 | /* Glyph matrix row of the last glyph in the current matrix | ||
| 272 | of W. Only valid if window_end_valid is nonzero. */ | ||
| 273 | int window_end_vpos; | ||
| 274 | |||
| 272 | /* Non-zero if this window is a minibuffer window. */ | 275 | /* Non-zero if this window is a minibuffer window. */ |
| 273 | unsigned mini : 1; | 276 | unsigned mini : 1; |
| 274 | 277 | ||
| @@ -316,11 +319,6 @@ struct window | |||
| 316 | Currently only used for menu bar windows of frames. */ | 319 | Currently only used for menu bar windows of frames. */ |
| 317 | unsigned pseudo_window_p : 1; | 320 | unsigned pseudo_window_p : 1; |
| 318 | 321 | ||
| 319 | /* 1 means the window start of this window is frozen and may not | ||
| 320 | be changed during redisplay. If point is not in the window, | ||
| 321 | accept that. */ | ||
| 322 | unsigned frozen_window_start_p : 1; | ||
| 323 | |||
| 324 | /* Non-zero means fringes are drawn outside display margins. | 322 | /* Non-zero means fringes are drawn outside display margins. |
| 325 | Otherwise draw them between margin areas and text. */ | 323 | Otherwise draw them between margin areas and text. */ |
| 326 | unsigned fringes_outside_margins : 1; | 324 | unsigned fringes_outside_margins : 1; |
| @@ -371,16 +369,6 @@ wset_vertical_scroll_bar (struct window *w, Lisp_Object val) | |||
| 371 | w->vertical_scroll_bar = val; | 369 | w->vertical_scroll_bar = val; |
| 372 | } | 370 | } |
| 373 | WINDOW_INLINE void | 371 | WINDOW_INLINE void |
| 374 | wset_window_end_pos (struct window *w, Lisp_Object val) | ||
| 375 | { | ||
| 376 | w->window_end_pos = val; | ||
| 377 | } | ||
| 378 | WINDOW_INLINE void | ||
| 379 | wset_window_end_vpos (struct window *w, Lisp_Object val) | ||
| 380 | { | ||
| 381 | w->window_end_vpos = val; | ||
| 382 | } | ||
| 383 | WINDOW_INLINE void | ||
| 384 | wset_prev_buffers (struct window *w, Lisp_Object val) | 372 | wset_prev_buffers (struct window *w, Lisp_Object val) |
| 385 | { | 373 | { |
| 386 | w->prev_buffers = val; | 374 | w->prev_buffers = val; |
| @@ -605,33 +593,21 @@ wset_next_buffers (struct window *w, Lisp_Object val) | |||
| 605 | 593 | ||
| 606 | /* Width of left margin area in columns. */ | 594 | /* Width of left margin area in columns. */ |
| 607 | 595 | ||
| 608 | #define WINDOW_LEFT_MARGIN_COLS(W) \ | 596 | #define WINDOW_LEFT_MARGIN_COLS(W) (W->left_margin_cols) |
| 609 | (NILP (W->left_margin_cols) \ | ||
| 610 | ? 0 \ | ||
| 611 | : XINT (W->left_margin_cols)) | ||
| 612 | 597 | ||
| 613 | /* Width of right marginal area in columns. */ | 598 | /* Width of right marginal area in columns. */ |
| 614 | 599 | ||
| 615 | #define WINDOW_RIGHT_MARGIN_COLS(W) \ | 600 | #define WINDOW_RIGHT_MARGIN_COLS(W) (W->right_margin_cols) |
| 616 | (NILP (W->right_margin_cols) \ | ||
| 617 | ? 0 \ | ||
| 618 | : XINT (W->right_margin_cols)) | ||
| 619 | 601 | ||
| 620 | /* Width of left margin area in pixels. */ | 602 | /* Width of left margin area in pixels. */ |
| 621 | 603 | ||
| 622 | #define WINDOW_LEFT_MARGIN_WIDTH(W) \ | 604 | #define WINDOW_LEFT_MARGIN_WIDTH(W) \ |
| 623 | (NILP (W->left_margin_cols) \ | 605 | (W->left_margin_cols * WINDOW_FRAME_COLUMN_WIDTH (W)) |
| 624 | ? 0 \ | ||
| 625 | : (XINT (W->left_margin_cols) \ | ||
| 626 | * WINDOW_FRAME_COLUMN_WIDTH (W))) | ||
| 627 | 606 | ||
| 628 | /* Width of right marginal area in pixels. */ | 607 | /* Width of right marginal area in pixels. */ |
| 629 | 608 | ||
| 630 | #define WINDOW_RIGHT_MARGIN_WIDTH(W) \ | 609 | #define WINDOW_RIGHT_MARGIN_WIDTH(W) \ |
| 631 | (NILP (W->right_margin_cols) \ | 610 | (W->right_margin_cols * WINDOW_FRAME_COLUMN_WIDTH (W)) |
| 632 | ? 0 \ | ||
| 633 | : (XINT (W->right_margin_cols) \ | ||
| 634 | * WINDOW_FRAME_COLUMN_WIDTH (W))) | ||
| 635 | 611 | ||
| 636 | /* Total width of fringes reserved for drawing truncation bitmaps, | 612 | /* Total width of fringes reserved for drawing truncation bitmaps, |
| 637 | continuation bitmaps and alike. The width is in canonical char | 613 | continuation bitmaps and alike. The width is in canonical char |
| @@ -640,10 +616,10 @@ wset_next_buffers (struct window *w, Lisp_Object val) | |||
| 640 | able to split windows horizontally nicely. */ | 616 | able to split windows horizontally nicely. */ |
| 641 | 617 | ||
| 642 | #define WINDOW_FRINGE_COLS(W) \ | 618 | #define WINDOW_FRINGE_COLS(W) \ |
| 643 | ((INTEGERP (W->left_fringe_width) \ | 619 | ((W->left_fringe_width >= 0 \ |
| 644 | || INTEGERP (W->right_fringe_width)) \ | 620 | && W->right_fringe_width >= 0) \ |
| 645 | ? ((WINDOW_LEFT_FRINGE_WIDTH (W) \ | 621 | ? ((W->left_fringe_width \ |
| 646 | + WINDOW_RIGHT_FRINGE_WIDTH (W) \ | 622 | + W->right_fringe_width \ |
| 647 | + WINDOW_FRAME_COLUMN_WIDTH (W) - 1) \ | 623 | + WINDOW_FRAME_COLUMN_WIDTH (W) - 1) \ |
| 648 | / WINDOW_FRAME_COLUMN_WIDTH (W)) \ | 624 | / WINDOW_FRAME_COLUMN_WIDTH (W)) \ |
| 649 | : FRAME_FRINGE_COLS (WINDOW_XFRAME (W))) | 625 | : FRAME_FRINGE_COLS (WINDOW_XFRAME (W))) |
| @@ -663,13 +639,11 @@ wset_next_buffers (struct window *w, Lisp_Object val) | |||
| 663 | /* Pixel-width of the left and right fringe. */ | 639 | /* Pixel-width of the left and right fringe. */ |
| 664 | 640 | ||
| 665 | #define WINDOW_LEFT_FRINGE_WIDTH(W) \ | 641 | #define WINDOW_LEFT_FRINGE_WIDTH(W) \ |
| 666 | (INTEGERP (W->left_fringe_width) \ | 642 | (W->left_fringe_width >= 0 ? W->left_fringe_width \ |
| 667 | ? XFASTINT (W->left_fringe_width) \ | ||
| 668 | : FRAME_LEFT_FRINGE_WIDTH (WINDOW_XFRAME (W))) | 643 | : FRAME_LEFT_FRINGE_WIDTH (WINDOW_XFRAME (W))) |
| 669 | 644 | ||
| 670 | #define WINDOW_RIGHT_FRINGE_WIDTH(W) \ | 645 | #define WINDOW_RIGHT_FRINGE_WIDTH(W) \ |
| 671 | (INTEGERP (W->right_fringe_width) \ | 646 | (W->right_fringe_width >= 0 ? W->right_fringe_width \ |
| 672 | ? XFASTINT (W->right_fringe_width) \ | ||
| 673 | : FRAME_RIGHT_FRINGE_WIDTH (WINDOW_XFRAME (W))) | 647 | : FRAME_RIGHT_FRINGE_WIDTH (WINDOW_XFRAME (W))) |
| 674 | 648 | ||
| 675 | /* Total width of fringes in pixels. */ | 649 | /* Total width of fringes in pixels. */ |
| @@ -714,8 +688,7 @@ wset_next_buffers (struct window *w, Lisp_Object val) | |||
| 714 | nonzero. */ | 688 | nonzero. */ |
| 715 | 689 | ||
| 716 | #define WINDOW_CONFIG_SCROLL_BAR_WIDTH(w) \ | 690 | #define WINDOW_CONFIG_SCROLL_BAR_WIDTH(w) \ |
| 717 | (INTEGERP (w->scroll_bar_width) \ | 691 | (w->scroll_bar_width >= 0 ? w->scroll_bar_width \ |
| 718 | ? XFASTINT (w->scroll_bar_width) \ | ||
| 719 | : FRAME_CONFIG_SCROLL_BAR_WIDTH (WINDOW_XFRAME (w))) | 692 | : FRAME_CONFIG_SCROLL_BAR_WIDTH (WINDOW_XFRAME (w))) |
| 720 | 693 | ||
| 721 | /* Width that a scroll bar in window W should have, if there is one. | 694 | /* Width that a scroll bar in window W should have, if there is one. |
| @@ -723,8 +696,8 @@ wset_next_buffers (struct window *w, Lisp_Object val) | |||
| 723 | this is still nonzero. */ | 696 | this is still nonzero. */ |
| 724 | 697 | ||
| 725 | #define WINDOW_CONFIG_SCROLL_BAR_COLS(w) \ | 698 | #define WINDOW_CONFIG_SCROLL_BAR_COLS(w) \ |
| 726 | (INTEGERP (w->scroll_bar_width) \ | 699 | (w->scroll_bar_width >= 0 \ |
| 727 | ? ((XFASTINT (w->scroll_bar_width) \ | 700 | ? ((w->scroll_bar_width \ |
| 728 | + WINDOW_FRAME_COLUMN_WIDTH (w) - 1) \ | 701 | + WINDOW_FRAME_COLUMN_WIDTH (w) - 1) \ |
| 729 | / WINDOW_FRAME_COLUMN_WIDTH (w)) \ | 702 | / WINDOW_FRAME_COLUMN_WIDTH (w)) \ |
| 730 | : FRAME_CONFIG_SCROLL_BAR_COLS (WINDOW_XFRAME (w))) | 703 | : FRAME_CONFIG_SCROLL_BAR_COLS (WINDOW_XFRAME (w))) |
| @@ -847,13 +820,25 @@ wset_next_buffers (struct window *w, Lisp_Object val) | |||
| 847 | #define WINDOW_TEXT_TO_FRAME_PIXEL_X(W, X) \ | 820 | #define WINDOW_TEXT_TO_FRAME_PIXEL_X(W, X) \ |
| 848 | (window_box_left ((W), TEXT_AREA) + (X)) | 821 | (window_box_left ((W), TEXT_AREA) + (X)) |
| 849 | 822 | ||
| 850 | /* This is the window in which the terminal's cursor should | 823 | /* Nonzero if the background of the window W's fringe that is adjacent to |
| 851 | be left when nothing is being done with it. This must | 824 | a scroll bar is extended to the gap between the fringe and the bar. */ |
| 852 | always be a leaf window, and its buffer is selected by | 825 | |
| 853 | the top level editing loop at the end of each command. | 826 | #define WINDOW_FRINGE_EXTENDED_P(w) \ |
| 827 | (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) \ | ||
| 828 | ? (WINDOW_LEFTMOST_P (w) \ | ||
| 829 | && WINDOW_LEFT_FRINGE_WIDTH (w) \ | ||
| 830 | && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) \ | ||
| 831 | || WINDOW_LEFT_MARGIN_COLS (w) == 0)) \ | ||
| 832 | : (WINDOW_RIGHTMOST_P (w) \ | ||
| 833 | && WINDOW_RIGHT_FRINGE_WIDTH (w) \ | ||
| 834 | && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) \ | ||
| 835 | || WINDOW_RIGHT_MARGIN_COLS (w) == 0))) | ||
| 854 | 836 | ||
| 855 | This value is always the same as | 837 | /* This is the window in which the terminal's cursor should be left when |
| 856 | FRAME_SELECTED_WINDOW (selected_frame). */ | 838 | nothing is being done with it. This must always be a leaf window, and its |
| 839 | buffer is selected by the top level editing loop at the end of each command. | ||
| 840 | |||
| 841 | This value is always the same as FRAME_SELECTED_WINDOW (selected_frame). */ | ||
| 857 | 842 | ||
| 858 | extern Lisp_Object selected_window; | 843 | extern Lisp_Object selected_window; |
| 859 | 844 | ||
| @@ -874,21 +859,12 @@ extern Lisp_Object minibuf_window; | |||
| 874 | 859 | ||
| 875 | extern Lisp_Object minibuf_selected_window; | 860 | extern Lisp_Object minibuf_selected_window; |
| 876 | 861 | ||
| 877 | /* Window that the mouse is over (nil if no mouse support). */ | ||
| 878 | |||
| 879 | extern Lisp_Object Vmouse_window; | ||
| 880 | |||
| 881 | /* Last mouse-click event (nil if no mouse support). */ | ||
| 882 | |||
| 883 | extern Lisp_Object Vmouse_event; | ||
| 884 | |||
| 885 | extern Lisp_Object make_window (void); | 862 | extern Lisp_Object make_window (void); |
| 886 | extern Lisp_Object window_from_coordinates (struct frame *, int, int, | 863 | extern Lisp_Object window_from_coordinates (struct frame *, int, int, |
| 887 | enum window_part *, bool); | 864 | enum window_part *, bool); |
| 888 | extern void resize_frame_windows (struct frame *, int, bool); | 865 | extern void resize_frame_windows (struct frame *, int, bool); |
| 889 | extern void restore_window_configuration (Lisp_Object); | 866 | extern void restore_window_configuration (Lisp_Object); |
| 890 | extern void delete_all_child_windows (Lisp_Object); | 867 | extern void delete_all_child_windows (Lisp_Object); |
| 891 | extern void freeze_window_starts (struct frame *, bool); | ||
| 892 | extern void grow_mini_window (struct window *, int); | 868 | extern void grow_mini_window (struct window *, int); |
| 893 | extern void shrink_mini_window (struct window *); | 869 | extern void shrink_mini_window (struct window *); |
| 894 | extern int window_relative_x_coord (struct window *, enum window_part, int); | 870 | extern int window_relative_x_coord (struct window *, enum window_part, int); |
| @@ -925,10 +901,6 @@ extern int update_mode_lines; | |||
| 925 | 901 | ||
| 926 | extern int windows_or_buffers_changed; | 902 | extern int windows_or_buffers_changed; |
| 927 | 903 | ||
| 928 | /* Nonzero means a frame's cursor type has been changed. */ | ||
| 929 | |||
| 930 | extern int cursor_type_changed; | ||
| 931 | |||
| 932 | /* If *ROWS or *COLS are too small a size for FRAME, set them to the | 904 | /* If *ROWS or *COLS are too small a size for FRAME, set them to the |
| 933 | minimum allowable size. */ | 905 | minimum allowable size. */ |
| 934 | 906 | ||
| @@ -973,11 +945,28 @@ extern void replace_buffer_in_windows (Lisp_Object); | |||
| 973 | extern void replace_buffer_in_windows_safely (Lisp_Object); | 945 | extern void replace_buffer_in_windows_safely (Lisp_Object); |
| 974 | /* This looks like a setter, but it is a bit special. */ | 946 | /* This looks like a setter, but it is a bit special. */ |
| 975 | extern void wset_buffer (struct window *, Lisp_Object); | 947 | extern void wset_buffer (struct window *, Lisp_Object); |
| 948 | extern bool window_outdated (struct window *); | ||
| 976 | extern void init_window_once (void); | 949 | extern void init_window_once (void); |
| 977 | extern void init_window (void); | 950 | extern void init_window (void); |
| 978 | extern void syms_of_window (void); | 951 | extern void syms_of_window (void); |
| 979 | extern void keys_of_window (void); | 952 | extern void keys_of_window (void); |
| 980 | 953 | ||
| 954 | /* Move cursor to row/column position VPOS/HPOS, pixel coordinates | ||
| 955 | Y/X. HPOS/VPOS are window-relative row and column numbers and X/Y | ||
| 956 | are window-relative pixel positions. This is always done during | ||
| 957 | window update, so the position is the future output cursor position | ||
| 958 | for currently updated window W. */ | ||
| 959 | |||
| 960 | WINDOW_INLINE void | ||
| 961 | output_cursor_to (struct window *w, int vpos, int hpos, int y, int x) | ||
| 962 | { | ||
| 963 | eassert (w); | ||
| 964 | w->output_cursor.hpos = hpos; | ||
| 965 | w->output_cursor.vpos = vpos; | ||
| 966 | w->output_cursor.x = x; | ||
| 967 | w->output_cursor.y = y; | ||
| 968 | } | ||
| 969 | |||
| 981 | INLINE_HEADER_END | 970 | INLINE_HEADER_END |
| 982 | 971 | ||
| 983 | #endif /* not WINDOW_H_INCLUDED */ | 972 | #endif /* not WINDOW_H_INCLUDED */ |