aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Rudalics2018-12-03 09:35:33 +0100
committerMartin Rudalics2018-12-03 09:35:33 +0100
commitc7897c27861fd8b2690f40e77402edced6aa0ceb (patch)
tree49e61c59e3ed37f6735320aed08db5c5a7d21a1f
parent745c9c02582443680167501b218cc59f1a2d3fb6 (diff)
downloademacs-c7897c27861fd8b2690f40e77402edced6aa0ceb.tar.gz
emacs-c7897c27861fd8b2690f40e77402edced6aa0ceb.zip
A few further fixes of window internals description
* doc/lispref/internals.texi (Window Internals): Add a few more items and clarify description of some others.
-rw-r--r--doc/lispref/internals.texi96
-rw-r--r--src/window.h142
2 files changed, 150 insertions, 88 deletions
diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi
index 6c9bba126e3..b95a15fec5d 100644
--- a/doc/lispref/internals.texi
+++ b/doc/lispref/internals.texi
@@ -2049,45 +2049,76 @@ if that window no longer displays this buffer.
2049The frame that this window is on, as a Lisp object. 2049The frame that this window is on, as a Lisp object.
2050 2050
2051@item mini 2051@item mini
2052Non-zero if this window is a minibuffer window. 2052Non-zero if this window is a minibuffer window, a window showing the
2053minibuffer or the echo area.
2054
2055@item pseudo_window_p
2056@cindex pseudo window
2057Non-zero if this window is a @dfn{pseudo window}. A pseudo window is
2058either a window used to display the menu bar or the tool bar (when
2059Emacs uses toolkits that don't display their own menu bar and tool
2060bar) or a window showing a tooltip on a tooltip frame. Pseudo windows
2061are in general not accessible from Lisp code.
2053 2062
2054@item parent 2063@item parent
2055Internally, Emacs arranges windows in a tree; each group of siblings has 2064Internally, Emacs arranges windows in a tree; each group of siblings
2056a parent window whose area includes all the siblings. This field points 2065has a parent window whose area includes all the siblings. This field
2057to a window's parent, as a Lisp object. 2066points to the window's parent in that tree, as a Lisp object. For the
2067root window of the tree and a minibuffer window this is always
2068@code{nil}.
2058 2069
2059Parent windows do not display buffers, and play little role in display 2070Parent windows do not display buffers, and play little role in display
2060except to shape their child windows. Emacs Lisp programs usually have 2071except to shape their child windows. Emacs Lisp programs cannot
2061no access to the parent windows; they operate on the windows at the 2072directly manipulate parent windows; they operate on the windows at the
2062leaves of the tree, which actually display buffers. 2073leaves of the tree, which actually display buffers.
2063 2074
2075@item contents
2076For a leaf window and windows showing a tooltip, this is the buffer,
2077as a Lisp object, that the window is displaying. For an internal
2078(``parent'') window, this is its first child window. For a pseudo
2079window showing a menu or tool bar this is @code{nil}. It is also
2080@code{nil} for a window that has been deleted.
2081
2064@item next 2082@item next
2065@itemx prev 2083@itemx prev
2066The next sibling and previous sibling of this window. @code{next} is 2084The next and previous sibling of this window as Lisp objects.
2067@code{nil} if the window is the right-most or bottom-most in its group; 2085@code{next} is @code{nil} if the window is the right-most or
2068@code{prev} is @code{nil} if it is the left-most or top-most in its 2086bottom-most in its group; @code{prev} is @code{nil} if it is the
2069group. Whether the sibling is left/right or up/down is determined by 2087left-most or top-most in its group. Whether the sibling is left/right
2070the @code{horizontal} field: if it's non-zero, the siblings are 2088or up/down is determined by the @code{horizontal} field of the
2071arranged horizontally. 2089sibling's parent: if it's non-zero, the siblings are arranged
2090horizontally.
2091
2092As a special case, @code{next} of a frame's root window points to the
2093frame's minibuffer window, provided this is not a minibuffer-only or
2094minibuffer-less frame. On such frames @code{prev} of the minibuffer
2095window points to that frame's root window. In any other case, the
2096root window's @code{next} and the minibuffer window's (if present)
2097@code{prev} fields are @code{nil}.
2072 2098
2073@item left_col 2099@item left_col
2074The left-hand edge of the window, measured in columns, relative to the 2100The left-hand edge of the window, measured in columns, relative to the
2075leftmost column in the frame (column 0). 2101leftmost column (column 0) of the window's native frame.
2076 2102
2077@item top_line 2103@item top_line
2078The top edge of the window, measured in lines, relative to the topmost 2104The top edge of the window, measured in lines, relative to the topmost
2079line in the frame (line 0). 2105line (line 0) of the window's native frame.
2106
2107@item pixel_left
2108@itemx pixel_top
2109The left-hand and top edges of this window, measured in pixels,
2110relative to the top-left corner (0, 0) of the window's native frame.
2080 2111
2081@item total_cols 2112@item total_cols
2082@itemx total_lines 2113@itemx total_lines
2083The width and height of the window, measured in columns and lines 2114The total width and height of the window, measured in columns and
2084respectively. The width includes the scroll bar and fringes, and/or 2115lines respectively. The values include scroll bars and fringes,
2085the separator line on the right of the window (if any). 2116dividers and/or the separator line on the right of the window (if
2117any).
2086 2118
2087@item contents 2119@item pixel_width;
2088For leaf windows, this is the buffer, as a Lisp object, that the 2120@itemx pixel_height;
2089window is displaying. For an internal (``parent'') window, this is 2121The total width and height of the window measured in pixels.
2090its child window. It can also be @code{nil}, for a pseudo-window.
2091 2122
2092@item start 2123@item start
2093A marker pointing to the position in the buffer that is the first 2124A marker pointing to the position in the buffer that is the first
@@ -2141,8 +2172,14 @@ in this window.
2141A non-zero value means the window's buffer was modified when the 2172A non-zero value means the window's buffer was modified when the
2142window was last updated. 2173window was last updated.
2143 2174
2144@item vertical_scroll_bar 2175@item vertical_scroll_bar_type
2145This window's vertical scroll bar, a Lisp object. 2176@itemx horizontal_scroll_bar_type
2177The types of this window's vertical and horizontal scroll bars.
2178
2179@item scroll_bar_width
2180@itemx scroll_bar_height
2181The width of this window's vertical scroll bar and the height of this
2182window's horizontal scroll bar, in pixels.
2146 2183
2147@item left_margin_cols 2184@item left_margin_cols
2148@itemx right_margin_cols 2185@itemx right_margin_cols
@@ -2226,6 +2263,14 @@ Vertical scroll amount, in pixels. Normally, this is 0.
2226@item dedicated 2263@item dedicated
2227Non-@code{nil} if this window is dedicated to its buffer. 2264Non-@code{nil} if this window is dedicated to its buffer.
2228 2265
2266@item combination_limit
2267This window's combination limit, meaningful only for a parent window.
2268If this is @code{t}, then it is not allowed to delete this window and
2269recombine its child windows with other siblings of this window.
2270
2271@item window_parameters
2272The alist of this window's parameters.
2273
2229@item display_table 2274@item display_table
2230The window's display table, or @code{nil} if none is specified for it. 2275The window's display table, or @code{nil} if none is specified for it.
2231 2276
@@ -2250,11 +2295,6 @@ the line number as long as the window shows that buffer.
2250The column number currently displayed in this window's mode line, or 2295The column number currently displayed in this window's mode line, or
2251@minus{}1 if column numbers are not being displayed. 2296@minus{}1 if column numbers are not being displayed.
2252 2297
2253@item pseudo_window_p
2254This is non-zero for windows that display the menu bar and the tool
2255bar (when Emacs uses toolkits that don't display their own menu bar
2256and tool bar).
2257
2258@item current_matrix 2298@item current_matrix
2259@itemx desired_matrix 2299@itemx desired_matrix
2260Glyph matrices describing the current and desired display of this window. 2300Glyph matrices describing the current and desired display of this window.
diff --git a/src/window.h b/src/window.h
index c7f525e2704..96e9a9f30ea 100644
--- a/src/window.h
+++ b/src/window.h
@@ -24,57 +24,69 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. */
24 24
25INLINE_HEADER_BEGIN 25INLINE_HEADER_BEGIN
26 26
27/* Windows are allocated as if they were vectors, but then the 27/* Windows are allocated as if they were vectors, but then the Lisp
28Lisp data type is changed to Lisp_Window. They are garbage 28data type is changed to Lisp_Window. They are garbage collected along
29collected along with the vectors. 29with the vectors.
30 30
31All windows in use are arranged into a tree, with pointers up and down. 31All windows in use are arranged into a tree, with pointers up and down.
32 32
33Windows that are leaves of the tree are actually displayed 33Windows that are leaves of the tree are actually displayed and show
34and show the contents of buffers. Windows that are not leaves 34the contents of buffers. Windows that are not leaves are used for
35are used for representing the way groups of leaf windows are 35representing the way groups of leaf windows are arranged on the frame.
36arranged on the frame. Leaf windows never become non-leaves. 36Leaf windows never become non-leaves. They are deleted only by
37They are deleted only by calling delete-window on them (but 37calling `delete-window' on them (but this can be done implicitly).
38this can be done implicitly). Combination windows can be created 38Non-leaf windows never become leaf windows and can be created and
39and deleted at any time. 39deleted at any time by the window management code. Non-leaf windows
40 40can be seen but not directly manipulated by Lisp functions.
41A leaf window has a buffer stored in contents field and markers in its start 41
42and pointm fields. Non-leaf windows have nil in the latter two fields. 42A leaf window has a buffer stored in its contents field and markers in
43 43its 'start' and 'pointm' fields. Non-leaf windows have nil in the
44Non-leaf windows are either vertical or horizontal combinations. 44latter two fields. Non-leaf windows are either vertical or horizontal
45 45combinations.
46A vertical combination window has children that are arranged on the frame 46
47one above the next. Its contents field points to the uppermost child. 47A vertical combination window has children that are arranged on the
48The parent field of each of the children points to the vertical 48frame one above the next. Its 'contents' field points to the
49combination window. The next field of each child points to the 49uppermost child. The 'parent' field of each of the children points to
50child below it, or is nil for the lowest child. The prev field 50the vertical combination window. The 'next' field of each child
51of each child points to the child above it, or is nil for the 51points to the child below it, or is nil for the lowest child. The
52highest child. 52'prev' field of each child points to the child above it, or is nil for
53 53the highest child.
54A horizontal combination window has children that are side by side. 54
55Its contents field points to the leftmost child. In each child 55A horizontal combination window has children that are arranged side by
56the next field points to the child to the right and the prev field 56side. Its 'contents' field points to the leftmost child. In each
57points to the child to the left. 57child the 'next' field points to the child to the right and the 'prev'
58 58field points to the child to the left.
59The children of a vertical combination window may be leaf windows 59
60or horizontal combination windows. The children of a horizontal 60On each frame there are at least one and at most two windows which
61combination window may be leaf windows or vertical combination windows. 61have nil as parent. The second of these, if present, is the frame's
62 62minibuffer window and shows the minibuffer or the echo area. The
63At the top of the tree are two windows which have nil as parent. 63first one manages the remaining frame area and is called the frame's
64The second of these is minibuf_window. The first one manages all 64root window. Different windows can be the root at different times;
65the frame area that is not minibuffer, and is called the root window. 65initially the root window is a leaf window, but if more windows are
66Different windows can be the root at different times; 66created, then that leaf window ceases to be root and a newly made
67initially the root window is a leaf window, but if more windows 67combination window becomes the root instead.
68are created then that leaf window ceases to be root and a newly 68
69made combination window becomes root instead. 69On frames which have an ordinary window and a minibuffer window,
70 70'prev' of the minibuffer window is the root window and 'next' of the
71In any case, on screens which have an ordinary window and a 71root window is the minibuffer window. On minibuffer-less frames there
72minibuffer, prev of the minibuf window is the root window and next of 72is only a root window and 'next' of the root window is nil. On
73the root window is the minibuf window. On minibufferless screens or 73minibuffer-only frames, the root window and the minibuffer window are
74minibuffer-only screens, the root window and the minibuffer window are 74one and the same, so its 'prev' and 'next' members are nil. In any
75one and the same, so its prev and next members are nil. 75case, 'prev' of a root window and 'next' of a minibuffer window are
76 76always nil.
77A dead window has its contents field set to nil. */ 77
78In Lisp parlance, leaf windows are called "live windows" and non-leaf
79windows are called "internal windows". Together, live and internal
80windows form the set of "valid windows". A window that has been
81deleted is considered "dead" regardless of whether it formerly was a
82leaf or a non-leaf window. A dead window has its 'contents' field set
83to nil.
84
85Frames may also contain pseudo windows, windows that are not exposed
86directly to Lisp code. Pseudo windows are currently either used to
87display the menu bar or the tool bar (when Emacs uses toolkits that
88don't display their own menu bar and tool bar) or a tooltip in a
89tooltip frame (when tooltips are not display by the toolkit). */
78 90
79struct cursor_pos 91struct cursor_pos
80{ 92{
@@ -95,29 +107,39 @@ struct window
95 107
96 /* Following (to right or down) and preceding (to left or up) 108 /* Following (to right or down) and preceding (to left or up)
97 child at same level of tree. Whether this is left/right or 109 child at same level of tree. Whether this is left/right or
98 up/down is determined by the 'horizontal' flag, see below. 110 up/down is determined by the parent window's 'horizontal' flag,
99 A minibuffer window has the frame's root window pointed by 'prev'. */ 111 see below. On a frame that is neither a minibuffer-only nor a
112 minibuffer-less frame, 'next' of the root window points to the
113 frame's minibuffer window and 'prev' of the minibuffer window
114 points to the frame's root window. In all other cases, 'next'
115 of the root window and 'prev' of the minibuffer window, if
116 present, are nil. 'prev' of the root window and 'next' of the
117 minibuffer window are always nil. */
100 Lisp_Object next; 118 Lisp_Object next;
101 Lisp_Object prev; 119 Lisp_Object prev;
102 120
103 /* The window this one is a child of. For a minibuffer window: nil. */ 121 /* The window this one is a child of. For the root and a
122 minibuffer window this is always nil. */
104 Lisp_Object parent; 123 Lisp_Object parent;
105 124
106 /* The normal size of the window. These are fractions, but we do 125 /* The "normal" size of the window. These are fractions, but we
107 not use C doubles to avoid creating new Lisp_Float objects while 126 do not use C doubles to avoid creating new Lisp_Float objects
108 interfacing Lisp in Fwindow_normal_size. */ 127 while interfacing Lisp in Fwindow_normal_size. */
109 Lisp_Object normal_lines; 128 Lisp_Object normal_lines;
110 Lisp_Object normal_cols; 129 Lisp_Object normal_cols;
111 130
112 /* New sizes of the window. Note that Lisp code may set new_normal 131 /* The new sizes of the window as proposed by the window resizing
113 to something beyond an integer, so C int can't be used here. */ 132 functions. Note that Lisp code may set new_normal to something
133 beyond an integer, so C int can't be used here. */
114 Lisp_Object new_total; 134 Lisp_Object new_total;
115 Lisp_Object new_normal; 135 Lisp_Object new_normal;
116 Lisp_Object new_pixel; 136 Lisp_Object new_pixel;
117 137
118 /* For a leaf window: a buffer; for an internal window: a window; 138 /* For a leaf window or a tooltip window this is the buffer shown
119 for a pseudo-window (such as menu bar or tool bar): nil. It is 139 in the window; for a combination window this is the first of
120 a buffer for a minibuffer window as well. */ 140 its child windows; for a pseudo window showing the menu bar or
141 tool bar this is nil. It is a buffer for a minibuffer window
142 as well. */
121 Lisp_Object contents; 143 Lisp_Object contents;
122 144
123 /* A marker pointing to where in the text to start displaying. 145 /* A marker pointing to where in the text to start displaying.
@@ -192,7 +214,7 @@ struct window
192 214
193 /* The two Lisp_Object fields below are marked in a special way, 215 /* The two Lisp_Object fields below are marked in a special way,
194 which is why they're placed after `current_matrix'. */ 216 which is why they're placed after `current_matrix'. */
195 /* Alist of <buffer, window-start, window-point> triples listing 217 /* A list of <buffer, window-start, window-point> triples listing
196 buffers previously shown in this window. */ 218 buffers previously shown in this window. */
197 Lisp_Object prev_buffers; 219 Lisp_Object prev_buffers;
198 /* List of buffers re-shown in this window. */ 220 /* List of buffers re-shown in this window. */