comparison src/window.h @ 51208:86d74f5ea803

(struct window): Rename members left to left_col, top to top_line, height to total_lines, width to total_cols, left_margin_width to left_margin_cols, right_margin_width to right_margin_cols, orig_height to orig_total_lines, orig_top to orig_top_line. All uses changed. (struct window): New members left_fringe_width, right_fringe_width, fringes_outside_margins, scroll_bar_width, vertical_scroll_bar_type. (WINDOW_XFRAME, WINDOW_FRAME_COLUMN_WIDTH, WINDOW_FRAME_LINE_HEIGHT): New macros primarily used to simplify other macros. (WINDOW_TOTAL_COLS): New macro. Change relevant code that referred to XINT (w->width). (WINDOW_TOTAL_LINES): New macro. Change relevant code that referred to XINT (w->height). (WINDOW_TOTAL_WIDTH): New macro. Change relevant code that referred to XINT (w->width) * canon_x_unit. (WINDOW_TOTAL_HEIGHT): New macro. Change relevant code that referred to XINT (w->height) * canon_y_unit. (WINDOW_LEFT_EDGE_COL): New macro. Change relevant code that referred to XINT (w->left). (WINDOW_RIGHT_EDGE_COL): Renamed from WINDOW_RIGHT_EDGE. Change all uses and code that referred to XINT (w->left) + XINT (w->width). (WINDOW_TOP_EDGE_LINE): New macro. Change relevant code that referred to XINT (w->top). (WINDOW_BOTTOM_EDGE_LINE): New macro. Change relevant code that referred to XINT (w->top) + XINT (w->height). (WINDOW_LEFT_EDGE_X): New macro. Change relevant code that referred to XINT (w->left) * canon_x_unit. (WINDOW_RIGHT_EDGE_X): New macro. Change relevant code that referred to (XINT (w->left) + XINT (w->width)) * canon_x_unit. (WINDOW_TOP_EDGE_Y): New macro. Change relevant code that referred to XINT (w->top) * canon_y_unit. (WINDOW_BOTTOM_EDGE_Y): New macro. Change relevant code that referred to (XINT (w->top) + XINT (w->height)) * canon_y_unit. (WINDOW_LEFTMOST_P): New macro. (WINDOW_BOX_LEFT_EDGE_COL): Renamed from WINDOW_LEFT_MARGIN. All uses changed. (WINDOW_BOX_RIGHT_EDGE_COL): Renamed from WINDOW_RIGHT_MARGIN. All uses changed. (WINDOW_BOX_LEFT_EDGE_X): Renamed from WINDOW_DISPLAY_LEFT_EDGE_PIXEL_X, moved from dispextern.h. Do not exclude left fringe width. (WINDOW_BOX_RIGHT_EDGE_X): Renamed from WINDOW_DISPLAY_RIGHT_EDGE_PIXEL_X, moved from dispextern.h. Do not exclude fringe widths. (WINDOW_LEFT_FRINGE_WIDTH, WINDOW_RIGHT_FRINGE_WIDTH) (WINDOW_FRINGE_COLS, WINDOW_TOTAL_FRINGE_WIDTH): New macros. Change relevant code that referred to FRAME_LEFT_FRINGE_WIDTH, FRAME_RIGHT_FRINGE_WIDTH, FRAME_FRINGE_COLS, and FRAME_TOTAL_FRINGE_WIDTH to allow per-window fringe settings. (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS): New macro. (WINDOW_VERTICAL_SCROLL_BAR_TYPE, WINDOW_HAS_VERTICAL_SCROLL_BAR) (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT) (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT) (WINDOW_CONFIG_SCROLL_BAR_WIDTH, WINDOW_CONFIG_SCROLL_BAR_COLS): New macros. Change code which referenced corresponding FRAME_VERTICAL_SCROLL_BAR_TYPE, FRAME_HAS_VERTICAL_SCROLL_BARS, FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT, FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT, FRAME_SCROLL_BAR_PIXEL_WIDTH, and FRAME_SCROLL_BAR_COLS macros to allow per-window scroll-bar settings. (WINDOW_LEFT_SCROLL_BAR_COLS, WINDOW_RIGHT_SCROLL_BAR_COLS): New macros. (WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH): New macro. Change code that referred to FRAME_LEFT_SCROLL_BAR_WIDTH. (WINDOW_RIGHT_SCROLL_BAR_AREA_WIDTH): New macro. Change code that referred to FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT and FRAME_SCROLL_BAR_WIDTH. (WINDOW_SCROLL_BAR_COLS, WINDOW_SCROLL_BAR_AREA_WIDTH) (WINDOW_SCROLL_BAR_AREA_X): New macros. (WINDOW_HEADER_LINE_HEIGHT): Renamed from WINDOW_DISPLAY_HEADER_LINE_HEIGHT, moved from dispextern.h. (WINDOW_BOX_HEIGHT_NO_MODE_LINE): Renamed from WINDOW_DISPLAY_HEIGHT_NO_MODE_LINE, moved from dispextern.h. (WINDOW_BOX_TEXT_HEIGHT): Renamed from WINDOW_DISPLAY_PIXEL_WIDTH, moved from dispextern.h. (WINDOW_TO_FRAME_PIXEL_X, WINDOW_TO_FRAME_PIXEL_Y) (FRAME_TO_WINDOW_PIXEL_X, FRAME_TO_WINDOW_PIXEL_Y) (WINDOW_TEXT_TO_FRAME_PIXEL_X): Moved here from dispextern.h. (WINDOW_LEFT_MARGIN_WIDTH): Renamed from WINDOW_DISPLAY_LEFT_AREA_PIXEL_WIDTH, moved from dispextern.h. (WINDOW_RIGHT_MARGIN_WIDTH): Renamed from WINDOW_DISPLAY_RIGHT_AREA_PIXEL_WIDTH, moved from dispextern.h. (window_from_coordinates): Update prototype. (Fset_window_buffer): Update EXFUN. (set_window_buffer): Update prototype.
author Kim F. Storm <storm@cua.dk>
date Sat, 24 May 2003 22:08:20 +0000
parents 7ac9c3bea5ea
children d4574290ba8b
comparison
equal deleted inserted replaced
51207:7e176ef34c10 51208:86d74f5ea803
21 21
22 #ifndef WINDOW_H_INCLUDED 22 #ifndef WINDOW_H_INCLUDED
23 #define WINDOW_H_INCLUDED 23 #define WINDOW_H_INCLUDED
24 24
25 #include "dispextern.h" 25 #include "dispextern.h"
26
27 extern Lisp_Object Qleft, Qright;
26 28
27 /* Windows are allocated as if they were vectors, but then the 29 /* Windows are allocated as if they were vectors, but then the
28 Lisp data type is changed to Lisp_Window. They are garbage 30 Lisp data type is changed to Lisp_Window. They are garbage
29 collected along with the vectors. 31 collected along with the vectors.
30 32
106 Lisp_Object hchild, vchild; 108 Lisp_Object hchild, vchild;
107 /* The window this one is a child of. */ 109 /* The window this one is a child of. */
108 Lisp_Object parent; 110 Lisp_Object parent;
109 /* The upper left corner coordinates of this window, 111 /* The upper left corner coordinates of this window,
110 as integers relative to upper left corner of frame = 0, 0 */ 112 as integers relative to upper left corner of frame = 0, 0 */
111 Lisp_Object left; 113 Lisp_Object left_col;
112 Lisp_Object top; 114 Lisp_Object top_line;
113 /* The size of the window */ 115 /* The size of the window */
114 Lisp_Object height; 116 Lisp_Object total_lines;
115 Lisp_Object width; 117 Lisp_Object total_cols;
116 /* The buffer displayed in this window */ 118 /* The buffer displayed in this window */
117 /* Of the fields vchild, hchild and buffer, only one is non-nil. */ 119 /* Of the fields vchild, hchild and buffer, only one is non-nil. */
118 Lisp_Object buffer; 120 Lisp_Object buffer;
119 /* A marker pointing to where in the text to start displaying */ 121 /* A marker pointing to where in the text to start displaying */
120 Lisp_Object start; 122 Lisp_Object start;
158 it yet, or if the frame doesn't have any scroll bars, this is nil. */ 160 it yet, or if the frame doesn't have any scroll bars, this is nil. */
159 Lisp_Object vertical_scroll_bar; 161 Lisp_Object vertical_scroll_bar;
160 162
161 /* Width of left and right marginal areas. A value of nil means 163 /* Width of left and right marginal areas. A value of nil means
162 no margin. */ 164 no margin. */
163 Lisp_Object left_margin_width; 165 Lisp_Object left_margin_cols, right_margin_cols;
164 Lisp_Object right_margin_width; 166
167 /* Width of left and right fringes.
168 A value of nil or t means use frame values. */
169 Lisp_Object left_fringe_width, right_fringe_width;
170
171 /* Non-nil means fringes are drawn outside display margins;
172 othersize draw them between margin areas and text. */
173 Lisp_Object fringes_outside_margins;
174
175 /* Pixel width of scroll bars.
176 A value of nil or t means use frame values. */
177 Lisp_Object scroll_bar_width;
178 /* Type of vertical scroll bar. A value of nil means
179 no scroll bar. A value of t means use frame value. */
180 Lisp_Object vertical_scroll_bar_type;
165 181
166 /* The rest are currently not used or only half used */ 182 /* The rest are currently not used or only half used */
167 /* Frame coords of mark as of last time display completed */ 183 /* Frame coords of mark as of last time display completed */
168 /* May be nil if mark does not exist or was not on frame */ 184 /* May be nil if mark does not exist or was not on frame */
169 Lisp_Object last_mark_x; 185 Lisp_Object last_mark_x;
209 /* Non-nil means don't delete this window for becoming "too small". */ 225 /* Non-nil means don't delete this window for becoming "too small". */
210 Lisp_Object too_small_ok; 226 Lisp_Object too_small_ok;
211 227
212 /* Original window height and top before mini-window was 228 /* Original window height and top before mini-window was
213 enlarged. */ 229 enlarged. */
214 Lisp_Object orig_height, orig_top; 230 Lisp_Object orig_total_lines, orig_top_line;
215 231
216 /* No Lisp data may follow below this point without changing 232 /* No Lisp data may follow below this point without changing
217 mark_object in alloc.c. The member current_matrix must be the 233 mark_object in alloc.c. The member current_matrix must be the
218 first non-Lisp member. */ 234 first non-Lisp member. */
219 235
279 295
280 /* 1 if W is a minibuffer window. */ 296 /* 1 if W is a minibuffer window. */
281 297
282 #define MINI_WINDOW_P(W) (!NILP ((W)->mini_p)) 298 #define MINI_WINDOW_P(W) (!NILP ((W)->mini_p))
283 299
284 /* Return the window column at which the text in window W starts. 300 /* General window layout:
285 This is different from the `left' field because it does not include 301
286 a left-hand scroll bar if any. */ 302 LEFT_EDGE_COL RIGHT_EDGE_COL
287 303 | |
288 #define WINDOW_LEFT_MARGIN(W) \ 304 | |
289 (XFASTINT ((W)->left) \ 305 | BOX_LEFT_EDGE_COL |
290 + FRAME_LEFT_SCROLL_BAR_WIDTH (XFRAME (WINDOW_FRAME (W)))) 306 | | BOX_RIGHT_EDGE_COL |
291 307 | | | |
292 /* Return the window column before which window W ends. 308 v v v v
309 <-><-><---><-----------><---><-><->
310 ^ ^ ^ ^ ^ ^ ^
311 | | | | | | |
312 | | | | | | +-- RIGHT_SCROLL_BAR_COLS
313 | | | | | +----- RIGHT_FRINGE_WIDTH
314 | | | | +--------- RIGHT_MARGIN_COLS
315 | | | |
316 | | | +------------------ TEXT_AREA_COLS
317 | | |
318 | | +--------------------------- LEFT_MARGIN_COLS
319 | +------------------------------- LEFT_FRINGE_WIDTH
320 +---------------------------------- LEFT_SCROLL_BAR_COLS
321
322 */
323
324
325 /* A handy macro. */
326
327 #define WINDOW_XFRAME(W) \
328 (XFRAME (WINDOW_FRAME ((W))))
329
330 /* Return the canonical column width of the frame of window W. */
331
332 #define WINDOW_FRAME_COLUMN_WIDTH(W) \
333 (FRAME_COLUMN_WIDTH (WINDOW_XFRAME ((W))))
334
335 /* Return the canonical column width of the frame of window W. */
336
337 #define WINDOW_FRAME_LINE_HEIGHT(W) \
338 (FRAME_LINE_HEIGHT (WINDOW_XFRAME ((W))))
339
340
341 /* Return the frame width in canonical column units.
342 This includes scroll bars and fringes. */
343
344 #define WINDOW_TOTAL_COLS(W) \
345 (XFASTINT ((W)->total_cols))
346
347 /* Return the frame height in canonical line units.
348 This includes header and mode lines, if any. */
349
350 #define WINDOW_TOTAL_LINES(W) \
351 (XFASTINT ((W)->total_lines))
352
353
354 /* Return the total pixel width of window W. */
355
356 #define WINDOW_TOTAL_WIDTH(W) \
357 (WINDOW_TOTAL_COLS (W) * WINDOW_FRAME_COLUMN_WIDTH (W))
358
359 /* Return the total pixel height of window W. */
360
361 #define WINDOW_TOTAL_HEIGHT(W) \
362 (WINDOW_TOTAL_LINES (W) * WINDOW_FRAME_LINE_HEIGHT (W))
363
364
365 /* Return the canonical frame column at which window W starts.
366 This includes a left-hand scroll bar, if any. */
367
368 #define WINDOW_LEFT_EDGE_COL(W) \
369 (XFASTINT ((W)->left_col))
370
371 /* Return the canonical frame column before which window W ends.
293 This includes a right-hand scroll bar, if any. */ 372 This includes a right-hand scroll bar, if any. */
294 373
295 #define WINDOW_RIGHT_EDGE(W) \ 374 #define WINDOW_RIGHT_EDGE_COL(W) \
296 (XFASTINT ((W)->left) + XFASTINT ((W)->width)) 375 (WINDOW_LEFT_EDGE_COL (W) + WINDOW_TOTAL_COLS (W))
376
377 /* Return the canonical frame line at which window W starts.
378 This includes a header line, if any. */
379
380 #define WINDOW_TOP_EDGE_LINE(W) \
381 (XFASTINT ((W)->top_line))
382
383 /* Return the canonical frame line before which window W ends.
384 This includes a mode line, if any. */
385
386 #define WINDOW_BOTTOM_EDGE_LINE(W) \
387 (WINDOW_TOP_EDGE_LINE (W) + WINDOW_TOTAL_LINES (W))
388
389
390 /* Return the frame x-position at which window W starts.
391 This includes a left-hand scroll bar, if any. */
392
393 #define WINDOW_LEFT_EDGE_X(W) \
394 (FRAME_INTERNAL_BORDER_WIDTH (WINDOW_XFRAME (W)) \
395 + WINDOW_LEFT_EDGE_COL (W) * WINDOW_FRAME_COLUMN_WIDTH (W))
396
397 /* Return the frame x- position before which window W ends.
398 This includes a right-hand scroll bar, if any. */
399
400 #define WINDOW_RIGHT_EDGE_X(W) \
401 (FRAME_INTERNAL_BORDER_WIDTH (WINDOW_XFRAME (W)) \
402 + WINDOW_RIGHT_EDGE_COL (W) * WINDOW_FRAME_COLUMN_WIDTH (W))
403
404 /* Return the frame y-position at which window W starts.
405 This includes a header line, if any. */
406
407 #define WINDOW_TOP_EDGE_Y(W) \
408 (FRAME_INTERNAL_BORDER_WIDTH (WINDOW_XFRAME (W)) \
409 + WINDOW_TOP_EDGE_LINE (W) * WINDOW_FRAME_LINE_HEIGHT (W))
410
411 /* Return the frame y-position before which window W ends.
412 This includes a mode line, if any. */
413
414 #define WINDOW_BOTTOM_EDGE_Y(W) \
415 (FRAME_INTERNAL_BORDER_WIDTH (WINDOW_XFRAME (W)) \
416 + WINDOW_BOTTOM_EDGE_LINE (W) * WINDOW_FRAME_LINE_HEIGHT (W))
417
418
419 /* 1 if window W takes up the full width of its frame. */
420
421 #define WINDOW_FULL_WIDTH_P(W) \
422 (WINDOW_TOTAL_COLS (W) == FRAME_TOTAL_COLS (WINDOW_XFRAME (W)))
423
424 /* 1 if window W's has no other windows to its left in its frame. */
425
426 #define WINDOW_LEFTMOST_P(W) \
427 (WINDOW_LEFT_EDGE_COL (W) == 0)
428
429 /* 1 if window W's has no other windows to its right in its frame. */
430
431 #define WINDOW_RIGHTMOST_P(W) \
432 (WINDOW_RIGHT_EDGE_COL (W) == FRAME_TOTAL_COLS (WINDOW_XFRAME (W)))
433
434
435 /* Return the frame column at which the text (or left fringe) in
436 window W starts. This is different from the `LEFT_EDGE' because it
437 does not include a left-hand scroll bar if any. */
438
439 #define WINDOW_BOX_LEFT_EDGE_COL(W) \
440 (WINDOW_LEFT_EDGE_COL (W) \
441 + WINDOW_LEFT_SCROLL_BAR_COLS (W))
297 442
298 /* Return the window column before which the text in window W ends. 443 /* Return the window column before which the text in window W ends.
299 This is different from WINDOW_RIGHT_EDGE because it does not include 444 This is different from WINDOW_RIGHT_EDGE_COL because it does not
300 a scroll bar or window-separating line on the right edge. */ 445 include a scroll bar or window-separating line on the right edge. */
301 446
302 #define WINDOW_RIGHT_MARGIN(W) \ 447 #define WINDOW_BOX_RIGHT_EDGE_COL(W) \
303 (WINDOW_RIGHT_EDGE (W) \ 448 (WINDOW_RIGHT_EDGE_COL (W) \
304 - (FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (XFRAME (WINDOW_FRAME (W))) \ 449 - WINDOW_RIGHT_SCROLL_BAR_COLS (W))
305 ? FRAME_SCROLL_BAR_COLS (XFRAME (WINDOW_FRAME (W))) \ 450
306 : 0)) 451
307 452 /* Return the frame position at which the text (or left fringe) in
308 /* 1 if window W takes up the full width of its frame. */ 453 window W starts. This is different from the `LEFT_EDGE' because it
309 454 does not include a left-hand scroll bar if any. */
310 #define WINDOW_FULL_WIDTH_P(W) \ 455
311 (XFASTINT ((W)->width) == FRAME_WINDOW_WIDTH (XFRAME (WINDOW_FRAME (W)))) 456 #define WINDOW_BOX_LEFT_EDGE_X(W) \
312 457 (FRAME_INTERNAL_BORDER_WIDTH (WINDOW_XFRAME (W)) \
313 /* 1 if window W's has no other windows to its right in its frame. */ 458 + WINDOW_BOX_LEFT_EDGE_COL (W) * WINDOW_FRAME_COLUMN_WIDTH (W))
314 459
315 #define WINDOW_RIGHTMOST_P(W) \ 460 /* Return the window column before which the text in window W ends.
316 (WINDOW_RIGHT_EDGE (W) == FRAME_WINDOW_WIDTH (XFRAME (WINDOW_FRAME (W)))) 461 This is different from WINDOW_RIGHT_EDGE_COL because it does not
317 462 include a scroll bar or window-separating line on the right edge. */
463
464 #define WINDOW_BOX_RIGHT_EDGE_X(W) \
465 (FRAME_INTERNAL_BORDER_WIDTH (WINDOW_XFRAME (W)) \
466 + WINDOW_BOX_RIGHT_EDGE_COL (W) * WINDOW_FRAME_COLUMN_WIDTH (W))
467
468
469 /* Width of left margin area in columns. */
470
471 #define WINDOW_LEFT_MARGIN_COLS(W) \
472 (NILP ((W)->left_margin_cols) \
473 ? 0 \
474 : XINT ((W)->left_margin_cols))
475
476 /* Width of right marginal area in columns. */
477
478 #define WINDOW_RIGHT_MARGIN_COLS(W) \
479 (NILP ((W)->right_margin_cols) \
480 ? 0 \
481 : XINT ((W)->right_margin_cols))
482
483 /* Width of left margin area in pixels. */
484
485 #define WINDOW_LEFT_MARGIN_WIDTH(W) \
486 (NILP ((W)->left_margin_cols) \
487 ? 0 \
488 : (XINT ((W)->left_margin_cols) \
489 * WINDOW_FRAME_COLUMN_WIDTH (W)))
490
491 /* Width of right marginal area in pixels. */
492
493 #define WINDOW_RIGHT_MARGIN_WIDTH(W) \
494 (NILP ((W)->right_margin_cols) \
495 ? 0 \
496 : (XINT ((W)->right_margin_cols) \
497 * WINDOW_FRAME_COLUMN_WIDTH (W)))
498
499 /* Total width of fringes reserved for drawing truncation bitmaps,
500 continuation bitmaps and alike. The width is in canonical char
501 units of the frame. This must currently be the case because window
502 sizes aren't pixel values. If it weren't the case, we wouldn't be
503 able to split windows horizontally nicely. */
504
505 #define WINDOW_FRINGE_COLS(W) \
506 ((INTEGERP ((W)->left_fringe_width) \
507 || INTEGERP ((W)->right_fringe_width)) \
508 ? ((WINDOW_LEFT_FRINGE_WIDTH (W) \
509 + WINDOW_RIGHT_FRINGE_WIDTH (W) \
510 + WINDOW_FRAME_COLUMN_WIDTH (W) - 1) \
511 / WINDOW_FRAME_COLUMN_WIDTH (W)) \
512 : FRAME_FRINGE_COLS (WINDOW_XFRAME (W)))
513
514 /* Pixel-width of the left and right fringe. */
515
516 #define WINDOW_LEFT_FRINGE_WIDTH(W) \
517 (INTEGERP ((W)->left_fringe_width) \
518 ? XFASTINT ((W)->left_fringe_width) \
519 : FRAME_LEFT_FRINGE_WIDTH (WINDOW_XFRAME (W)))
520
521 #define WINDOW_RIGHT_FRINGE_WIDTH(W) \
522 (INTEGERP ((W)->right_fringe_width) \
523 ? XFASTINT ((W)->right_fringe_width) \
524 : FRAME_RIGHT_FRINGE_WIDTH (WINDOW_XFRAME (W)))
525
526 /* Total width of fringes in pixels. */
527
528 #define WINDOW_TOTAL_FRINGE_WIDTH(W) \
529 (WINDOW_LEFT_FRINGE_WIDTH (W) + WINDOW_RIGHT_FRINGE_WIDTH (W))
530
531 /* Are fringes outside display margins in window W. */
532
533 #define WINDOW_HAS_FRINGES_OUTSIDE_MARGINS(W) \
534 (!NILP ((W)->fringes_outside_margins))
535
536 /* Say whether scroll bars are currently enabled for window W,
537 and which side they are on. */
538
539 #define WINDOW_VERTICAL_SCROLL_BAR_TYPE(w) \
540 (EQ ((w)->vertical_scroll_bar_type, Qt) \
541 ? FRAME_VERTICAL_SCROLL_BAR_TYPE (WINDOW_XFRAME (w)) \
542 : EQ ((w)->vertical_scroll_bar_type, Qleft) \
543 ? vertical_scroll_bar_left \
544 : EQ ((w)->vertical_scroll_bar_type, Qright) \
545 ? vertical_scroll_bar_right \
546 : vertical_scroll_bar_none) \
547
548 #define WINDOW_HAS_VERTICAL_SCROLL_BAR(w) \
549 (EQ ((w)->vertical_scroll_bar_type, Qt) \
550 ? FRAME_HAS_VERTICAL_SCROLL_BARS (WINDOW_XFRAME (w)) \
551 : !NILP ((w)->vertical_scroll_bar_type))
552
553 #define WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT(w) \
554 (EQ ((w)->vertical_scroll_bar_type, Qt) \
555 ? FRAME_HAS_VERTICAL_SCROLL_BARS_ON_LEFT (WINDOW_XFRAME (w)) \
556 : EQ ((w)->vertical_scroll_bar_type, Qleft))
557
558 #define WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT(w) \
559 (EQ ((w)->vertical_scroll_bar_type, Qt) \
560 ? FRAME_HAS_VERTICAL_SCROLL_BARS_ON_RIGHT (WINDOW_XFRAME (w))\
561 : EQ ((w)->vertical_scroll_bar_type, Qright))
562
563 /* Width that a scroll bar in window W should have, if there is one.
564 Measured in pixels. If scroll bars are turned off, this is still
565 nonzero. */
566
567 #define WINDOW_CONFIG_SCROLL_BAR_WIDTH(w) \
568 (INTEGERP ((w)->scroll_bar_width) \
569 ? XFASTINT ((w)->scroll_bar_width) \
570 : FRAME_CONFIG_SCROLL_BAR_WIDTH (WINDOW_XFRAME (w)))
571
572 /* Width that a scroll bar in window W should have, if there is one.
573 Measured in columns (characters). If scroll bars are turned off,
574 this is still nonzero. */
575
576 #define WINDOW_CONFIG_SCROLL_BAR_COLS(w) \
577 (INTEGERP ((w)->scroll_bar_width) \
578 ? ((XFASTINT ((w)->scroll_bar_width) \
579 + WINDOW_FRAME_COLUMN_WIDTH (w) - 1) \
580 / WINDOW_FRAME_COLUMN_WIDTH (w)) \
581 : FRAME_CONFIG_SCROLL_BAR_COLS (WINDOW_XFRAME (w)))
582
583 /* Width of a scroll bar in window W, measured in columns (characters),
584 but only if scroll bars are on the left. If scroll bars are on
585 the right in this frame, or there are no scroll bars, value is 0. */
586
587 #define WINDOW_LEFT_SCROLL_BAR_COLS(w) \
588 (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) \
589 ? (WINDOW_CONFIG_SCROLL_BAR_COLS (w)) \
590 : 0)
591
592 /* Width of a left scroll bar area in window W , measured in pixels. */
593
594 #define WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH(w) \
595 (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) \
596 ? (WINDOW_CONFIG_SCROLL_BAR_COLS (w) * WINDOW_FRAME_COLUMN_WIDTH (w)) \
597 : 0)
598
599 /* Width of a scroll bar in window W, measured in columns (characters),
600 but only if scroll bars are on the right. If scroll bars are on
601 the left in this frame, or there are no scroll bars, value is 0. */
602
603 #define WINDOW_RIGHT_SCROLL_BAR_COLS(w) \
604 (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w) \
605 ? WINDOW_CONFIG_SCROLL_BAR_COLS (w) \
606 : 0)
607
608 /* Width of a left scroll bar area in window W , measured in pixels. */
609
610 #define WINDOW_RIGHT_SCROLL_BAR_AREA_WIDTH(w) \
611 (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w) \
612 ? (WINDOW_CONFIG_SCROLL_BAR_COLS (w) * WINDOW_FRAME_COLUMN_WIDTH (w)) \
613 : 0)
614
615
616 /* Actual width of a scroll bar in window W, measured in columns. */
617
618 #define WINDOW_SCROLL_BAR_COLS(w) \
619 (WINDOW_HAS_VERTICAL_SCROLL_BAR (w) \
620 ? WINDOW_CONFIG_SCROLL_BAR_COLS (w) \
621 : 0)
622
623 /* Width of a left scroll bar area in window W , measured in pixels. */
624
625 #define WINDOW_SCROLL_BAR_AREA_WIDTH(w) \
626 (WINDOW_HAS_VERTICAL_SCROLL_BAR (w) \
627 ? (WINDOW_CONFIG_SCROLL_BAR_COLS (w) * WINDOW_FRAME_COLUMN_WIDTH (w)) \
628 : 0)
629
630
631 /* Return the frame position where the scroll bar of window W starts. */
632
633 #define WINDOW_SCROLL_BAR_AREA_X(W) \
634 (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (W) \
635 ? WINDOW_BOX_RIGHT_EDGE_X (W) \
636 : WINDOW_LEFT_EDGE_X (W))
637
638
639 /* Height in pixels of the mode line. May be zero if W doesn't have a
640 mode line. */
641
642 #define WINDOW_MODE_LINE_HEIGHT(W) \
643 (WINDOW_WANTS_MODELINE_P ((W)) \
644 ? CURRENT_MODE_LINE_HEIGHT (W) \
645 : 0)
646
647 /* Height in pixels of the header line. Zero if W doesn't have a header
648 line. */
649
650 #define WINDOW_HEADER_LINE_HEIGHT(W) \
651 (WINDOW_WANTS_HEADER_LINE_P ((W)) \
652 ? CURRENT_HEADER_LINE_HEIGHT (W) \
653 : 0)
654
655 /* Pixel height of window W without mode line. */
656
657 #define WINDOW_BOX_HEIGHT_NO_MODE_LINE(W) \
658 (WINDOW_TOTAL_HEIGHT ((W)) \
659 - WINDOW_MODE_LINE_HEIGHT ((W)))
660
661 /* Pixel height of window W without mode and header line. */
662
663 #define WINDOW_BOX_TEXT_HEIGHT(W) \
664 (WINDOW_TOTAL_HEIGHT ((W)) \
665 - WINDOW_MODE_LINE_HEIGHT ((W)) \
666 - WINDOW_HEADER_LINE_HEIGHT ((W)))
667
668
669 /* Convert window W relative pixel X to frame pixel coordinates. */
670
671 #define WINDOW_TO_FRAME_PIXEL_X(W, X) \
672 ((X) + WINDOW_BOX_LEFT_EDGE_X ((W)))
673
674 /* Convert window W relative pixel Y to frame pixel coordinates. */
675
676 #define WINDOW_TO_FRAME_PIXEL_Y(W, Y) \
677 ((Y) + WINDOW_TOP_EDGE_Y ((W)))
678
679 /* Convert frame relative pixel X to window relative pixel X. */
680
681 #define FRAME_TO_WINDOW_PIXEL_X(W, X) \
682 ((X) - WINDOW_BOX_LEFT_EDGE_X ((W)))
683
684 /* Convert frame relative pixel Y to window relative pixel Y. */
685
686 #define FRAME_TO_WINDOW_PIXEL_Y(W, Y) \
687 ((Y) - WINDOW_TOP_EDGE_Y ((W)))
688
689 /* Convert a text area relative x-position in window W to frame X
690 pixel coordinates. */
691
692 #define WINDOW_TEXT_TO_FRAME_PIXEL_X(W, X) \
693 (window_box_left ((W), TEXT_AREA) + (X))
318 694
319 /* This is the window in which the terminal's cursor should 695 /* This is the window in which the terminal's cursor should
320 be left when nothing is being done with it. This must 696 be left when nothing is being done with it. This must
321 always be a leaf window, and its buffer is selected by 697 always be a leaf window, and its buffer is selected by
322 the top level editing loop at the end of each command. 698 the top level editing loop at the end of each command.
366 extern Lisp_Object Vmouse_event; 742 extern Lisp_Object Vmouse_event;
367 743
368 EXFUN (Fnext_window, 3); 744 EXFUN (Fnext_window, 3);
369 EXFUN (Fselect_window, 2); 745 EXFUN (Fselect_window, 2);
370 EXFUN (Fdisplay_buffer, 3); 746 EXFUN (Fdisplay_buffer, 3);
371 EXFUN (Fset_window_buffer, 2); 747 EXFUN (Fset_window_buffer, 3);
372 EXFUN (Fset_window_hscroll, 2); 748 EXFUN (Fset_window_hscroll, 2);
373 EXFUN (Fwindow_hscroll, 1); 749 EXFUN (Fwindow_hscroll, 1);
374 EXFUN (Fset_window_vscroll, 2); 750 EXFUN (Fset_window_vscroll, 2);
375 EXFUN (Fwindow_vscroll, 1); 751 EXFUN (Fwindow_vscroll, 1);
376 EXFUN (Fset_window_margins, 3); 752 EXFUN (Fset_window_margins, 3);
377 EXFUN (Fwindow_live_p, 1); 753 EXFUN (Fwindow_live_p, 1);
378 EXFUN (Fset_window_point, 2); 754 EXFUN (Fset_window_point, 2);
379 extern Lisp_Object make_window P_ ((void)); 755 extern Lisp_Object make_window P_ ((void));
380 extern void delete_window P_ ((Lisp_Object)); 756 extern void delete_window P_ ((Lisp_Object));
381 extern Lisp_Object window_from_coordinates P_ ((struct frame *, int, int, 757 extern Lisp_Object window_from_coordinates P_ ((struct frame *, int, int,
382 enum window_part *, int)); 758 enum window_part *,
759 int *, int*, int));
383 EXFUN (Fwindow_dedicated_p, 1); 760 EXFUN (Fwindow_dedicated_p, 1);
384 extern int window_height P_ ((Lisp_Object)); 761 extern int window_height P_ ((Lisp_Object));
385 extern int window_width P_ ((Lisp_Object)); 762 extern int window_width P_ ((Lisp_Object));
386 extern void set_window_height P_ ((Lisp_Object, int, int)); 763 extern void set_window_height P_ ((Lisp_Object, int, int));
387 extern void set_window_width P_ ((Lisp_Object, int, int)); 764 extern void set_window_width P_ ((Lisp_Object, int, int));
398 /* Make WINDOW display BUFFER as its contents. RUN_HOOKS_P non-zero 775 /* Make WINDOW display BUFFER as its contents. RUN_HOOKS_P non-zero
399 means it's allowed to run hooks. See make_frame for a case where 776 means it's allowed to run hooks. See make_frame for a case where
400 it's not allowed. */ 777 it's not allowed. */
401 778
402 void set_window_buffer P_ ((Lisp_Object window, Lisp_Object buffer, 779 void set_window_buffer P_ ((Lisp_Object window, Lisp_Object buffer,
403 int run_hooks_p)); 780 int run_hooks_p, int keep_margins_p));
404 781
405 /* Prompt to display in front of the minibuffer contents. */ 782 /* Prompt to display in front of the minibuffer contents. */
406 783
407 extern Lisp_Object minibuf_prompt; 784 extern Lisp_Object minibuf_prompt;
408 785