aboutsummaryrefslogtreecommitdiffstats
path: root/src/window.c
diff options
context:
space:
mode:
authorJoakim Verona2011-11-09 14:05:54 +0100
committerJoakim Verona2011-11-09 14:05:54 +0100
commitc8d4b74cfa26762d34fd1703a07463008b32be16 (patch)
tree6610ac356d47e328bb1094d9f5a0dcc15ed5fb6a /src/window.c
parent32db4845d5c433fd15c6665cbed169e5d8b94f05 (diff)
parent2cffd68198c4d574f073ab238dc12b1221005eab (diff)
downloademacs-c8d4b74cfa26762d34fd1703a07463008b32be16.tar.gz
emacs-c8d4b74cfa26762d34fd1703a07463008b32be16.zip
upstream
Diffstat (limited to 'src/window.c')
-rw-r--r--src/window.c113
1 files changed, 65 insertions, 48 deletions
diff --git a/src/window.c b/src/window.c
index 078b39cc2f1..b21671b4153 100644
--- a/src/window.c
+++ b/src/window.c
@@ -541,27 +541,34 @@ selected one. */)
541 return decode_window (window)->use_time; 541 return decode_window (window)->use_time;
542} 542}
543 543
544DEFUN ("window-total-size", Fwindow_total_size, Swindow_total_size, 0, 2, 0, 544DEFUN ("window-total-height", Fwindow_total_height, Swindow_total_height, 0, 1, 0,
545 doc: /* Return the total number of lines of window WINDOW. 545 doc: /* Return the total height, in lines, of window WINDOW.
546If WINDOW is omitted or nil, it defaults to the selected window. 546If WINDOW is omitted or nil, it defaults to the selected window.
547 547
548The return value includes WINDOW's mode line and header line, if any. 548The return value includes the mode line and header line, if any.
549If WINDOW is internal, the return value is the sum of the total number 549If WINDOW is an internal window, the total height is the height
550of lines of WINDOW's child windows if these are vertically combined 550of the screen areas spanned by its children.
551and the height of WINDOW's first child otherwise. 551
552 552On a graphical display, this total height is reported as an
553Optional argument HORIZONTAL non-nil means return the total number of 553integer multiple of the default character height. */)
554columns of WINDOW. In this case the return value includes any vertical 554 (Lisp_Object window)
555dividers or scrollbars of WINDOW. If WINDOW is internal, the return
556value is the sum of the total number of columns of WINDOW's child
557windows if they are horizontally combined and the width of WINDOW's
558first child otherwise. */)
559 (Lisp_Object window, Lisp_Object horizontal)
560{ 555{
561 if (NILP (horizontal)) 556 return decode_any_window (window)->total_lines;
562 return decode_any_window (window)->total_lines; 557}
563 else 558
564 return decode_any_window (window)->total_cols; 559DEFUN ("window-total-width", Fwindow_total_width, Swindow_total_width, 0, 1, 0,
560 doc: /* Return the total width, in columns, of window WINDOW.
561If WINDOW is omitted or nil, it defaults to the selected window.
562
563The return value includes any vertical dividers or scroll bars
564belonging to WINDOW. If WINDOW is an internal window, the total width
565is the width of the screen areas spanned by its children.
566
567On a graphical display, this total width is reported as an
568integer multiple of the default character width. */)
569 (Lisp_Object window)
570{
571 return decode_any_window (window)->total_cols;
565} 572}
566 573
567DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0, 574DEFUN ("window-new-total", Fwindow_new_total, Swindow_new_total, 0, 1, 0,
@@ -594,6 +601,10 @@ If WINDOW is omitted or nil, it defaults to the selected window. */)
594 601
595DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0, 602DEFUN ("window-left-column", Fwindow_left_column, Swindow_left_column, 0, 1, 0,
596 doc: /* Return left column of window WINDOW. 603 doc: /* Return left column of window WINDOW.
604This is the distance, in columns, between the left edge of WINDOW and
605the left edge of the frame's window area. For instance, the return
606value is 0 if there is no window to the left of WINDOW.
607
597If WINDOW is omitted or nil, it defaults to the selected window. */) 608If WINDOW is omitted or nil, it defaults to the selected window. */)
598 (Lisp_Object window) 609 (Lisp_Object window)
599{ 610{
@@ -602,6 +613,10 @@ If WINDOW is omitted or nil, it defaults to the selected window. */)
602 613
603DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0, 614DEFUN ("window-top-line", Fwindow_top_line, Swindow_top_line, 0, 1, 0,
604 doc: /* Return top line of window WINDOW. 615 doc: /* Return top line of window WINDOW.
616This is the distance, in lines, between the top of WINDOW and the top
617of the frame's window area. For instance, the return value is 0 if
618there is no window above WINDOW.
619
605If WINDOW is omitted or nil, it defaults to the selected window. */) 620If WINDOW is omitted or nil, it defaults to the selected window. */)
606 (Lisp_Object window) 621 (Lisp_Object window)
607{ 622{
@@ -657,34 +672,34 @@ window_body_cols (struct window *w)
657 return width; 672 return width;
658} 673}
659 674
660DEFUN ("window-body-size", Fwindow_body_size, Swindow_body_size, 0, 2, 0, 675DEFUN ("window-body-height", Fwindow_body_height, Swindow_body_height, 0, 1, 0,
661 doc: /* Return the number of lines or columns of WINDOW's body. 676 doc: /* Return the height, in lines, of WINDOW's text area.
662WINDOW must be a live window and defaults to the selected one. 677If WINDOW is omitted or nil, it defaults to the selected window.
678Signal an error if the window is not live.
663 679
664If the optional argument HORIZONTAL is omitted or nil, the function 680The returned height does not include the mode line or header line.
665returns the number of WINDOW's lines, excluding the mode line and 681On a graphical display, the height is expressed as an integer multiple
666header line, if any. 682of the default character height. If a line at the bottom of the text
667 683area is only partially visible, that counts as a whole line; to
668If HORIZONTAL is non-nil, the function returns the number of columns 684exclude partially-visible lines, use `window-text-height'. */)
669excluding any vertical dividers or scroll bars owned by WINDOW. On a 685 (Lisp_Object window)
670window-system the return value also excludes the number of columns
671used for WINDOW's fringes or display margins.
672
673Note that the return value is measured in canonical units, i.e. for
674the default frame's face. If the window shows some characters with
675non-default face, e.g., if the font of some characters is larger or
676smaller than the default font, the value returned by this function
677will not match the actual number of lines or characters per line
678shown in the window. To get the actual number of columns and lines,
679use `posn-at-point'. */)
680 (Lisp_Object window, Lisp_Object horizontal)
681{ 686{
682 struct window *w = decode_any_window (window); 687 struct window *w = decode_window (window);
688 return make_number (window_body_lines (w));
689}
683 690
684 if (NILP (horizontal)) 691DEFUN ("window-body-width", Fwindow_body_width, Swindow_body_width, 0, 1, 0,
685 return make_number (window_body_lines (w)); 692 doc: /* Return the width, in columns, of WINDOW's text area.
686 else 693If WINDOW is omitted or nil, it defaults to the selected window.
687 return make_number (window_body_cols (w)); 694Signal an error if the window is not live.
695
696The return value does not include any vertical dividers, fringe or
697marginal areas, or scroll bars. On a graphical display, the width is
698expressed as an integer multiple of the default character width. */)
699 (Lisp_Object window)
700{
701 struct window *w = decode_window (window);
702 return make_number (window_body_cols (w));
688} 703}
689 704
690DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0, 705DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0,
@@ -5223,10 +5238,10 @@ and redisplay normally--don't erase and redraw the frame. */)
5223DEFUN ("window-text-height", Fwindow_text_height, Swindow_text_height, 5238DEFUN ("window-text-height", Fwindow_text_height, Swindow_text_height,
5224 0, 1, 0, 5239 0, 1, 0,
5225 doc: /* Return the height in lines of the text display area of WINDOW. 5240 doc: /* Return the height in lines of the text display area of WINDOW.
5226WINDOW defaults to the selected window. 5241If WINDOW is omitted or nil, it defaults to the selected window.
5227 5242
5228The return value does not include the mode line, any header line, nor 5243The returned height does not include the mode line, any header line,
5229any partial-height lines in the text display area. */) 5244nor any partial-height lines at the bottom of the text area. */)
5230 (Lisp_Object window) 5245 (Lisp_Object window)
5231{ 5246{
5232 struct window *w = decode_window (window); 5247 struct window *w = decode_window (window);
@@ -6588,14 +6603,16 @@ function `window-nest' and altered by the function `set-window-nest'. */);
6588 defsubr (&Swindow_use_time); 6603 defsubr (&Swindow_use_time);
6589 defsubr (&Swindow_top_line); 6604 defsubr (&Swindow_top_line);
6590 defsubr (&Swindow_left_column); 6605 defsubr (&Swindow_left_column);
6591 defsubr (&Swindow_total_size); 6606 defsubr (&Swindow_total_height);
6607 defsubr (&Swindow_total_width);
6592 defsubr (&Swindow_normal_size); 6608 defsubr (&Swindow_normal_size);
6593 defsubr (&Swindow_new_total); 6609 defsubr (&Swindow_new_total);
6594 defsubr (&Swindow_new_normal); 6610 defsubr (&Swindow_new_normal);
6595 defsubr (&Sset_window_new_total); 6611 defsubr (&Sset_window_new_total);
6596 defsubr (&Sset_window_new_normal); 6612 defsubr (&Sset_window_new_normal);
6597 defsubr (&Swindow_resize_apply); 6613 defsubr (&Swindow_resize_apply);
6598 defsubr (&Swindow_body_size); 6614 defsubr (&Swindow_body_height);
6615 defsubr (&Swindow_body_width);
6599 defsubr (&Swindow_hscroll); 6616 defsubr (&Swindow_hscroll);
6600 defsubr (&Sset_window_hscroll); 6617 defsubr (&Sset_window_hscroll);
6601 defsubr (&Swindow_redisplay_end_trigger); 6618 defsubr (&Swindow_redisplay_end_trigger);