1 /* Window definitions for GNU Emacs.
2 Copyright (C) 1985, 1986, 1993, 1995, 1997, 1998, 1999, 2000, 2001,
3 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
4 Free Software Foundation, Inc.
6 This file is part of GNU Emacs.
8 GNU Emacs is free software: you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation, either version 3 of the License, or
11 (at your option) any later version.
13 GNU Emacs is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
21 #ifndef WINDOW_H_INCLUDED
22 #define WINDOW_H_INCLUDED
24 #include "dispextern.h"
26 extern Lisp_Object Qleft
, Qright
;
28 /* Windows are allocated as if they were vectors, but then the
29 Lisp data type is changed to Lisp_Window. They are garbage
30 collected along with the vectors.
32 All windows in use are arranged into a tree, with pointers up and down.
34 Windows that are leaves of the tree are actually displayed
35 and show the contents of buffers. Windows that are not leaves
36 are used for representing the way groups of leaf windows are
37 arranged on the frame. Leaf windows never become non-leaves.
38 They are deleted only by calling delete-window on them (but
39 this can be done implicitly). Combination windows can be created
40 and deleted at any time.
42 A leaf window has a non-nil buffer field, and also
43 has markers in its start and pointm fields. Non-leaf windows
44 have nil in these fields.
46 Non-leaf windows are either vertical or horizontal combinations.
48 A vertical combination window has children that are arranged on the frame
49 one above the next. Its vchild field points to the uppermost child.
50 The parent field of each of the children points to the vertical
51 combination window. The next field of each child points to the
52 child below it, or is nil for the lowest child. The prev field
53 of each child points to the child above it, or is nil for the
56 A horizontal combination window has children that are side by side.
57 Its hchild field points to the leftmost child. In each child
58 the next field points to the child to the right and the prev field
59 points to the child to the left.
61 The children of a vertical combination window may be leaf windows
62 or horizontal combination windows. The children of a horizontal
63 combination window may be leaf windows or vertical combination windows.
65 At the top of the tree are two windows which have nil as parent.
66 The second of these is minibuf_window. The first one manages all
67 the frame area that is not minibuffer, and is called the root window.
68 Different windows can be the root at different times;
69 initially the root window is a leaf window, but if more windows
70 are created then that leaf window ceases to be root and a newly
71 made combination window becomes root instead.
73 In any case, on screens which have an ordinary window and a
74 minibuffer, prev of the minibuf window is the root window and next of
75 the root window is the minibuf window. On minibufferless screens or
76 minibuffer-only screens, the root window and the minibuffer window are
77 one and the same, so its prev and next members are nil.
79 A dead window has its buffer, hchild, and vchild windows all nil. */
83 /* Pixel position. These are always window relative. */
86 /* Glyph matrix position. */
92 /* The first two fields are really the header of a vector */
93 /* The window code does not refer to them. */
95 struct Lisp_Vector
*vec_next
;
97 /* The frame this window is on. */
100 /* t if this window is a minibuffer window. */
103 /* Following (to right or down) and preceding (to left or up) child
104 at same level of tree. */
105 Lisp_Object next
, prev
;
107 /* First child of this window: vchild is used if this is a vertical
108 combination, hchild if this is a horizontal combination. Of the
109 fields vchild, hchild and buffer, one and only one is non-nil
110 unless the window is dead. */
111 Lisp_Object hchild
, vchild
;
113 /* The window this one is a child of. */
116 /* The upper left corner coordinates of this window, as integers
117 relative to upper left corner of frame = 0, 0. */
118 Lisp_Object left_col
;
119 Lisp_Object top_line
;
121 /* The size of the window. */
122 Lisp_Object total_lines
;
123 Lisp_Object total_cols
;
125 /* The normal size of the window. */
126 Lisp_Object normal_lines
;
127 Lisp_Object normal_cols
;
129 /* New sizes of the window. */
130 Lisp_Object new_total
;
131 Lisp_Object new_normal
;
133 /* The buffer displayed in this window. Of the fields vchild,
134 hchild and buffer, one and only one is non-nil unless the window
138 /* A marker pointing to where in the text to start displaying.
139 BIDI Note: This is the _logical-order_ start, i.e. the smallest
140 buffer position visible in the window, not necessarily the
141 character displayed in the top left corner of the window. */
144 /* A marker pointing to where in the text point is in this window,
145 used only when the window is not selected.
146 This exists so that when multiple windows show one buffer
147 each one can have its own value of point. */
150 /* Non-nil means next redisplay must use the value of start
151 set up for it in advance. Set by scrolling commands. */
152 Lisp_Object force_start
;
153 /* Non-nil means we have explicitly changed the value of start,
154 but that the next redisplay is not obliged to use the new value.
155 This is used in Fdelete_other_windows to force a call to
156 Vwindow_scroll_functions; also by Frecenter with argument. */
157 Lisp_Object optional_new_start
;
159 /* Number of columns display within the window is scrolled to the left. */
161 /* Minimum hscroll for automatic hscrolling. This is the value
162 the user has set, by set-window-hscroll for example. */
163 Lisp_Object min_hscroll
;
165 /* Number saying how recently window was selected */
166 Lisp_Object use_time
;
168 /* Unique number of window assigned when it was created */
169 Lisp_Object sequence_number
;
171 /* No permanent meaning; used by save-window-excursion's bookkeeping */
174 /* text.modified of displayed buffer as of last time display completed */
175 Lisp_Object last_modified
;
176 /* BUF_OVERLAY_MODIFIED of displayed buffer as of last complete update. */
177 Lisp_Object last_overlay_modified
;
178 /* Value of point at that time */
179 Lisp_Object last_point
;
180 /* Non-nil if the buffer was "modified" when the window
182 Lisp_Object last_had_star
;
184 /* This window's vertical scroll bar. This field is only for use
185 by the window-system-dependent code which implements the
186 scroll bars; it can store anything it likes here. If this
187 window is newly created and we haven't displayed a scroll bar in
188 it yet, or if the frame doesn't have any scroll bars, this is nil. */
189 Lisp_Object vertical_scroll_bar
;
191 /* Width of left and right marginal areas. A value of nil means
193 Lisp_Object left_margin_cols
, right_margin_cols
;
195 /* Width of left and right fringes.
196 A value of nil or t means use frame values. */
197 Lisp_Object left_fringe_width
, right_fringe_width
;
198 /* Non-nil means fringes are drawn outside display margins;
199 othersize draw them between margin areas and text. */
200 Lisp_Object fringes_outside_margins
;
202 /* Pixel width of scroll bars.
203 A value of nil or t means use frame values. */
204 Lisp_Object scroll_bar_width
;
206 /* Type of vertical scroll bar. A value of nil means
207 no scroll bar. A value of t means use frame value. */
208 Lisp_Object vertical_scroll_bar_type
;
210 /* Frame coords of mark as of last time display completed */
211 /* May be nil if mark does not exist or was not on frame */
212 Lisp_Object last_mark_x
;
213 Lisp_Object last_mark_y
;
215 /* Z - the buffer position of the last glyph in the current matrix
216 of W. Only valid if WINDOW_END_VALID is not nil. */
217 Lisp_Object window_end_pos
;
218 /* Glyph matrix row of the last glyph in the current matrix
219 of W. Only valid if WINDOW_END_VALID is not nil. */
220 Lisp_Object window_end_vpos
;
221 /* t if window_end_pos is truly valid.
222 This is nil if nontrivial redisplay is preempted
223 since in that case the frame image that window_end_pos
224 did not get onto the frame. */
225 Lisp_Object window_end_valid
;
227 /* Non-nil means must regenerate mode line of this window */
228 Lisp_Object update_mode_line
;
230 /* Non-nil means current value of `start'
231 was the beginning of a line when it was chosen. */
232 Lisp_Object start_at_line_beg
;
234 /* Display-table to use for displaying chars in this window.
235 Nil means use the buffer's own display-table. */
236 Lisp_Object display_table
;
238 /* Non-nil means window is marked as dedicated. */
239 Lisp_Object dedicated
;
241 /* Line number and position of a line somewhere above the top of the
242 screen. If this field is nil, it means we don't have a base
244 Lisp_Object base_line_number
;
245 /* If this field is nil, it means we don't have a base line.
246 If it is a buffer, it means don't display the line number
247 as long as the window shows that buffer. */
248 Lisp_Object base_line_pos
;
250 /* If we have highlighted the region (or any part of it),
251 this is the mark position that we used, as an integer. */
252 Lisp_Object region_showing
;
254 /* The column number currently displayed in this window's mode line,
255 or nil if column numbers are not being displayed. */
256 Lisp_Object column_number_displayed
;
258 /* If redisplay in this window goes beyond this buffer position,
259 must run the redisplay-end-trigger-hook. */
260 Lisp_Object redisplay_end_trigger
;
262 /* Non-nil means window must not be recombined. */
263 Lisp_Object inhibit_recombine
;
265 /* An alist with parameteres. */
266 Lisp_Object window_parameters
;
268 /* No Lisp data may follow below this point without changing
269 mark_object in alloc.c. The member current_matrix must be the
270 first non-Lisp member. */
272 /* Glyph matrices. */
273 struct glyph_matrix
*current_matrix
;
274 struct glyph_matrix
*desired_matrix
;
276 /* Scaling factor for the glyph_matrix size calculation in this window.
277 Used if window contains many small images or uses proportional fonts,
278 as the normal may yield a matrix which is too small. */
279 int nrows_scale_factor
, ncols_scale_factor
;
281 /* Cursor position as of last update that completed without
282 pause. This is the position of last_point. */
283 struct cursor_pos last_cursor
;
285 /* Intended cursor position. This is a position within the
287 struct cursor_pos cursor
;
289 /* Where the cursor actually is. */
290 struct cursor_pos phys_cursor
;
292 /* Cursor type and width of last cursor drawn on the window.
293 Used for X and w32 frames; -1 initially. */
294 int phys_cursor_type
, phys_cursor_width
;
296 /* This is handy for undrawing the cursor. */
297 int phys_cursor_ascent
, phys_cursor_height
;
299 /* Non-zero means the cursor is currently displayed. This can be
300 set to zero by functions overpainting the cursor image. */
301 unsigned phys_cursor_on_p
: 1;
303 /* 0 means cursor is logically on, 1 means it's off. Used for
305 unsigned cursor_off_p
: 1;
307 /* Value of cursor_off_p as of the last redisplay. */
308 unsigned last_cursor_off_p
: 1;
310 /* 1 means desired matrix has been build and window must be
311 updated in update_frame. */
312 unsigned must_be_updated_p
: 1;
314 /* Flag indicating that this window is not a real one.
315 Currently only used for menu bar windows of frames. */
316 unsigned pseudo_window_p
: 1;
318 /* 1 means the window start of this window is frozen and may not
319 be changed during redisplay. If point is not in the window,
321 unsigned frozen_window_start_p
: 1;
323 /* Amount by which lines of this window are scrolled in
324 y-direction (smooth scrolling). */
327 /* Z_BYTE - the buffer position of the last glyph in the current matrix
328 of W. Only valid if WINDOW_END_VALID is not nil. */
329 int window_end_bytepos
;
332 /* 1 if W is a minibuffer window. */
334 #define MINI_WINDOW_P(W) (!NILP ((W)->mini_p))
336 /* General window layout:
338 LEFT_EDGE_COL RIGHT_EDGE_COL
341 | BOX_LEFT_EDGE_COL |
342 | | BOX_RIGHT_EDGE_COL |
345 <-><-><---><-----------><---><-><->
348 | | | | | | +-- RIGHT_SCROLL_BAR_COLS
349 | | | | | +----- RIGHT_FRINGE_WIDTH
350 | | | | +--------- RIGHT_MARGIN_COLS
352 | | | +------------------ TEXT_AREA_COLS
354 | | +--------------------------- LEFT_MARGIN_COLS
355 | +------------------------------- LEFT_FRINGE_WIDTH
356 +---------------------------------- LEFT_SCROLL_BAR_COLS
363 #define WINDOW_XFRAME(W) \
364 (XFRAME (WINDOW_FRAME ((W))))
366 /* Return the canonical column width of the frame of window W. */
368 #define WINDOW_FRAME_COLUMN_WIDTH(W) \
369 (FRAME_COLUMN_WIDTH (WINDOW_XFRAME ((W))))
371 /* Return the canonical column width of the frame of window W. */
373 #define WINDOW_FRAME_LINE_HEIGHT(W) \
374 (FRAME_LINE_HEIGHT (WINDOW_XFRAME ((W))))
376 /* Return the width of window W in canonical column units.
377 This includes scroll bars and fringes. */
379 #define WINDOW_TOTAL_COLS(W) \
380 (XFASTINT ((W)->total_cols))
382 /* Return the height of window W in canonical line units.
383 This includes header and mode lines, if any. */
385 #define WINDOW_TOTAL_LINES(W) \
386 (XFASTINT ((W)->total_lines))
388 /* Return the total pixel width of window W. */
390 #define WINDOW_TOTAL_WIDTH(W) \
391 (WINDOW_TOTAL_COLS (W) * WINDOW_FRAME_COLUMN_WIDTH (W))
393 /* Return the total pixel height of window W. */
395 #define WINDOW_TOTAL_HEIGHT(W) \
396 (WINDOW_TOTAL_LINES (W) * WINDOW_FRAME_LINE_HEIGHT (W))
398 /* For HORFLAG non-zero the total number of columns of window W. Otherwise
399 the total number of lines of W. */
401 #define WINDOW_TOTAL_SIZE(w, horflag) \
402 (horflag ? WINDOW_TOTAL_COLS (w) : WINDOW_TOTAL_LINES (w))
404 /* The smallest acceptable dimensions for a window. Anything smaller
405 might crash Emacs. */
407 #define MIN_SAFE_WINDOW_WIDTH (2)
408 #define MIN_SAFE_WINDOW_HEIGHT (1)
410 /* Return the canonical frame column at which window W starts.
411 This includes a left-hand scroll bar, if any. */
413 #define WINDOW_LEFT_EDGE_COL(W) \
414 (XFASTINT ((W)->left_col))
416 /* Return the canonical frame column before which window W ends.
417 This includes a right-hand scroll bar, if any. */
419 #define WINDOW_RIGHT_EDGE_COL(W) \
420 (WINDOW_LEFT_EDGE_COL (W) + WINDOW_TOTAL_COLS (W))
422 /* Return the canonical frame line at which window W starts.
423 This includes a header line, if any. */
425 #define WINDOW_TOP_EDGE_LINE(W) \
426 (XFASTINT ((W)->top_line))
428 /* Return the canonical frame line before which window W ends.
429 This includes a mode line, if any. */
431 #define WINDOW_BOTTOM_EDGE_LINE(W) \
432 (WINDOW_TOP_EDGE_LINE (W) + WINDOW_TOTAL_LINES (W))
435 /* Return the frame x-position at which window W starts.
436 This includes a left-hand scroll bar, if any. */
438 #define WINDOW_LEFT_EDGE_X(W) \
439 (FRAME_INTERNAL_BORDER_WIDTH (WINDOW_XFRAME (W)) \
440 + WINDOW_LEFT_EDGE_COL (W) * WINDOW_FRAME_COLUMN_WIDTH (W))
442 /* Return the frame x- position before which window W ends.
443 This includes a right-hand scroll bar, if any. */
445 #define WINDOW_RIGHT_EDGE_X(W) \
446 (FRAME_INTERNAL_BORDER_WIDTH (WINDOW_XFRAME (W)) \
447 + WINDOW_RIGHT_EDGE_COL (W) * WINDOW_FRAME_COLUMN_WIDTH (W))
449 /* 1 if W is a menu bar window. */
451 #define WINDOW_MENU_BAR_P(W) \
452 (WINDOWP (WINDOW_XFRAME (W)->menu_bar_window) \
453 && (W) == XWINDOW (WINDOW_XFRAME (W)->menu_bar_window))
455 /* 1 if W is a tool bar window. */
457 #define WINDOW_TOOL_BAR_P(W) \
458 (WINDOWP (WINDOW_XFRAME (W)->tool_bar_window) \
459 && (W) == XWINDOW (WINDOW_XFRAME (W)->tool_bar_window))
461 /* Return the frame y-position at which window W starts.
462 This includes a header line, if any. */
464 #define WINDOW_TOP_EDGE_Y(W) \
465 (((WINDOW_MENU_BAR_P (W) || WINDOW_TOOL_BAR_P (W)) \
466 ? 0 : FRAME_INTERNAL_BORDER_WIDTH (WINDOW_XFRAME (W))) \
467 + WINDOW_TOP_EDGE_LINE (W) * WINDOW_FRAME_LINE_HEIGHT (W))
469 /* Return the frame y-position before which window W ends.
470 This includes a mode line, if any. */
472 #define WINDOW_BOTTOM_EDGE_Y(W) \
473 (((WINDOW_MENU_BAR_P (W) || WINDOW_TOOL_BAR_P (W)) \
474 ? 0 : FRAME_INTERNAL_BORDER_WIDTH (WINDOW_XFRAME (W))) \
475 + WINDOW_BOTTOM_EDGE_LINE (W) * WINDOW_FRAME_LINE_HEIGHT (W))
478 /* 1 if window W takes up the full width of its frame. */
480 #define WINDOW_FULL_WIDTH_P(W) \
481 (WINDOW_TOTAL_COLS (W) == FRAME_TOTAL_COLS (WINDOW_XFRAME (W)))
483 /* 1 if window W's has no other windows to its left in its frame. */
485 #define WINDOW_LEFTMOST_P(W) \
486 (WINDOW_LEFT_EDGE_COL (W) == 0)
488 /* 1 if window W's has no other windows to its right in its frame. */
490 #define WINDOW_RIGHTMOST_P(W) \
491 (WINDOW_RIGHT_EDGE_COL (W) == FRAME_TOTAL_COLS (WINDOW_XFRAME (W)))
494 /* Return the frame column at which the text (or left fringe) in
495 window W starts. This is different from the `LEFT_EDGE' because it
496 does not include a left-hand scroll bar if any. */
498 #define WINDOW_BOX_LEFT_EDGE_COL(W) \
499 (WINDOW_LEFT_EDGE_COL (W) \
500 + WINDOW_LEFT_SCROLL_BAR_COLS (W))
502 /* Return the window column before which the text in window W ends.
503 This is different from WINDOW_RIGHT_EDGE_COL because it does not
504 include a scroll bar or window-separating line on the right edge. */
506 #define WINDOW_BOX_RIGHT_EDGE_COL(W) \
507 (WINDOW_RIGHT_EDGE_COL (W) \
508 - WINDOW_RIGHT_SCROLL_BAR_COLS (W))
511 /* Return the frame position at which the text (or left fringe) in
512 window W starts. This is different from the `LEFT_EDGE' because it
513 does not include a left-hand scroll bar if any. */
515 #define WINDOW_BOX_LEFT_EDGE_X(W) \
516 (FRAME_INTERNAL_BORDER_WIDTH (WINDOW_XFRAME (W)) \
517 + WINDOW_BOX_LEFT_EDGE_COL (W) * WINDOW_FRAME_COLUMN_WIDTH (W))
519 /* Return the window column before which the text in window W ends.
520 This is different from WINDOW_RIGHT_EDGE_COL because it does not
521 include a scroll bar or window-separating line on the right edge. */
523 #define WINDOW_BOX_RIGHT_EDGE_X(W) \
524 (FRAME_INTERNAL_BORDER_WIDTH (WINDOW_XFRAME (W)) \
525 + WINDOW_BOX_RIGHT_EDGE_COL (W) * WINDOW_FRAME_COLUMN_WIDTH (W))
528 /* Width of left margin area in columns. */
530 #define WINDOW_LEFT_MARGIN_COLS(W) \
531 (NILP ((W)->left_margin_cols) \
533 : XINT ((W)->left_margin_cols))
535 /* Width of right marginal area in columns. */
537 #define WINDOW_RIGHT_MARGIN_COLS(W) \
538 (NILP ((W)->right_margin_cols) \
540 : XINT ((W)->right_margin_cols))
542 /* Width of left margin area in pixels. */
544 #define WINDOW_LEFT_MARGIN_WIDTH(W) \
545 (NILP ((W)->left_margin_cols) \
547 : (XINT ((W)->left_margin_cols) \
548 * WINDOW_FRAME_COLUMN_WIDTH (W)))
550 /* Width of right marginal area in pixels. */
552 #define WINDOW_RIGHT_MARGIN_WIDTH(W) \
553 (NILP ((W)->right_margin_cols) \
555 : (XINT ((W)->right_margin_cols) \
556 * WINDOW_FRAME_COLUMN_WIDTH (W)))
558 /* Total width of fringes reserved for drawing truncation bitmaps,
559 continuation bitmaps and alike. The width is in canonical char
560 units of the frame. This must currently be the case because window
561 sizes aren't pixel values. If it weren't the case, we wouldn't be
562 able to split windows horizontally nicely. */
564 #define WINDOW_FRINGE_COLS(W) \
565 ((INTEGERP ((W)->left_fringe_width) \
566 || INTEGERP ((W)->right_fringe_width)) \
567 ? ((WINDOW_LEFT_FRINGE_WIDTH (W) \
568 + WINDOW_RIGHT_FRINGE_WIDTH (W) \
569 + WINDOW_FRAME_COLUMN_WIDTH (W) - 1) \
570 / WINDOW_FRAME_COLUMN_WIDTH (W)) \
571 : FRAME_FRINGE_COLS (WINDOW_XFRAME (W)))
573 /* Column-width of the left and right fringe. */
575 #define WINDOW_LEFT_FRINGE_COLS(W) \
576 ((WINDOW_LEFT_FRINGE_WIDTH ((W)) \
577 + WINDOW_FRAME_COLUMN_WIDTH (W) - 1) \
578 / WINDOW_FRAME_COLUMN_WIDTH (W))
580 #define WINDOW_RIGHT_FRINGE_COLS(W) \
581 ((WINDOW_RIGHT_FRINGE_WIDTH ((W)) \
582 + WINDOW_FRAME_COLUMN_WIDTH (W) - 1) \
583 / WINDOW_FRAME_COLUMN_WIDTH (W))
585 /* Pixel-width of the left and right fringe. */
587 #define WINDOW_LEFT_FRINGE_WIDTH(W) \
588 (INTEGERP ((W)->left_fringe_width) \
589 ? XFASTINT ((W)->left_fringe_width) \
590 : FRAME_LEFT_FRINGE_WIDTH (WINDOW_XFRAME (W)))
592 #define WINDOW_RIGHT_FRINGE_WIDTH(W) \
593 (INTEGERP ((W)->right_fringe_width) \
594 ? XFASTINT ((W)->right_fringe_width) \
595 : FRAME_RIGHT_FRINGE_WIDTH (WINDOW_XFRAME (W)))
597 /* Total width of fringes in pixels. */
599 #define WINDOW_TOTAL_FRINGE_WIDTH(W) \
600 (WINDOW_LEFT_FRINGE_WIDTH (W) + WINDOW_RIGHT_FRINGE_WIDTH (W))
602 /* Are fringes outside display margins in window W. */
604 #define WINDOW_HAS_FRINGES_OUTSIDE_MARGINS(W) \
605 (!NILP ((W)->fringes_outside_margins))
607 /* Say whether scroll bars are currently enabled for window W,
608 and which side they are on. */
610 #define WINDOW_VERTICAL_SCROLL_BAR_TYPE(w) \
611 (EQ ((w)->vertical_scroll_bar_type, Qt) \
612 ? FRAME_VERTICAL_SCROLL_BAR_TYPE (WINDOW_XFRAME (w)) \
613 : EQ ((w)->vertical_scroll_bar_type, Qleft) \
614 ? vertical_scroll_bar_left \
615 : EQ ((w)->vertical_scroll_bar_type, Qright) \
616 ? vertical_scroll_bar_right \
617 : vertical_scroll_bar_none) \
619 #define WINDOW_HAS_VERTICAL_SCROLL_BAR(w) \
620 (EQ ((w)->vertical_scroll_bar_type, Qt) \
621 ? FRAME_HAS_VERTICAL_SCROLL_BARS (WINDOW_XFRAME (w)) \
622 : !NILP ((w)->vertical_scroll_bar_type))
624 #define WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT(w) \
625 (EQ ((w)->vertical_scroll_bar_type, Qt) \
626 ? FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (WINDOW_XFRAME (w)) \
627 : EQ ((w)->vertical_scroll_bar_type, Qleft))
629 #define WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT(w) \
630 (EQ ((w)->vertical_scroll_bar_type, Qt) \
631 ? FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (WINDOW_XFRAME (w))\
632 : EQ ((w)->vertical_scroll_bar_type, Qright))
634 /* Width that a scroll bar in window W should have, if there is one.
635 Measured in pixels. If scroll bars are turned off, this is still
638 #define WINDOW_CONFIG_SCROLL_BAR_WIDTH(w) \
639 (INTEGERP ((w)->scroll_bar_width) \
640 ? XFASTINT ((w)->scroll_bar_width) \
641 : FRAME_CONFIG_SCROLL_BAR_WIDTH (WINDOW_XFRAME (w)))
643 /* Width that a scroll bar in window W should have, if there is one.
644 Measured in columns (characters). If scroll bars are turned off,
645 this is still nonzero. */
647 #define WINDOW_CONFIG_SCROLL_BAR_COLS(w) \
648 (INTEGERP ((w)->scroll_bar_width) \
649 ? ((XFASTINT ((w)->scroll_bar_width) \
650 + WINDOW_FRAME_COLUMN_WIDTH (w) - 1) \
651 / WINDOW_FRAME_COLUMN_WIDTH (w)) \
652 : FRAME_CONFIG_SCROLL_BAR_COLS (WINDOW_XFRAME (w)))
654 /* Width of a scroll bar in window W, measured in columns (characters),
655 but only if scroll bars are on the left. If scroll bars are on
656 the right in this frame, or there are no scroll bars, value is 0. */
658 #define WINDOW_LEFT_SCROLL_BAR_COLS(w) \
659 (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) \
660 ? (WINDOW_CONFIG_SCROLL_BAR_COLS (w)) \
663 /* Width of a left scroll bar area in window W , measured in pixels. */
665 #define WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH(w) \
666 (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) \
667 ? (WINDOW_CONFIG_SCROLL_BAR_COLS (w) * WINDOW_FRAME_COLUMN_WIDTH (w)) \
670 /* Width of a scroll bar in window W, measured in columns (characters),
671 but only if scroll bars are on the right. If scroll bars are on
672 the left in this frame, or there are no scroll bars, value is 0. */
674 #define WINDOW_RIGHT_SCROLL_BAR_COLS(w) \
675 (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w) \
676 ? WINDOW_CONFIG_SCROLL_BAR_COLS (w) \
679 /* Width of a left scroll bar area in window W , measured in pixels. */
681 #define WINDOW_RIGHT_SCROLL_BAR_AREA_WIDTH(w) \
682 (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w) \
683 ? (WINDOW_CONFIG_SCROLL_BAR_COLS (w) * WINDOW_FRAME_COLUMN_WIDTH (w)) \
687 /* Actual width of a scroll bar in window W, measured in columns. */
689 #define WINDOW_SCROLL_BAR_COLS(w) \
690 (WINDOW_HAS_VERTICAL_SCROLL_BAR (w) \
691 ? WINDOW_CONFIG_SCROLL_BAR_COLS (w) \
694 /* Width of a left scroll bar area in window W , measured in pixels. */
696 #define WINDOW_SCROLL_BAR_AREA_WIDTH(w) \
697 (WINDOW_HAS_VERTICAL_SCROLL_BAR (w) \
698 ? (WINDOW_CONFIG_SCROLL_BAR_COLS (w) * WINDOW_FRAME_COLUMN_WIDTH (w)) \
702 /* Return the frame position where the scroll bar of window W starts. */
704 #define WINDOW_SCROLL_BAR_AREA_X(W) \
705 (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (W) \
706 ? WINDOW_BOX_RIGHT_EDGE_X (W) \
707 : WINDOW_LEFT_EDGE_X (W))
710 /* Height in pixels, and in lines, of the mode line.
711 May be zero if W doesn't have a mode line. */
713 #define WINDOW_MODE_LINE_HEIGHT(W) \
714 (WINDOW_WANTS_MODELINE_P ((W)) \
715 ? CURRENT_MODE_LINE_HEIGHT (W) \
718 #define WINDOW_MODE_LINE_LINES(W) \
719 (!! WINDOW_WANTS_MODELINE_P ((W)))
721 /* Height in pixels, and in lines, of the header line.
722 Zero if W doesn't have a header line. */
724 #define WINDOW_HEADER_LINE_HEIGHT(W) \
725 (WINDOW_WANTS_HEADER_LINE_P ((W)) \
726 ? CURRENT_HEADER_LINE_HEIGHT (W) \
729 #define WINDOW_HEADER_LINE_LINES(W) \
730 (!! WINDOW_WANTS_HEADER_LINE_P ((W)))
732 /* Pixel height of window W without mode line. */
734 #define WINDOW_BOX_HEIGHT_NO_MODE_LINE(W) \
735 (WINDOW_TOTAL_HEIGHT ((W)) \
736 - WINDOW_MODE_LINE_HEIGHT ((W)))
738 /* Pixel height of window W without mode and header line. */
740 #define WINDOW_BOX_TEXT_HEIGHT(W) \
741 (WINDOW_TOTAL_HEIGHT ((W)) \
742 - WINDOW_MODE_LINE_HEIGHT ((W)) \
743 - WINDOW_HEADER_LINE_HEIGHT ((W)))
746 /* Convert window W relative pixel X to frame pixel coordinates. */
748 #define WINDOW_TO_FRAME_PIXEL_X(W, X) \
749 ((X) + WINDOW_BOX_LEFT_EDGE_X ((W)))
751 /* Convert window W relative pixel Y to frame pixel coordinates. */
753 #define WINDOW_TO_FRAME_PIXEL_Y(W, Y) \
754 ((Y) + WINDOW_TOP_EDGE_Y ((W)))
756 /* Convert frame relative pixel X to window relative pixel X. */
758 #define FRAME_TO_WINDOW_PIXEL_X(W, X) \
759 ((X) - WINDOW_BOX_LEFT_EDGE_X ((W)))
761 /* Convert frame relative pixel Y to window relative pixel Y. */
763 #define FRAME_TO_WINDOW_PIXEL_Y(W, Y) \
764 ((Y) - WINDOW_TOP_EDGE_Y ((W)))
766 /* Convert a text area relative x-position in window W to frame X
767 pixel coordinates. */
769 #define WINDOW_TEXT_TO_FRAME_PIXEL_X(W, X) \
770 (window_box_left ((W), TEXT_AREA) + (X))
772 /* This is the window in which the terminal's cursor should
773 be left when nothing is being done with it. This must
774 always be a leaf window, and its buffer is selected by
775 the top level editing loop at the end of each command.
777 This value is always the same as
778 FRAME_SELECTED_WINDOW (selected_frame). */
780 extern Lisp_Object selected_window
;
782 /* This is a time stamp for window selection, so we can find the least
783 recently used window. Its only users are Fselect_window,
784 init_window_once, and make_frame. */
786 extern int window_select_count
;
788 /* The minibuffer window of the selected frame.
789 Note that you cannot test for minibufferness of an arbitrary window
790 by comparing against this; use the MINI_WINDOW_P macro instead. */
792 extern Lisp_Object minibuf_window
;
794 /* Non-nil means it is the window whose mode line should be
795 shown as the selected window when the minibuffer is selected. */
797 extern Lisp_Object minibuf_selected_window
;
799 /* Non-nil => window to for C-M-v to scroll when the minibuffer is
802 extern Lisp_Object Vminibuf_scroll_window
;
804 /* Nil or a symbol naming the window system under which emacs is
805 running ('x is the only current possibility) */
807 extern Lisp_Object Vinitial_window_system
;
809 /* Version number of X windows: 10, 11 or nil. */
811 extern Lisp_Object Vwindow_system_version
;
813 /* Window that the mouse is over (nil if no mouse support). */
815 extern Lisp_Object Vmouse_window
;
817 /* Last mouse-click event (nil if no mouse support). */
819 extern Lisp_Object Vmouse_event
;
821 EXFUN (Fnext_window
, 3);
822 EXFUN (Fselect_window
, 2);
823 EXFUN (Fset_window_buffer
, 3);
824 EXFUN (Fset_window_hscroll
, 2);
825 EXFUN (Fwindow_hscroll
, 1);
826 EXFUN (Fset_window_vscroll
, 3);
827 EXFUN (Fwindow_vscroll
, 2);
828 EXFUN (Fset_window_margins
, 3);
829 EXFUN (Fwindow_live_p
, 1);
830 EXFUN (Fset_window_point
, 2);
831 extern Lisp_Object
make_window (void);
832 extern Lisp_Object
window_from_coordinates (struct frame
*, int, int,
835 EXFUN (Fwindow_dedicated_p
, 1);
836 extern int window_height (Lisp_Object
);
837 extern int window_width (Lisp_Object
);
838 extern void resize_frame_windows (struct frame
*, int, int);
839 extern void delete_all_subwindows (Lisp_Object
);
840 extern void freeze_window_starts (struct frame
*, int);
841 extern void foreach_window (struct frame
*,
842 int (* fn
) (struct window
*, void *),
844 extern void grow_mini_window (struct window
*, int);
845 extern void shrink_mini_window (struct window
*);
847 void run_window_configuration_change_hook (struct frame
*f
);
849 /* Make WINDOW display BUFFER as its contents. RUN_HOOKS_P non-zero
850 means it's allowed to run hooks. See make_frame for a case where
853 void set_window_buffer (Lisp_Object window
, Lisp_Object buffer
,
854 int run_hooks_p
, int keep_margins_p
);
856 /* Prompt to display in front of the minibuffer contents. */
858 extern Lisp_Object minibuf_prompt
;
860 /* The visual width of the above. */
862 extern int minibuf_prompt_width
;
864 /* This is the window where the echo area message was displayed. It
865 is always a minibuffer window, but it may not be the same window
866 currently active as a minibuffer. */
868 extern Lisp_Object echo_area_window
;
870 /* Depth in recursive edits. */
872 extern int command_loop_level
;
874 /* Depth in minibuffer invocations. */
876 extern int minibuf_level
;
878 /* true if we should redraw the mode lines on the next redisplay. */
880 extern int update_mode_lines
;
882 /* Nonzero if BEGV - BEG or Z - ZV of current buffer has changed since
883 last redisplay that finished. */
885 extern int clip_changed
;
887 /* Nonzero if window sizes or contents have changed since last
888 redisplay that finished */
890 extern int windows_or_buffers_changed
;
892 /* Nonzero means a frame's cursor type has been changed. */
894 extern int cursor_type_changed
;
896 /* Number of windows displaying the selected buffer. Normally this is
897 1, but it can be more. */
899 extern int buffer_shared
;
901 /* If *ROWS or *COLS are too small a size for FRAME, set them to the
902 minimum allowable size. */
904 extern void check_frame_size (struct frame
*frame
, int *rows
, int *cols
);
906 /* Return a pointer to the glyph W's physical cursor is on. Value is
907 null if W's current matrix is invalid, so that no meaningfull glyph
910 struct glyph
*get_phys_cursor_glyph (struct window
*w
);
912 /* Value is non-zero if WINDOW is a live window. */
914 #define WINDOW_LIVE_P(WINDOW) \
915 (WINDOWP ((WINDOW)) && !NILP (XWINDOW ((WINDOW))->buffer))
918 /* These used to be in lisp.h. */
920 extern Lisp_Object Qwindowp
, Qwindow_live_p
;
921 extern Lisp_Object Vwindow_list
;
923 EXFUN (Fwindow_end
, 2);
924 EXFUN (Fselected_window
, 0);
925 EXFUN (Fwindow_minibuffer_p
, 1);
926 EXFUN (Fwindow_buffer
, 1);
927 EXFUN (Fget_buffer_window
, 2);
928 EXFUN (Fsave_window_excursion
, UNEVALLED
);
929 EXFUN (Fset_window_configuration
, 1);
930 EXFUN (Fcurrent_window_configuration
, 1);
931 extern int compare_window_configurations (Lisp_Object
, Lisp_Object
, int);
932 EXFUN (Fcoordinates_in_window_p
, 2);
933 EXFUN (Fwindow_at
, 3);
934 EXFUN (Fpos_visible_in_window_p
, 3);
935 extern void mark_window_cursors_off (struct window
*);
936 extern int window_internal_height (struct window
*);
937 extern int window_body_lines (struct window
*w
);
938 extern int window_body_cols (struct window
*w
);
939 EXFUN (Frecenter
, 1);
940 EXFUN (Fscroll_other_window
, 1);
941 EXFUN (Fset_window_start
, 3);
942 extern void temp_output_buffer_show (Lisp_Object
);
943 extern void replace_buffer_in_all_windows (Lisp_Object
);
944 extern void init_window_once (void);
945 extern void init_window (void);
946 extern void syms_of_window (void);
947 extern void keys_of_window (void);
949 #endif /* not WINDOW_H_INCLUDED */
951 /* arch-tag: d4a6942f-e433-4ffe-ac10-2c3574f28577
952 (do not change this comment) */