diff options
| -rw-r--r-- | doc/lispref/display.texi | 29 | ||||
| -rw-r--r-- | doc/lispref/elisp.texi | 9 | ||||
| -rw-r--r-- | doc/lispref/frames.texi | 889 | ||||
| -rw-r--r-- | doc/lispref/windows.texi | 266 |
4 files changed, 787 insertions, 406 deletions
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi index 9e9f8e3ca45..ae59bbbdefa 100644 --- a/doc/lispref/display.texi +++ b/doc/lispref/display.texi | |||
| @@ -1897,9 +1897,9 @@ to or less than the display width of @var{ellipsis}. If | |||
| 1897 | 1897 | ||
| 1898 | The following function returns the size in pixels of text as if it were | 1898 | The following function returns the size in pixels of text as if it were |
| 1899 | displayed in a given window. This function is used by | 1899 | displayed in a given window. This function is used by |
| 1900 | @code{fit-window-to-buffer} (@pxref{Resizing Windows}) and | 1900 | @code{fit-window-to-buffer} and @code{fit-frame-to-buffer} |
| 1901 | @code{fit-frame-to-buffer} (@pxref{Size and Position}) to make a window | 1901 | (@pxref{Resizing Windows}) to make a window exactly as large as the text |
| 1902 | exactly as large as the text it contains. | 1902 | it contains. |
| 1903 | 1903 | ||
| 1904 | @defun window-text-pixel-size &optional window from to x-limit y-limit mode-and-header-line | 1904 | @defun window-text-pixel-size &optional window from to x-limit y-limit mode-and-header-line |
| 1905 | This function returns the size of the text of @var{window}'s buffer in | 1905 | This function returns the size of the text of @var{window}'s buffer in |
| @@ -1952,12 +1952,12 @@ height of both, if present, in the return value. | |||
| 1952 | contents of the line, plus optional additional vertical line spacing | 1952 | contents of the line, plus optional additional vertical line spacing |
| 1953 | above or below the display line. | 1953 | above or below the display line. |
| 1954 | 1954 | ||
| 1955 | The height of the line contents is the maximum height of any | 1955 | The height of the line contents is the maximum height of any character |
| 1956 | character or image on that display line, including the final newline | 1956 | or image on that display line, including the final newline if there is |
| 1957 | if there is one. (A display line that is continued doesn't include a | 1957 | one. (A display line that is continued doesn't include a final |
| 1958 | final newline.) That is the default line height, if you do nothing to | 1958 | newline.) That is the default line height, if you do nothing to specify |
| 1959 | specify a greater height. (In the most common case, this equals the | 1959 | a greater height. (In the most common case, this equals the height of |
| 1960 | height of the default frame font.) | 1960 | the corresponding frame's default font, see @ref{Frame Font}.) |
| 1961 | 1961 | ||
| 1962 | There are several ways to explicitly specify a larger line height, | 1962 | There are several ways to explicitly specify a larger line height, |
| 1963 | either by specifying an absolute height for the display line, or by | 1963 | either by specifying an absolute height for the display line, or by |
| @@ -5406,12 +5406,11 @@ This removes only images that were put into @var{buffer} the way | |||
| 5406 | @cindex size of image | 5406 | @cindex size of image |
| 5407 | This function returns the size of an image as a pair | 5407 | This function returns the size of an image as a pair |
| 5408 | @w{@code{(@var{width} . @var{height})}}. @var{spec} is an image | 5408 | @w{@code{(@var{width} . @var{height})}}. @var{spec} is an image |
| 5409 | specification. @var{pixels} non-@code{nil} means return sizes | 5409 | specification. @var{pixels} non-@code{nil} means return sizes measured |
| 5410 | measured in pixels, otherwise return sizes measured in canonical | 5410 | in pixels, otherwise return sizes measured in the default character size |
| 5411 | character units (fractions of the width/height of the frame's default | 5411 | of @var{frame} (@pxref{Frame Font}). @var{frame} is the frame on which |
| 5412 | font). @var{frame} is the frame on which the image will be displayed. | 5412 | the image will be displayed. @var{frame} null or omitted means use the |
| 5413 | @var{frame} null or omitted means use the selected frame (@pxref{Input | 5413 | selected frame (@pxref{Input Focus}). |
| 5414 | Focus}). | ||
| 5415 | @end defun | 5414 | @end defun |
| 5416 | 5415 | ||
| 5417 | @defvar max-image-size | 5416 | @defvar max-image-size |
diff --git a/doc/lispref/elisp.texi b/doc/lispref/elisp.texi index a32c69c1c2f..9044fbaec56 100644 --- a/doc/lispref/elisp.texi +++ b/doc/lispref/elisp.texi | |||
| @@ -1041,6 +1041,7 @@ Frames | |||
| 1041 | 1041 | ||
| 1042 | * Creating Frames:: Creating additional frames. | 1042 | * Creating Frames:: Creating additional frames. |
| 1043 | * Multiple Terminals:: Displaying on several different devices. | 1043 | * Multiple Terminals:: Displaying on several different devices. |
| 1044 | * Frame Geometry:: Geometric properties of frames. | ||
| 1044 | * Frame Parameters:: Controlling frame size, position, font, etc. | 1045 | * Frame Parameters:: Controlling frame size, position, font, etc. |
| 1045 | * Terminal Parameters:: Parameters common for all frames on terminal. | 1046 | * Terminal Parameters:: Parameters common for all frames on terminal. |
| 1046 | * Frame Titles:: Automatic updating of frame titles. | 1047 | * Frame Titles:: Automatic updating of frame titles. |
| @@ -1064,12 +1065,18 @@ Frames | |||
| 1064 | * Resources:: Getting resource values from the server. | 1065 | * Resources:: Getting resource values from the server. |
| 1065 | * Display Feature Testing:: Determining the features of a terminal. | 1066 | * Display Feature Testing:: Determining the features of a terminal. |
| 1066 | 1067 | ||
| 1068 | Frame Geometry | ||
| 1069 | |||
| 1070 | * Frame Layout:: Basic layout of frames. | ||
| 1071 | * Frame Font:: The default font of a frame and how to set it. | ||
| 1072 | * Size and Position:: Changing the size and position of a frame. | ||
| 1073 | * Implied Frame Resizing:: Implied resizing of frames and how to prevent it. | ||
| 1074 | |||
| 1067 | Frame Parameters | 1075 | Frame Parameters |
| 1068 | 1076 | ||
| 1069 | * Parameter Access:: How to change a frame's parameters. | 1077 | * Parameter Access:: How to change a frame's parameters. |
| 1070 | * Initial Parameters:: Specifying frame parameters when you make a frame. | 1078 | * Initial Parameters:: Specifying frame parameters when you make a frame. |
| 1071 | * Window Frame Parameters:: List of frame parameters for window systems. | 1079 | * Window Frame Parameters:: List of frame parameters for window systems. |
| 1072 | * Size and Position:: Changing the size and position of a frame. | ||
| 1073 | * Geometry:: Parsing geometry specifications. | 1080 | * Geometry:: Parsing geometry specifications. |
| 1074 | 1081 | ||
| 1075 | Window Frame Parameters | 1082 | Window Frame Parameters |
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi index 79b5172ae0b..28e6fbdfef4 100644 --- a/doc/lispref/frames.texi +++ b/doc/lispref/frames.texi | |||
| @@ -80,6 +80,7 @@ for @code{framep} above. | |||
| 80 | @menu | 80 | @menu |
| 81 | * Creating Frames:: Creating additional frames. | 81 | * Creating Frames:: Creating additional frames. |
| 82 | * Multiple Terminals:: Displaying on several different devices. | 82 | * Multiple Terminals:: Displaying on several different devices. |
| 83 | * Frame Geometry:: Geometric properties of frames. | ||
| 83 | * Frame Parameters:: Controlling frame size, position, font, etc. | 84 | * Frame Parameters:: Controlling frame size, position, font, etc. |
| 84 | * Terminal Parameters:: Parameters common for all frames on terminal. | 85 | * Terminal Parameters:: Parameters common for all frames on terminal. |
| 85 | * Frame Titles:: Automatic updating of frame titles. | 86 | * Frame Titles:: Automatic updating of frame titles. |
| @@ -416,6 +417,545 @@ This function returns the attributes of the physical monitor | |||
| 416 | dominating (see above) @var{frame}, which defaults to the selected frame. | 417 | dominating (see above) @var{frame}, which defaults to the selected frame. |
| 417 | @end defun | 418 | @end defun |
| 418 | 419 | ||
| 420 | |||
| 421 | @node Frame Geometry | ||
| 422 | @section Frame Geometry | ||
| 423 | @cindex frame geometry | ||
| 424 | @cindex frame position | ||
| 425 | @cindex position of frame | ||
| 426 | @cindex frame size | ||
| 427 | @cindex size of frame | ||
| 428 | |||
| 429 | The geometry of a frame depends on the toolkit that was used to build | ||
| 430 | this instance of Emacs and the terminal that displays the frame. This | ||
| 431 | chapter describes these dependencies and some of the functions to deal | ||
| 432 | with them. Note that the @var{frame} argument of all of these functions | ||
| 433 | has to specify a live frame (@pxref{Deleting Frames}). If omitted or | ||
| 434 | @code{nil}, it specifies the selected frame (@pxref{Input Focus}). | ||
| 435 | |||
| 436 | @menu | ||
| 437 | * Frame Layout:: Basic layout of frames. | ||
| 438 | * Frame Font:: The default font of a frame and how to set it. | ||
| 439 | * Size and Position:: Changing the size and position of a frame. | ||
| 440 | * Implied Frame Resizing:: Implied resizing of frames and how to prevent it. | ||
| 441 | @end menu | ||
| 442 | |||
| 443 | |||
| 444 | @node Frame Layout | ||
| 445 | @subsection Frame Layout | ||
| 446 | @cindex frame layout | ||
| 447 | @cindex layout of frame | ||
| 448 | |||
| 449 | The drawing below sketches the layout of a frame on a graphical | ||
| 450 | terminal: | ||
| 451 | @smallexample | ||
| 452 | @group | ||
| 453 | |||
| 454 | <------------ Outer Frame Width -----------> | ||
| 455 | ___________________________________________ | ||
| 456 | ^(0) ___________ External Border __________ | | ||
| 457 | | | |_____________ Title Bar ______________| | | ||
| 458 | | | (1)_____________ Menu Bar ______________| | ^ | ||
| 459 | | | (2)_____________ Tool Bar ______________| | ^ | ||
| 460 | | | (3) _________ Internal Border ________ | | ^ | ||
| 461 | | | | | ^ | | | | | ||
| 462 | | | | | | | | | | | ||
| 463 | Outer | | | Inner | | | Native | ||
| 464 | Frame | | | Frame | | | Frame | ||
| 465 | Height | | | Height | | | Height | ||
| 466 | | | | | | | | | | | ||
| 467 | | | | |<--+--- Inner Frame Width ------->| | | | | ||
| 468 | | | | | | | | | | | ||
| 469 | | | | |___v______________________________| | | | | ||
| 470 | | | |___________ Internal Border __________| | v | ||
| 471 | v |______________ External Border _____________| | ||
| 472 | <-------- Native Frame Width --------> | ||
| 473 | |||
| 474 | @end group | ||
| 475 | @end smallexample | ||
| 476 | |||
| 477 | In practice not all of the areas shown in the drawing will or may be | ||
| 478 | present. The meaning of these areas is: | ||
| 479 | |||
| 480 | @table @samp | ||
| 481 | @item Outer Frame | ||
| 482 | @cindex outer frame | ||
| 483 | @cindex outer edges | ||
| 484 | @cindex outer width | ||
| 485 | @cindex outer height | ||
| 486 | The @dfn{outer frame} is a rectangle comprising all areas shown in the | ||
| 487 | drawing. The edges of that rectangle are called the @dfn{outer edges} | ||
| 488 | of the frame. The @dfn{outer width} and @dfn{outer height} of the frame | ||
| 489 | specify the size of that rectangle. | ||
| 490 | |||
| 491 | @cindex outer position | ||
| 492 | The upper left corner of the outer frame (indicated by ``(0)'' in the | ||
| 493 | drawing above) is the @dfn{outer position} or the frame. It is | ||
| 494 | specified by and settable via the @code{left} and @code{top} frame | ||
| 495 | parameters (@pxref{Position Parameters}) as well as the functions | ||
| 496 | @code{frame-position} and @code{set-frame-position} (@pxref{Size and | ||
| 497 | Position}). | ||
| 498 | |||
| 499 | @item External Border | ||
| 500 | @cindex external border | ||
| 501 | The @dfn{external border} is part of the decorations supplied by the | ||
| 502 | window manager. It's typically used for resizing the frame with the | ||
| 503 | mouse. The external border is normally not shown on ``fullboth'' and | ||
| 504 | maximized frames (@pxref{Size Parameters}) and doesn't exist for text | ||
| 505 | terminal frames. | ||
| 506 | |||
| 507 | The external border should not be confused with the @dfn{outer | ||
| 508 | border} specified by the @code{border-width} frame parameter | ||
| 509 | (@pxref{Layout Parameters}). Since the outer border is usually ignored | ||
| 510 | on most platforms it is not covered here. | ||
| 511 | |||
| 512 | @item Title Bar | ||
| 513 | @cindex title bar | ||
| 514 | The @dfn{title bar} is also part of the window manager's decorations and | ||
| 515 | typically displays the title of the frame (@pxref{Frame Titles}) as well | ||
| 516 | as buttons for minimizing, maximizing and deleting the frame. The title | ||
| 517 | bar is usually not displayed on ``fullboth'' (@pxref{Size Parameters}) | ||
| 518 | or tooltip frames. Title bars don't exist for text terminal frames. | ||
| 519 | |||
| 520 | @item Menu Bar | ||
| 521 | @cindex internal menu bar | ||
| 522 | @cindex external menu bar | ||
| 523 | The menu bar (@pxref{Menu Bar}) can be either internal (drawn by Emacs | ||
| 524 | itself) or external (drawn by a toolkit). Most builds (GTK+, Lucid, | ||
| 525 | Motif and Windows) rely on an external menu bar. NS also uses an | ||
| 526 | external menu bar which, however, is not part of the outer frame. | ||
| 527 | Non-toolkit builds can provide an internal menu bar. On text terminal | ||
| 528 | frames, the menu bar is part of the frame's root window (@pxref{Windows | ||
| 529 | and Frames}). | ||
| 530 | |||
| 531 | @item Tool Bar | ||
| 532 | @cindex internal tool bar | ||
| 533 | @cindex external tool bar | ||
| 534 | Like the menu bar, the tool bar (@pxref{Tool Bar}) can be either | ||
| 535 | internal (drawn by Emacs itself) or external (drawn by a toolkit). The | ||
| 536 | GTK+ and NS builds have the tool bar drawn by the toolkit. The | ||
| 537 | remaining builds use internal tool bars. With GTK+ the tool bar can be | ||
| 538 | located on either side of the frame, immediately outside the internal | ||
| 539 | border, see below. | ||
| 540 | |||
| 541 | @item Native Frame | ||
| 542 | @cindex native frame | ||
| 543 | @cindex native edges | ||
| 544 | @cindex native width | ||
| 545 | @cindex native height | ||
| 546 | @cindex display area | ||
| 547 | The @dfn{native frame} is a rectangle located entirely within the outer | ||
| 548 | frame. It excludes the areas occupied by the external border, the title | ||
| 549 | bar and any external menu or external tool bar. The area enclosed by | ||
| 550 | the native frame is sometimes also referred to as the @dfn{display area} | ||
| 551 | of the frame. The edges of the native frame are called the @dfn{native | ||
| 552 | edges} of the frame. The @dfn{native width} and @dfn{native height} of | ||
| 553 | the frame specify the size of the rectangle. | ||
| 554 | |||
| 555 | @cindex native position | ||
| 556 | The top left corner of the native frame specifies the @dfn{native | ||
| 557 | position} of the frame. (1)--(3) in the drawing above indicate that | ||
| 558 | position for the various builds: | ||
| 559 | |||
| 560 | @itemize @w | ||
| 561 | @item (1) non-toolkit and terminal frames | ||
| 562 | |||
| 563 | @item (2) Lucid, Motif and Windows frames | ||
| 564 | |||
| 565 | @item (3) GTK+ and NS frames | ||
| 566 | @end itemize | ||
| 567 | |||
| 568 | Accordingly, the native height of a frame includes the height of the | ||
| 569 | tool bar but not that of the menu bar (Lucid, Motif, Windows) or those | ||
| 570 | of the menu bar and the tool bar (non-toolkit and text terminal frames). | ||
| 571 | |||
| 572 | The native position of a frame is the reference position of functions | ||
| 573 | that set or return the current position of the mouse (@pxref{Mouse | ||
| 574 | Position}) and for functions dealing with the position of windows like | ||
| 575 | @code{window-edges}, @code{window-at} or @code{coordinates-in-window-p} | ||
| 576 | (@pxref{Coordinates and Windows}). | ||
| 577 | |||
| 578 | @item Internal Border | ||
| 579 | The internal border (@pxref{Layout Parameters}) is a border drawn by | ||
| 580 | Emacs around the inner frame (see below). | ||
| 581 | |||
| 582 | @item Inner Frame | ||
| 583 | @cindex inner frame | ||
| 584 | @cindex inner edges | ||
| 585 | @cindex inner width | ||
| 586 | @cindex inner height | ||
| 587 | The @dfn{inner frame} is the rectangle reserved for the frame's windows. | ||
| 588 | It's enclosed by the internal border which, however, is not part of the | ||
| 589 | inner frame. Its edges are called the @dfn{inner edges} of the frame. | ||
| 590 | The @dfn{inner width} and @dfn{inner height} specify the size of the | ||
| 591 | rectangle. | ||
| 592 | |||
| 593 | @cindex non-minibuffer frame | ||
| 594 | @cindex minibuffer-only frame | ||
| 595 | As a rule, the inner frame is subdivided into the frame's root window | ||
| 596 | (@pxref{Windows and Frames}) and the frame's minibuffer window | ||
| 597 | (@pxref{Minibuffer Windows}). There are two notable exceptions to this | ||
| 598 | rule: A @dfn{non-minibuffer frame} contains a root window only and does | ||
| 599 | not contain a minibuffer window. A @dfn{minibuffer-only frame} contains | ||
| 600 | only a minibuffer window which also serves as that frame's root window. | ||
| 601 | See @ref{Initial Parameters} for how to create such frame | ||
| 602 | configurations. | ||
| 603 | |||
| 604 | @item Text Area | ||
| 605 | @cindex text area | ||
| 606 | The @dfn{text area} of a frame is a somewhat fictitious area located | ||
| 607 | entirely within the native frame. It can be obtained by removing from | ||
| 608 | the native frame any internal borders, one vertical and one horizontal | ||
| 609 | scroll bar, and one left and one right fringe as specified for this | ||
| 610 | frame, see @ref{Layout Parameters}. | ||
| 611 | @end table | ||
| 612 | |||
| 613 | @cindex absolute position | ||
| 614 | The @dfn{absolute position} of a frame or its edges is usually given in | ||
| 615 | terms of pixels counted from an origin at position (0, 0) of the frame's | ||
| 616 | display. Note that with multiple monitors the origin does not | ||
| 617 | necessarily coincide with the top left corner of the entire usable | ||
| 618 | display area. Hence the absolute outer position of a frame or the | ||
| 619 | absolute positions of the edges of the outer, native or inner frame can | ||
| 620 | be negative in such an environment even when that frame is completely | ||
| 621 | visible. | ||
| 622 | |||
| 623 | For a frame on a graphical terminal the following function returns the | ||
| 624 | sizes of the areas described above: | ||
| 625 | |||
| 626 | @defun x-frame-geometry &optional frame | ||
| 627 | This function returns geometric attributes of @var{frame}. The return | ||
| 628 | value is an association list of the attributes listed below. All | ||
| 629 | coordinate, height and width values are integers counting pixels. | ||
| 630 | |||
| 631 | @table @code | ||
| 632 | @item outer-position | ||
| 633 | A cons of the absolute X- and Y-coordinates of the outer position of | ||
| 634 | @var{frame}, relative to the origin at position (0, 0) of @var{frame}'s | ||
| 635 | display. | ||
| 636 | |||
| 637 | @item outer-size | ||
| 638 | A cons of the outer width and height of @var{frame}. | ||
| 639 | |||
| 640 | @item external-border-size | ||
| 641 | A cons of the horizontal and vertical width of @var{frame}'s external | ||
| 642 | borders as supplied by the window manager. If the window manager | ||
| 643 | doesn't supply these values, Emacs will try to guess them from the | ||
| 644 | coordinates of the outer and inner frame. | ||
| 645 | |||
| 646 | @item title-bar-size | ||
| 647 | A cons of the width and height of the title bar of @var{frame} as | ||
| 648 | supplied by the window manager or operating system. If both of them are | ||
| 649 | zero, the frame has no title bar. If only the width is zero, Emacs was | ||
| 650 | not able to retrieve the width information. | ||
| 651 | |||
| 652 | @item menu-bar-external | ||
| 653 | If non-@code{nil}, this means the menu bar is external (not part of the | ||
| 654 | native frame of @var{frame}). | ||
| 655 | |||
| 656 | @item menu-bar-size | ||
| 657 | A cons of the width and height of the menu bar of @var{frame}. | ||
| 658 | |||
| 659 | @item tool-bar-external | ||
| 660 | If non-@code{nil}, this means the tool bar is external (not part of the | ||
| 661 | native frame of @var{frame}). | ||
| 662 | |||
| 663 | @item tool-bar-position | ||
| 664 | This tells on which side the tool bar on @var{frame} is and can be one | ||
| 665 | of @code{left}, @code{top}, @code{right} or @code{bottom}. The only | ||
| 666 | toolkit that currently supports a value other than @code{top} is GTK+. | ||
| 667 | |||
| 668 | @item tool-bar-size | ||
| 669 | A cons of the width and height of the tool bar of @var{frame}. | ||
| 670 | |||
| 671 | @item internal-border-width | ||
| 672 | The width of the internal border of @var{frame}. | ||
| 673 | @end table | ||
| 674 | @end defun | ||
| 675 | |||
| 676 | The following function can be used to retrieve the edges of the outer, | ||
| 677 | native and inner frame. | ||
| 678 | |||
| 679 | @defun frame-edges &optional frame type | ||
| 680 | This function returns the edges of the outer, native or inner frame of | ||
| 681 | @var{frame}. @var{frame} must be a live frame and defaults to the | ||
| 682 | selected one. The list returned has the form (@var{left} @var{top} | ||
| 683 | @var{right} @var{bottom}) where all values are in pixels relative to the | ||
| 684 | position (0, 0) of @var{frame}'s display. For terminal frames | ||
| 685 | @var{left} and @var{top} are both zero. | ||
| 686 | |||
| 687 | Optional argument @var{type} specifies the type of the edges to return: | ||
| 688 | @var{type} @code{outer-edges} means to return the outer edges of | ||
| 689 | @var{frame}, @code{native-edges} (or @code{nil}) means to return its | ||
| 690 | native edges and @code{inner-edges} means to return its inner edges. | ||
| 691 | |||
| 692 | Notice that the ``pixels at the positions'' @var{bottom} and @var{right} | ||
| 693 | lie immediately outside the corresponding frame. This means that if you | ||
| 694 | have, for example, two side-by-side frames positioned such that the | ||
| 695 | right outer edge of the frame on the left equals the left outer edge of | ||
| 696 | the frame on the right, the pixels ``representing'' that edge are part | ||
| 697 | of the frame on the right. | ||
| 698 | @end defun | ||
| 699 | |||
| 700 | |||
| 701 | @node Frame Font | ||
| 702 | @subsection Frame Font | ||
| 703 | @cindex default font | ||
| 704 | @cindex default character size | ||
| 705 | @cindex default character width | ||
| 706 | @cindex default width of character | ||
| 707 | @cindex default character height | ||
| 708 | @cindex default height of character | ||
| 709 | Each frame has a @dfn{default font} which specifies the default | ||
| 710 | character size for that frame. This size is meant when retrieving or | ||
| 711 | changing the size of a frame in terms of ``columns'' or ``lines'' | ||
| 712 | (@pxref{Size Parameters}). It is also used when resizing (@pxref{Window | ||
| 713 | Sizes}) or splitting (@pxref{Splitting Windows}) windows. | ||
| 714 | |||
| 715 | @cindex line height | ||
| 716 | @cindex column width | ||
| 717 | The term @dfn{line height} is sometimes used instead of ``default | ||
| 718 | character height''. Similarly, the term @dfn{column width} is used as | ||
| 719 | shorthand for ``default character width''. | ||
| 720 | |||
| 721 | @defun frame-char-height &optional frame | ||
| 722 | @defunx frame-char-width &optional frame | ||
| 723 | These functions return the default height and width of a character in | ||
| 724 | @var{frame}, measured in pixels. Together, these values establish the | ||
| 725 | size of the default font on @var{frame}. The values depend on the | ||
| 726 | choice of font for @var{frame}, see @ref{Font and Color Parameters}. | ||
| 727 | @end defun | ||
| 728 | |||
| 729 | The default font can be also set directly with the following function: | ||
| 730 | |||
| 731 | @deffn Command set-frame-font font &optional keep-size frames | ||
| 732 | This sets the default font to @var{font}. When called interactively, it | ||
| 733 | prompts for the name of a font, and uses that font on the selected | ||
| 734 | frame. When called from Lisp, @var{font} should be a font name (a | ||
| 735 | string), a font object, font entity, or a font spec. | ||
| 736 | |||
| 737 | If the optional argument @var{keep-size} is @code{nil}, this keeps the | ||
| 738 | number of frame lines and columns fixed. (If non-@code{nil}, the option | ||
| 739 | @code{frame-inhibit-implied-resize} described in the next section will | ||
| 740 | override this.) If @var{keep-size} is non-@code{nil} (or with a prefix | ||
| 741 | argument), it tries to keep the size of the display area of the current | ||
| 742 | frame fixed by adjusting the number of lines and columns. | ||
| 743 | |||
| 744 | If the optional argument @var{frames} is @code{nil}, this applies the | ||
| 745 | font to the selected frame only. If @var{frames} is non-@code{nil}, it | ||
| 746 | should be a list of frames to act upon, or @code{t} meaning all existing | ||
| 747 | graphical frames. | ||
| 748 | @end deffn | ||
| 749 | |||
| 750 | |||
| 751 | @node Size and Position | ||
| 752 | @subsection Size and Position | ||
| 753 | @cindex frame size | ||
| 754 | @cindex frame position | ||
| 755 | @cindex position of frame | ||
| 756 | |||
| 757 | You can read or change the position of a frame using the frame | ||
| 758 | parameters @code{left} and @code{top} (@pxref{Position Parameters}) and | ||
| 759 | its size using the @code{height} and @code{width} parameters | ||
| 760 | (@pxref{Size Parameters}). Here are some special features for working | ||
| 761 | with sizes and positions. For all of these functions the argument | ||
| 762 | @var{frame} must denote a live frame and defaults to the selected frame. | ||
| 763 | |||
| 764 | @defun frame-position &optional Lisp_Object &optional frame | ||
| 765 | This function returns the outer position (@pxref{Frame Layout}) of | ||
| 766 | @var{frame} in pixels. The value is a cons giving the coordinates of | ||
| 767 | the top left corner of the outer frame of @var{frame} relative to an | ||
| 768 | origin at the position (0, 0) of the frame's display. On a text | ||
| 769 | terminal frame both values are zero. | ||
| 770 | @end defun | ||
| 771 | |||
| 772 | @defun set-frame-position frame X Y | ||
| 773 | This function sets the outer frame position of @var{frame} to @var{X} | ||
| 774 | and @var{Y}. The latter arguments specify pixels and normally count | ||
| 775 | from an origin at the position (0, 0) of @var{frame}'s display. | ||
| 776 | |||
| 777 | A negative parameter value positions the right edge of the outer frame | ||
| 778 | by @var{-x} pixels left from the right edge of the screen or the bottom | ||
| 779 | edge by @var{-y} pixels up from the bottom edge of the screen. | ||
| 780 | |||
| 781 | This function has no effect on text terminal frames. | ||
| 782 | @end defun | ||
| 783 | |||
| 784 | @defun frame-pixel-height &optional frame | ||
| 785 | @defunx frame-pixel-width &optional frame | ||
| 786 | These functions return the inner height and width (the height and | ||
| 787 | width of the display area, see @ref{Frame Layout}) of @var{frame} in | ||
| 788 | pixels. For a text terminal, the results are in characters rather than | ||
| 789 | pixels. | ||
| 790 | @end defun | ||
| 791 | |||
| 792 | @defun frame-text-height &optional frame | ||
| 793 | @defunx frame-text-width &optional frame | ||
| 794 | These functions return the height and width of the text area of | ||
| 795 | @var{frame} (@pxref{Frame Layout}), measured in pixels. For a text | ||
| 796 | terminal, the results are in characters rather than pixels. | ||
| 797 | |||
| 798 | The value returned by @code{frame-text-height} differs from that | ||
| 799 | returned by @code{frame-pixel-height} by not including the heights of | ||
| 800 | any internal tool bar or menu bar, the height of one horizontal scroll | ||
| 801 | bar and the widths of the internal border. | ||
| 802 | |||
| 803 | The value returned by @code{frame-text-width} differs from that returned | ||
| 804 | by @code{frame-pixel-width} by not including the width of one vertical | ||
| 805 | scroll bar, the widths of one left and one right fringe and the widths | ||
| 806 | of the internal border. | ||
| 807 | @end defun | ||
| 808 | |||
| 809 | @defun frame-height &optional frame | ||
| 810 | @defunx frame-width &optional frame | ||
| 811 | These functions return the height and width of the text area of | ||
| 812 | @var{frame}, measured in units of the default font height and width of | ||
| 813 | @var{frame} (@pxref{Frame Font}). These functions are plain shorthands | ||
| 814 | for writing @code{(frame-parameter frame 'height)} and | ||
| 815 | @code{(frame-parameter frame 'width)}. | ||
| 816 | |||
| 817 | If the text area of @var{frame} measured in pixels is not a multiple of | ||
| 818 | its default font size, the values returned by these functions are | ||
| 819 | rounded down to the number of characters of the default font that fully | ||
| 820 | fit into the text area. | ||
| 821 | @end defun | ||
| 822 | |||
| 823 | @defopt frame-resize-pixelwise | ||
| 824 | If this option is @code{nil}, a frame's size is usually rounded to a | ||
| 825 | multiple of the current values of that frame's @code{frame-char-height} | ||
| 826 | and @code{frame-char-width} whenever the frame is resized. If this is | ||
| 827 | non-@code{nil}, no rounding occurs, hence frame sizes can | ||
| 828 | increase/decrease by one pixel. | ||
| 829 | |||
| 830 | Setting this variable usually causes the next resize operation to pass | ||
| 831 | the corresponding size hints to the window manager. This means that | ||
| 832 | this variable should be set only in a user's initial file; applications | ||
| 833 | should never bind it temporarily. | ||
| 834 | |||
| 835 | The precise meaning of a value of @code{nil} for this option depends on | ||
| 836 | the toolkit used. Dragging the external border with the mouse is done | ||
| 837 | character-wise provided the window manager is willing to process the | ||
| 838 | corresponding size hints. Calling @code{set-frame-size} (see below) | ||
| 839 | with arguments that do not specify the frame size as an integer multiple | ||
| 840 | of its character size, however, may: be ignored, cause a rounding | ||
| 841 | (GTK+), or be accepted (Lucid, Motif, MS-Windows). | ||
| 842 | |||
| 843 | With some window managers you may have to set this to non-@code{nil} in | ||
| 844 | order to make a frame appear truly ``maximized'' or ``fullscreen''. | ||
| 845 | @end defopt | ||
| 846 | |||
| 847 | @defun set-frame-size frame width height pixelwise | ||
| 848 | This function sets the size of the text area of @var{frame}, measured in | ||
| 849 | terms of the canonical height and width of a character on @var{frame} | ||
| 850 | (@pxref{Frame Font}). | ||
| 851 | |||
| 852 | The optional argument @var{pixelwise} non-@code{nil} means to measure | ||
| 853 | the new width and height in units of pixels instead. Note that if | ||
| 854 | @code{frame-resize-pixelwise} is @code{nil}, some toolkits may refuse to | ||
| 855 | fully honor the request if it does not increase/decrease the frame size | ||
| 856 | to a multiple of its character size. | ||
| 857 | @end defun | ||
| 858 | |||
| 859 | @defun set-frame-height frame height &optional pretend pixelwise | ||
| 860 | This function resizes the text area of @var{frame} to a height of | ||
| 861 | @var{height} lines. The sizes of existing windows in @var{frame} are | ||
| 862 | altered proportionally to fit. | ||
| 863 | |||
| 864 | If @var{pretend} is non-@code{nil}, then Emacs displays @var{height} | ||
| 865 | lines of output in @var{frame}, but does not change its value for the | ||
| 866 | actual height of the frame. This is only useful on text terminals. | ||
| 867 | Using a smaller height than the terminal actually implements may be | ||
| 868 | useful to reproduce behavior observed on a smaller screen, or if the | ||
| 869 | terminal malfunctions when using its whole screen. Setting the frame | ||
| 870 | height ``for real'' does not always work, because knowing the correct | ||
| 871 | actual size may be necessary for correct cursor positioning on | ||
| 872 | text terminals. | ||
| 873 | |||
| 874 | The optional fourth argument @var{pixelwise} non-@code{nil} means that | ||
| 875 | @var{frame} should be @var{height} pixels high. Note that if | ||
| 876 | @code{frame-resize-pixelwise} is @code{nil}, some toolkits may refuse to | ||
| 877 | fully honor the request if it does not increase/decrease the frame | ||
| 878 | height to a multiple of its character height. | ||
| 879 | @end defun | ||
| 880 | |||
| 881 | @defun set-frame-width frame width &optional pretend pixelwise | ||
| 882 | This function sets the width of the text area of @var{frame}, measured | ||
| 883 | in characters. The argument @var{pretend} has the same meaning as in | ||
| 884 | @code{set-frame-height}. | ||
| 885 | |||
| 886 | The optional fourth argument @var{pixelwise} non-@code{nil} means that | ||
| 887 | @var{frame} should be @var{width} pixels wide. Note that if | ||
| 888 | @code{frame-resize-pixelwise} is @code{nil}, some toolkits may refuse to | ||
| 889 | fully honor the request if it does not increase/decrease the frame width | ||
| 890 | to a multiple of its character width. | ||
| 891 | @end defun | ||
| 892 | |||
| 893 | None of these three functions will make a frame smaller than needed to | ||
| 894 | display all of its windows together with their scroll bars, fringes, | ||
| 895 | margins, dividers, mode and header lines. This contrasts with requests | ||
| 896 | by the window manager triggered, for example, by dragging the external | ||
| 897 | border of a frame with the mouse. Such requests are always honored by | ||
| 898 | clipping, if necessary, portions that cannot be displayed at the right, | ||
| 899 | bottom corner of the frame. | ||
| 900 | |||
| 901 | |||
| 902 | @node Implied Frame Resizing | ||
| 903 | @subsection Implied Frame Resizing | ||
| 904 | @cindex implied frame resizing | ||
| 905 | @cindex implied resizing of frame | ||
| 906 | |||
| 907 | By default, Emacs tries to keep the number of lines and columns of a | ||
| 908 | frame's text area unaltered when, for example, adding or removing the | ||
| 909 | menu bar, changing the default font or setting the width of the frame's | ||
| 910 | scroll bars. This means, however, that in such case Emacs must ask the | ||
| 911 | window manager to resize the outer frame in order to accommodate the | ||
| 912 | size change. Note that wrapping a menu or tool bar usually does not | ||
| 913 | resize the frame's outer size, hence this will alter the number of | ||
| 914 | displayed lines. | ||
| 915 | |||
| 916 | Occasionally, such @dfn{implied frame resizing} may be unwanted, for | ||
| 917 | example, when the frame is maximized or made fullscreen (where it's | ||
| 918 | turned off by default). In other cases you can disable implied resizing | ||
| 919 | with the following option: | ||
| 920 | |||
| 921 | @defopt frame-inhibit-implied-resize | ||
| 922 | If this option is @code{nil}, changing font, menu bar, tool bar, | ||
| 923 | internal borders, fringes or scroll bars of a specific frame may | ||
| 924 | implicitly resize the frame's display area in order to preserve the | ||
| 925 | number of columns or lines the frame displays. If this option is | ||
| 926 | non-@code{nil}, no implied resizing is done. | ||
| 927 | |||
| 928 | The value of this option can be also be a list of frame parameters. In | ||
| 929 | that case, implied resizing is inhibited when changing a parameter that | ||
| 930 | appears in this list. The frame parameters currently handled by this | ||
| 931 | option are: @code{font}, @code{font-backend}, | ||
| 932 | @code{internal-border-width}, @code{menu-bar-lines} and | ||
| 933 | @code{tool-bar-lines}. | ||
| 934 | |||
| 935 | Changing any of the @code{scroll-bar-width}, @code{scroll-bar-height}, | ||
| 936 | @code{vertical-scroll-bars}, @code{horizontal-scroll-bars}, | ||
| 937 | @code{left-fringe} and @code{right-fringe} frame parameters is handled | ||
| 938 | as if the frame contained just one live window. This means, for | ||
| 939 | example, that removing vertical scroll bars on a frame containing | ||
| 940 | several side by side windows will shrink the outer frame width by the | ||
| 941 | width of one scroll bar provided this option is @code{nil} and keep it | ||
| 942 | unchanged if this option is either @code{t} or a list containing | ||
| 943 | @code{vertical-scroll-bars}. | ||
| 944 | |||
| 945 | The default value is @code{'(tool-bar-lines)} for Lucid, Motif and | ||
| 946 | Windows (which means that adding/removing a tool bar there does not | ||
| 947 | change the outer frame height), @code{nil} on all other window systems | ||
| 948 | including GTK+ (which means that changing any of the parameters listed | ||
| 949 | above may change the size of the outer frame), and @code{t} otherwise | ||
| 950 | (which means the outer frame size never changes implicitly when there's | ||
| 951 | no window system support). | ||
| 952 | |||
| 953 | Note that when a frame is not large enough to accommodate a change of | ||
| 954 | any of the parameters listed above, Emacs may try to enlarge the frame | ||
| 955 | even if this option is non-@code{nil}. | ||
| 956 | @end defopt | ||
| 957 | |||
| 958 | |||
| 419 | @node Frame Parameters | 959 | @node Frame Parameters |
| 420 | @section Frame Parameters | 960 | @section Frame Parameters |
| 421 | @cindex frame parameters | 961 | @cindex frame parameters |
| @@ -438,7 +978,6 @@ frame transparency, the parameter @code{alpha} is also meaningful. | |||
| 438 | * Parameter Access:: How to change a frame's parameters. | 978 | * Parameter Access:: How to change a frame's parameters. |
| 439 | * Initial Parameters:: Specifying frame parameters when you make a frame. | 979 | * Initial Parameters:: Specifying frame parameters when you make a frame. |
| 440 | * Window Frame Parameters:: List of frame parameters for window systems. | 980 | * Window Frame Parameters:: List of frame parameters for window systems. |
| 441 | * Size and Position:: Changing the size and position of a frame. | ||
| 442 | * Geometry:: Parsing geometry specifications. | 981 | * Geometry:: Parsing geometry specifications. |
| 443 | @end menu | 982 | @end menu |
| 444 | 983 | ||
| @@ -723,12 +1262,12 @@ pixel sizes of these character units (@pxref{Face Attributes}). | |||
| 723 | @table @code | 1262 | @table @code |
| 724 | @vindex height, a frame parameter | 1263 | @vindex height, a frame parameter |
| 725 | @item height | 1264 | @item height |
| 726 | The height of the frame's text area (@pxref{Size and Position}), in | 1265 | The height of the frame's text area (@pxref{Frame Geometry}), in |
| 727 | characters. | 1266 | characters. |
| 728 | 1267 | ||
| 729 | @vindex width, a frame parameter | 1268 | @vindex width, a frame parameter |
| 730 | @item width | 1269 | @item width |
| 731 | The width of the frame's text area (@pxref{Size and Position}), in | 1270 | The width of the frame's text area (@pxref{Frame Geometry}), in |
| 732 | characters. | 1271 | characters. |
| 733 | 1272 | ||
| 734 | @vindex user-size, a frame parameter | 1273 | @vindex user-size, a frame parameter |
| @@ -1183,309 +1722,6 @@ equivalent to the @code{:background} attribute of the | |||
| 1183 | @end table | 1722 | @end table |
| 1184 | 1723 | ||
| 1185 | 1724 | ||
| 1186 | @node Size and Position | ||
| 1187 | @subsection Frame Size and Position | ||
| 1188 | @cindex size of frame | ||
| 1189 | @cindex screen size | ||
| 1190 | @cindex frame size | ||
| 1191 | @cindex resize frame | ||
| 1192 | |||
| 1193 | You can read or change the size and position of a frame using the frame | ||
| 1194 | parameters @code{left}, @code{top}, @code{height}, and @code{width}. | ||
| 1195 | Whatever geometry parameters you don't specify are chosen by the window | ||
| 1196 | manager in its usual fashion. | ||
| 1197 | |||
| 1198 | Here are some special features for working with sizes and positions. | ||
| 1199 | Most of the functions described below use a @var{frame} argument which | ||
| 1200 | has to specify a live frame. If omitted or @code{nil}, it specifies the | ||
| 1201 | selected frame, see @ref{Input Focus}. | ||
| 1202 | |||
| 1203 | @defun set-frame-position frame left top | ||
| 1204 | This function sets the position of the top left corner of @var{frame} to | ||
| 1205 | @var{left} and @var{top}. These arguments are measured in pixels, and | ||
| 1206 | normally count from the top left corner of the screen to the top left | ||
| 1207 | corner of the rectangle allotted to the frame by the window manager. | ||
| 1208 | |||
| 1209 | Negative parameter values position the bottom edge of that rectangle up | ||
| 1210 | from the bottom edge of the screen, or the right rectangle edge to the | ||
| 1211 | left of the right edge of the screen. It would probably be better if | ||
| 1212 | the values were always counted from the left and top, so that negative | ||
| 1213 | arguments would position the frame partly off the top or left edge of | ||
| 1214 | the screen, but it seems inadvisable to change that now. | ||
| 1215 | @end defun | ||
| 1216 | |||
| 1217 | @cindex frame default font | ||
| 1218 | @cindex default font of a frame | ||
| 1219 | Each frame has a @dfn{default font} which specifies the canonical height | ||
| 1220 | and width of a character on that frame. The default font is used when | ||
| 1221 | retrieving or changing the size of a frame in terms of columns or lines. | ||
| 1222 | It is also used when resizing (@pxref{Window Sizes}) or splitting | ||
| 1223 | (@pxref{Splitting Windows}) windows. | ||
| 1224 | |||
| 1225 | @defun frame-char-height &optional frame | ||
| 1226 | @defunx frame-char-width &optional frame | ||
| 1227 | These functions return the canonical height and width of a character in | ||
| 1228 | @var{frame}, measured in pixels. Together, these values establish the | ||
| 1229 | size of the default font on @var{frame}. The values depend on the | ||
| 1230 | choice of font for @var{frame}, see @ref{Font and Color Parameters}. | ||
| 1231 | @end defun | ||
| 1232 | |||
| 1233 | The default font can be also set directly with the following function: | ||
| 1234 | |||
| 1235 | @deffn Command set-frame-font font &optional keep-size frames | ||
| 1236 | This sets the default font to @var{font}. When called interactively, it | ||
| 1237 | prompts for the name of a font, and uses that font on the selected | ||
| 1238 | frame. When called from Lisp, @var{font} should be a font name (a | ||
| 1239 | string), a font object, font entity, or a font spec. | ||
| 1240 | |||
| 1241 | If the optional argument @var{keep-size} is @code{nil}, this keeps the | ||
| 1242 | number of frame lines and columns fixed. (If non-@code{nil}, the option | ||
| 1243 | @code{frame-inhibit-implied-resize} described below will override this.) | ||
| 1244 | If @var{keep-size} is non-@code{nil} (or with a prefix argument), it | ||
| 1245 | tries to keep the size of the display area of the current frame fixed by | ||
| 1246 | adjusting the number of lines and columns. | ||
| 1247 | |||
| 1248 | If the optional argument @var{frames} is @code{nil}, this applies the | ||
| 1249 | font to the selected frame only. If @var{frames} is non-@code{nil}, it | ||
| 1250 | should be a list of frames to act upon, or @code{t} meaning all existing | ||
| 1251 | graphical frames. | ||
| 1252 | @end deffn | ||
| 1253 | |||
| 1254 | @cindex frame display area | ||
| 1255 | @cindex display area of a frame | ||
| 1256 | The @dfn{display area} of a frame is a rectangular area within the area | ||
| 1257 | allotted to the frame by the window manager. The display area neither | ||
| 1258 | includes the title bar (@pxref{Frame Titles}) nor any other decorations | ||
| 1259 | provided by the window manager (like an external border used for | ||
| 1260 | resizing frames via mouse dragging). | ||
| 1261 | |||
| 1262 | The actual height of the display area depends on the window-system | ||
| 1263 | and toolkit in use. With GTK+, the display area does not include any | ||
| 1264 | tool bar or menu bar. With the Motif or Lucid toolkits and with | ||
| 1265 | Windows, the display area includes the tool bar but not the menu bar. | ||
| 1266 | In a graphical version with no toolkit, it includes both the tool bar | ||
| 1267 | and menu bar. On a text terminal, the display area includes the menu | ||
| 1268 | bar. | ||
| 1269 | |||
| 1270 | @defun frame-pixel-height &optional frame | ||
| 1271 | @defunx frame-pixel-width &optional frame | ||
| 1272 | These functions return the height and width of the display area of | ||
| 1273 | @var{frame}, measured in pixels. For a text terminal, the results are | ||
| 1274 | in characters rather than pixels. | ||
| 1275 | @end defun | ||
| 1276 | |||
| 1277 | @cindex frame text area | ||
| 1278 | @cindex text area of a frame | ||
| 1279 | The @dfn{text area} of a frame is a concept implicitly used by all | ||
| 1280 | functions that change a frame's height or width. It is a rectangle | ||
| 1281 | located within the display area. Its size is obtained from that of the | ||
| 1282 | display area by subtracting the sizes of any tool or menu bars that are | ||
| 1283 | part of the display area, any internal borders, one vertical and one | ||
| 1284 | horizontal scroll bar, and one left and one right fringe as specified | ||
| 1285 | for this frame, see @ref{Layout Parameters}. | ||
| 1286 | |||
| 1287 | @defun frame-text-height &optional frame | ||
| 1288 | @defunx frame-text-width &optional frame | ||
| 1289 | These functions return the height and width of the text area of | ||
| 1290 | @var{frame}, measured in pixels. For a text terminal, the results are | ||
| 1291 | in characters rather than pixels. | ||
| 1292 | |||
| 1293 | The value returned by @code{frame-text-height} differs from that | ||
| 1294 | returned by @code{frame-pixel-height} by not including the heights of | ||
| 1295 | any tool bar or menu bar, the height of one horizontal scroll bar and | ||
| 1296 | the widths of the internal border. | ||
| 1297 | |||
| 1298 | The value returned by @code{frame-text-width} differs from that returned | ||
| 1299 | by @code{frame-pixel-width} by not including the width of one vertical | ||
| 1300 | scroll bar, the widths of one left and one right fringe and the widths | ||
| 1301 | of the internal border. | ||
| 1302 | @end defun | ||
| 1303 | |||
| 1304 | @defun frame-height &optional frame | ||
| 1305 | @defunx frame-width &optional frame | ||
| 1306 | These functions return the height and width of the text area of | ||
| 1307 | @var{frame}, measured in units of the default font height and width of | ||
| 1308 | @var{frame}. These functions are plain shorthands for writing | ||
| 1309 | @code{(frame-parameter frame 'height)} and @code{(frame-parameter frame | ||
| 1310 | 'width)}. | ||
| 1311 | |||
| 1312 | If the text area of @var{frame} measured in pixles is not a multiple of | ||
| 1313 | its default font size, the values returned by this functions are rounded | ||
| 1314 | down to the number of characters of the default font that fully fit into | ||
| 1315 | the text area. | ||
| 1316 | @end defun | ||
| 1317 | |||
| 1318 | @defopt frame-resize-pixelwise | ||
| 1319 | If this option is @code{nil}, a frame's size is usually rounded to a | ||
| 1320 | multiple of the current values of that frame's @code{frame-char-height} | ||
| 1321 | and @code{frame-char-width}. If this is non-@code{nil}, no rounding | ||
| 1322 | occurs, hence frame sizes can increase/decrease by one pixel. | ||
| 1323 | |||
| 1324 | Setting this causes the next resize operation to pass the corresponding | ||
| 1325 | size hints to the window manager. This means that this variable should | ||
| 1326 | be set only in a user's initial file; applications should never bind it | ||
| 1327 | temporarily. | ||
| 1328 | |||
| 1329 | The precise meaning of a value of @code{nil} for this option depends | ||
| 1330 | on the toolkit used. Dragging the frame border with the mouse is usually | ||
| 1331 | done character-wise. Calling @code{set-frame-size} (see below) | ||
| 1332 | with arguments that do not specify the frame size as an integer multiple | ||
| 1333 | of its character size, however, may: be ignored, cause a | ||
| 1334 | rounding (GTK+), or be accepted (Lucid, Motif, MS-Windows). | ||
| 1335 | |||
| 1336 | With some window managers you may have to set this to non-@code{nil} in | ||
| 1337 | order to make a frame appear truly ``maximized'' or ``fullscreen''. | ||
| 1338 | @end defopt | ||
| 1339 | |||
| 1340 | @defun set-frame-size frame width height pixelwise | ||
| 1341 | This function sets the size of the text area of @var{frame}, measured in | ||
| 1342 | characters; @var{width} and @var{height} specify the new width in | ||
| 1343 | columns and the new height in lines. | ||
| 1344 | |||
| 1345 | The optional argument @var{pixelwise} non-@code{nil} means to measure | ||
| 1346 | the new width and height in units of pixels instead. Note that if | ||
| 1347 | @code{frame-resize-pixelwise} is @code{nil}, some toolkits may refuse to | ||
| 1348 | fully honor the request if it does not increase/decrease the frame size | ||
| 1349 | to a multiple of its character size. | ||
| 1350 | @end defun | ||
| 1351 | |||
| 1352 | @defun set-frame-height frame height &optional pretend pixelwise | ||
| 1353 | This function resizes the text area of @var{frame} to a height of | ||
| 1354 | @var{height} lines. The sizes of existing windows in @var{frame} are | ||
| 1355 | altered proportionally to fit. | ||
| 1356 | |||
| 1357 | If @var{pretend} is non-@code{nil}, then Emacs displays @var{height} | ||
| 1358 | lines of output in @var{frame}, but does not change its value for the | ||
| 1359 | actual height of the frame. This is only useful on text terminals. | ||
| 1360 | Using a smaller height than the terminal actually implements may be | ||
| 1361 | useful to reproduce behavior observed on a smaller screen, or if the | ||
| 1362 | terminal malfunctions when using its whole screen. Setting the frame | ||
| 1363 | height ``for real'' does not always work, because knowing the correct | ||
| 1364 | actual size may be necessary for correct cursor positioning on | ||
| 1365 | text terminals. | ||
| 1366 | |||
| 1367 | The optional fourth argument @var{pixelwise} non-@code{nil} means that | ||
| 1368 | @var{frame} should be @var{height} pixels high. Note that if | ||
| 1369 | @code{frame-resize-pixelwise} is @code{nil}, some toolkits may refuse to | ||
| 1370 | fully honor the request if it does not increase/decrease the frame | ||
| 1371 | height to a multiple of its character height. | ||
| 1372 | @end defun | ||
| 1373 | |||
| 1374 | @defun set-frame-width frame width &optional pretend pixelwise | ||
| 1375 | This function sets the width of the text area of @var{frame}, measured | ||
| 1376 | in characters. The argument @var{pretend} has the same meaning as in | ||
| 1377 | @code{set-frame-height}. | ||
| 1378 | |||
| 1379 | The optional fourth argument @var{pixelwise} non-@code{nil} means that | ||
| 1380 | @var{frame} should be @var{width} pixels wide. Note that if | ||
| 1381 | @code{frame-resize-pixelwise} is @code{nil}, some toolkits may refuse to | ||
| 1382 | fully honor the request if it does not increase/decrease the frame width | ||
| 1383 | to a multiple of its character width. | ||
| 1384 | @end defun | ||
| 1385 | |||
| 1386 | None of these three functions will make a frame smaller than needed to | ||
| 1387 | display all of its windows together with their scroll bars, fringes, | ||
| 1388 | margins, dividers, mode and header lines. This contrasts with requests | ||
| 1389 | by the window manager triggered, for example, by dragging the external | ||
| 1390 | border of a frame with the mouse. Such requests are always honored by | ||
| 1391 | clipping, if necessary, portions that cannot be displayed at the right, | ||
| 1392 | bottom corner of the frame. | ||
| 1393 | |||
| 1394 | By default, Emacs tries to keep the number of lines and columns of a | ||
| 1395 | frame's text area unaltered when, for example, adding or removing a menu | ||
| 1396 | bar, changing the default font or setting the width of the frame's | ||
| 1397 | scroll bars. This means, however, that in such case Emacs must ask the | ||
| 1398 | window manager to resize the display area of the frame in order to | ||
| 1399 | accommodate the size change. Note that wrapping a menu or tool bar | ||
| 1400 | usually does not resize the frame's display area, hence this will alter | ||
| 1401 | the number of displayed lines. | ||
| 1402 | |||
| 1403 | Occasionally, such implied resizing of the display area may be | ||
| 1404 | unwanted, for example, when the frame is maximized or made fullscreen | ||
| 1405 | where it's turned off by default. In other cases you can disable | ||
| 1406 | implied resizing with the following option: | ||
| 1407 | |||
| 1408 | @defopt frame-inhibit-implied-resize | ||
| 1409 | If this option is @code{nil}, changing font, menu bar, tool bar, | ||
| 1410 | internal borders, fringes or scroll bars of a specific frame may | ||
| 1411 | implicitly resize the frame's display area in order to preserve the | ||
| 1412 | number of columns or lines the frame displays. If this option is | ||
| 1413 | non-@code{nil}, no implied resizing is done. | ||
| 1414 | |||
| 1415 | The value of this option can be also be a list of frame parameters. In | ||
| 1416 | that case, implied resizing is inhibited when changing a parameter that | ||
| 1417 | appears in this list. The frame parameters currently handled by this | ||
| 1418 | option are: @code{font}, @code{font-backend}, | ||
| 1419 | @code{internal-border-width}, @code{menu-bar-lines} and | ||
| 1420 | @code{tool-bar-lines}. | ||
| 1421 | |||
| 1422 | Changing any of the @code{scroll-bar-width}, @code{scroll-bar-height}, | ||
| 1423 | @code{vertical-scroll-bars}, @code{horizontal-scroll-bars}, | ||
| 1424 | @code{left-fringe} and @code{right-fringe} frame parameters is handled | ||
| 1425 | as if the frame contained just one live window. This means, for | ||
| 1426 | example, that removing vertical scroll bars on a frame containing | ||
| 1427 | several side by side windows will shrink the frame width by the width of | ||
| 1428 | one scroll bar provided this option is @code{nil} and keep it unchanged | ||
| 1429 | if this option is either @code{t} or a list containing | ||
| 1430 | @code{vertical-scroll-bars}. | ||
| 1431 | |||
| 1432 | The default value is @code{'(tool-bar-lines)} for Lucid, Motif and | ||
| 1433 | Windows (which means that adding/removing a tool bar there does not | ||
| 1434 | change the frame height), @code{nil} on all other window systems | ||
| 1435 | including GTK+ (which means that changing any of the parameters listed | ||
| 1436 | above may change the size of the frame), and @code{t} otherwise (which | ||
| 1437 | means the frame size never changes implicitly when there's no window | ||
| 1438 | system support). | ||
| 1439 | |||
| 1440 | Note that when a frame is not large enough to accommodate a change of | ||
| 1441 | any of the parameters listed above, Emacs may try to enlarge the frame | ||
| 1442 | even if this option is non-@code{nil}. | ||
| 1443 | @end defopt | ||
| 1444 | |||
| 1445 | @c FIXME? Belongs more in Emacs manual than here? | ||
| 1446 | @c But, e.g., fit-window-to-buffer is in this manual. | ||
| 1447 | If you have a frame that displays only one window, you can fit that | ||
| 1448 | frame to its buffer using the command @code{fit-frame-to-buffer}. | ||
| 1449 | |||
| 1450 | @deffn Command fit-frame-to-buffer &optional frame max-height min-height max-width min-width only | ||
| 1451 | This command adjusts the size of @var{frame} to display the contents of | ||
| 1452 | its buffer exactly. @var{frame} can be any live frame and defaults to | ||
| 1453 | the selected one. Fitting is done only if @var{frame}'s root window is | ||
| 1454 | live. The arguments @var{max-height}, @var{min-height}, @var{max-width} | ||
| 1455 | and @var{min-width} specify bounds on the new total size of | ||
| 1456 | @var{frame}'s root window. @var{min-height} and @var{min-width} default | ||
| 1457 | to the values of @code{window-min-height} and @code{window-min-width} | ||
| 1458 | respectively. | ||
| 1459 | |||
| 1460 | If the optional argument @var{only} is @code{vertically}, this function | ||
| 1461 | may resize the frame vertically only. If @var{only} is | ||
| 1462 | @code{horizontally}, it may resize the frame horizontally only. | ||
| 1463 | @end deffn | ||
| 1464 | |||
| 1465 | The behavior of @code{fit-frame-to-buffer} can be controlled with the | ||
| 1466 | help of the two options listed next. | ||
| 1467 | |||
| 1468 | @defopt fit-frame-to-buffer-margins | ||
| 1469 | This option can be used to specify margins around frames to be fit by | ||
| 1470 | @code{fit-frame-to-buffer}. Such margins can be useful to avoid, for | ||
| 1471 | example, that such frames overlap the taskbar. | ||
| 1472 | |||
| 1473 | It specifies the numbers of pixels to be left free on the left, above, | ||
| 1474 | the right, and below a frame that shall be fit. The default specifies | ||
| 1475 | @code{nil} for each which means to use no margins. The value specified | ||
| 1476 | here can be overridden for a specific frame by that frame's | ||
| 1477 | @code{fit-frame-to-buffer-margins} parameter, if present. | ||
| 1478 | @end defopt | ||
| 1479 | |||
| 1480 | @defopt fit-frame-to-buffer-sizes | ||
| 1481 | This option specifies size boundaries for @code{fit-frame-to-buffer}. | ||
| 1482 | It specifies the total maximum and minimum lines and maximum and minimum | ||
| 1483 | columns of the root window of any frame that shall be fit to its buffer. | ||
| 1484 | If any of these values is non-@code{nil}, it overrides the corresponding | ||
| 1485 | argument of @code{fit-frame-to-buffer}. | ||
| 1486 | @end defopt | ||
| 1487 | |||
| 1488 | |||
| 1489 | @node Geometry | 1725 | @node Geometry |
| 1490 | @subsection Geometry | 1726 | @subsection Geometry |
| 1491 | 1727 | ||
| @@ -2088,8 +2324,10 @@ give access to the current position of the mouse. | |||
| 2088 | @defun mouse-position | 2324 | @defun mouse-position |
| 2089 | This function returns a description of the position of the mouse. The | 2325 | This function returns a description of the position of the mouse. The |
| 2090 | value looks like @code{(@var{frame} @var{x} . @var{y})}, where @var{x} | 2326 | value looks like @code{(@var{frame} @var{x} . @var{y})}, where @var{x} |
| 2091 | and @var{y} are integers giving the position in characters relative to | 2327 | and @var{y} are integers giving the (possibly rounded) position in |
| 2092 | the top left corner of the inside of @var{frame}. | 2328 | multiples of the default character size of @var{frame} (@pxref{Frame |
| 2329 | Font}) relative to the native position of @var{frame} (@pxref{Frame | ||
| 2330 | Geometry}). | ||
| 2093 | @end defun | 2331 | @end defun |
| 2094 | 2332 | ||
| 2095 | @defvar mouse-position-function | 2333 | @defvar mouse-position-function |
| @@ -2105,9 +2343,13 @@ This abnormal hook exists for the benefit of packages like | |||
| 2105 | @defun set-mouse-position frame x y | 2343 | @defun set-mouse-position frame x y |
| 2106 | This function @dfn{warps the mouse} to position @var{x}, @var{y} in | 2344 | This function @dfn{warps the mouse} to position @var{x}, @var{y} in |
| 2107 | frame @var{frame}. The arguments @var{x} and @var{y} are integers, | 2345 | frame @var{frame}. The arguments @var{x} and @var{y} are integers, |
| 2108 | giving the position in characters relative to the top left corner of the | 2346 | giving the position in multiples of the default character size of |
| 2109 | inside of @var{frame}. If @var{frame} is not visible, this function | 2347 | @var{frame} (@pxref{Frame Font}) relative to the native position of |
| 2110 | does nothing. The return value is not significant. | 2348 | @var{frame} (@pxref{Frame Geometry}). |
| 2349 | |||
| 2350 | The resulting mouse position is constrained to the native frame of | ||
| 2351 | @var{frame}. If @var{frame} is not visible, this function does nothing. | ||
| 2352 | The return value is not significant. | ||
| 2111 | @end defun | 2353 | @end defun |
| 2112 | 2354 | ||
| 2113 | @defun mouse-pixel-position | 2355 | @defun mouse-pixel-position |
| @@ -2118,12 +2360,31 @@ coordinates in units of pixels rather than units of characters. | |||
| 2118 | @defun set-mouse-pixel-position frame x y | 2360 | @defun set-mouse-pixel-position frame x y |
| 2119 | This function warps the mouse like @code{set-mouse-position} except that | 2361 | This function warps the mouse like @code{set-mouse-position} except that |
| 2120 | @var{x} and @var{y} are in units of pixels rather than units of | 2362 | @var{x} and @var{y} are in units of pixels rather than units of |
| 2121 | characters. These coordinates are not required to be within the frame. | 2363 | characters. |
| 2122 | 2364 | ||
| 2123 | If @var{frame} is not visible, this function does nothing. The return | 2365 | The resulting mouse position is not constrained to the native frame of |
| 2124 | value is not significant. | 2366 | @var{frame}. If @var{frame} is not visible, this function does nothing. |
| 2367 | The return value is not significant. | ||
| 2125 | @end defun | 2368 | @end defun |
| 2126 | 2369 | ||
| 2370 | On a graphical terminal the following two functions allow to retrieve | ||
| 2371 | and set the absolute position of the mouse cursor. | ||
| 2372 | |||
| 2373 | @defun x-mouse-absolute-pixel-position | ||
| 2374 | This function returns a cons cell (@var{x} . @var{y}) of the coordinates | ||
| 2375 | of the mouse cursor position in pixels, relative to a position (0, 0) of | ||
| 2376 | the selected frame's display. | ||
| 2377 | @end defun | ||
| 2378 | |||
| 2379 | @defun x-set-mouse-absolute-pixel-position x y | ||
| 2380 | This function moves the mouse cursor to the position (@var{x}, @var{y}). | ||
| 2381 | The coordinates @var{x} and @var{y} are interpreted in pixels relative | ||
| 2382 | to a position (0, 0) of the selected frame's display. | ||
| 2383 | @end defun | ||
| 2384 | |||
| 2385 | The following function can tell whether the mouse cursor is currently | ||
| 2386 | visible on a frame: | ||
| 2387 | |||
| 2127 | @defun frame-pointer-visible-p &optional frame | 2388 | @defun frame-pointer-visible-p &optional frame |
| 2128 | This predicate function returns non-@code{nil} if the mouse pointer | 2389 | This predicate function returns non-@code{nil} if the mouse pointer |
| 2129 | displayed on @var{frame} is visible; otherwise it returns @code{nil}. | 2390 | displayed on @var{frame} is visible; otherwise it returns @code{nil}. |
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index ccfe7ffb7bc..b55a139a334 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi | |||
| @@ -432,8 +432,8 @@ specified either in units of pixels or in units of lines and columns. | |||
| 432 | On a graphical display, the latter actually correspond to the height and | 432 | On a graphical display, the latter actually correspond to the height and |
| 433 | width of a ``default'' character specified by the frame's default font | 433 | width of a ``default'' character specified by the frame's default font |
| 434 | as returned by @code{frame-char-height} and @code{frame-char-width} | 434 | as returned by @code{frame-char-height} and @code{frame-char-width} |
| 435 | (@pxref{Size and Position}). Thus, if a window is displaying text with | 435 | (@pxref{Frame Font}). Thus, if a window is displaying text with a |
| 436 | a different font or size, the reported line height and column width for | 436 | different font or size, the reported line height and column width for |
| 437 | that window may differ from the actual number of text lines or columns | 437 | that window may differ from the actual number of text lines or columns |
| 438 | displayed within it. | 438 | displayed within it. |
| 439 | 439 | ||
| @@ -791,8 +791,8 @@ If the value of this option is non-@code{nil}, Emacs resizes windows in | |||
| 791 | units of pixels. This currently affects functions like | 791 | units of pixels. This currently affects functions like |
| 792 | @code{split-window} (@pxref{Splitting Windows}), @code{maximize-window}, | 792 | @code{split-window} (@pxref{Splitting Windows}), @code{maximize-window}, |
| 793 | @code{minimize-window}, @code{fit-window-to-buffer}, | 793 | @code{minimize-window}, @code{fit-window-to-buffer}, |
| 794 | @code{shrink-window-if-larger-than-buffer} (all listed below) and | 794 | @code{fit-frame-to-buffer} and |
| 795 | @code{fit-frame-to-buffer} (@pxref{Size and Position}). | 795 | @code{shrink-window-if-larger-than-buffer} (all listed below). |
| 796 | 796 | ||
| 797 | Note that when a frame's pixel size is not a multiple of its character | 797 | Note that when a frame's pixel size is not a multiple of its character |
| 798 | size, at least one window may get resized pixelwise even if this | 798 | size, at least one window may get resized pixelwise even if this |
| @@ -836,8 +836,7 @@ resize operations (@pxref{Preserving Window Sizes}). | |||
| 836 | 836 | ||
| 837 | If the option @code{fit-frame-to-buffer} (see below) is non-@code{nil}, | 837 | If the option @code{fit-frame-to-buffer} (see below) is non-@code{nil}, |
| 838 | this function will try to resize the frame of @var{window} to fit its | 838 | this function will try to resize the frame of @var{window} to fit its |
| 839 | contents by calling @code{fit-frame-to-buffer} (@pxref{Size and | 839 | contents by calling @code{fit-frame-to-buffer} (see below). |
| 840 | Position}). | ||
| 841 | @end deffn | 840 | @end deffn |
| 842 | 841 | ||
| 843 | @defopt fit-window-to-buffer-horizontally | 842 | @defopt fit-window-to-buffer-horizontally |
| @@ -858,6 +857,47 @@ live window and this option is non-@code{nil}. If this is | |||
| 858 | non-@code{nil} value means frames can be resized in both dimensions. | 857 | non-@code{nil} value means frames can be resized in both dimensions. |
| 859 | @end defopt | 858 | @end defopt |
| 860 | 859 | ||
| 860 | If you have a frame that displays only one window, you can fit that | ||
| 861 | frame to its buffer using the command @code{fit-frame-to-buffer}. | ||
| 862 | |||
| 863 | @deffn Command fit-frame-to-buffer &optional frame max-height min-height max-width min-width only | ||
| 864 | This command adjusts the size of @var{frame} to display the contents of | ||
| 865 | its buffer exactly. @var{frame} can be any live frame and defaults to | ||
| 866 | the selected one. Fitting is done only if @var{frame}'s root window is | ||
| 867 | live. The arguments @var{max-height}, @var{min-height}, @var{max-width} | ||
| 868 | and @var{min-width} specify bounds on the new total size of | ||
| 869 | @var{frame}'s root window. @var{min-height} and @var{min-width} default | ||
| 870 | to the values of @code{window-min-height} and @code{window-min-width} | ||
| 871 | respectively. | ||
| 872 | |||
| 873 | If the optional argument @var{only} is @code{vertically}, this function | ||
| 874 | may resize the frame vertically only. If @var{only} is | ||
| 875 | @code{horizontally}, it may resize the frame horizontally only. | ||
| 876 | @end deffn | ||
| 877 | |||
| 878 | The behavior of @code{fit-frame-to-buffer} can be controlled with the | ||
| 879 | help of the two options listed next. | ||
| 880 | |||
| 881 | @defopt fit-frame-to-buffer-margins | ||
| 882 | This option can be used to specify margins around frames to be fit by | ||
| 883 | @code{fit-frame-to-buffer}. Such margins can be useful to avoid, for | ||
| 884 | example, that such frames overlap the taskbar. | ||
| 885 | |||
| 886 | It specifies the numbers of pixels to be left free on the left, above, | ||
| 887 | the right, and below a frame that shall be fit. The default specifies | ||
| 888 | @code{nil} for each which means to use no margins. The value specified | ||
| 889 | here can be overridden for a specific frame by that frame's | ||
| 890 | @code{fit-frame-to-buffer-margins} parameter, if present. | ||
| 891 | @end defopt | ||
| 892 | |||
| 893 | @defopt fit-frame-to-buffer-sizes | ||
| 894 | This option specifies size boundaries for @code{fit-frame-to-buffer}. | ||
| 895 | It specifies the total maximum and minimum lines and maximum and minimum | ||
| 896 | columns of the root window of any frame that shall be fit to its buffer. | ||
| 897 | If any of these values is non-@code{nil}, it overrides the corresponding | ||
| 898 | argument of @code{fit-frame-to-buffer}. | ||
| 899 | @end defopt | ||
| 900 | |||
| 861 | @deffn Command shrink-window-if-larger-than-buffer &optional window | 901 | @deffn Command shrink-window-if-larger-than-buffer &optional window |
| 862 | This command attempts to reduce @var{window}'s height as much as | 902 | This command attempts to reduce @var{window}'s height as much as |
| 863 | possible while still showing its full buffer, but no less than | 903 | possible while still showing its full buffer, but no less than |
| @@ -3622,33 +3662,28 @@ is off the screen due to horizontal scrolling: | |||
| 3622 | @end group | 3662 | @end group |
| 3623 | @end example | 3663 | @end example |
| 3624 | 3664 | ||
| 3665 | |||
| 3625 | @node Coordinates and Windows | 3666 | @node Coordinates and Windows |
| 3626 | @section Coordinates and Windows | 3667 | @section Coordinates and Windows |
| 3627 | @cindex frame-relative coordinate | 3668 | @cindex frame-relative coordinate |
| 3628 | @cindex coordinate, relative to frame | 3669 | @cindex coordinate, relative to frame |
| 3629 | @cindex window position | 3670 | @cindex window position |
| 3630 | 3671 | ||
| 3631 | This section describes functions that report the position of a | 3672 | This section describes functions that report the position of a window. |
| 3632 | window. Most of these functions report positions relative to the | 3673 | Most of these functions report positions relative to an origin at the |
| 3633 | window's frame. In this case, the coordinate origin @samp{(0,0)} lies | 3674 | native position of the window's frame (@pxref{Frame Geometry}). Some |
| 3634 | near the upper left corner of the frame. For technical reasons, on | 3675 | functions report positions relative to the origin of the display of the |
| 3635 | graphical displays the origin is not located at the exact corner of | 3676 | window's frame. In any case, the origin has the coordinates (0, 0) and |
| 3636 | the graphical window as it appears on the screen. If Emacs is built | 3677 | X and Y coordinates increase ``rightward'' and ``downward'' |
| 3637 | with the GTK+ toolkit, the origin is at the upper left corner of the | 3678 | respectively. |
| 3638 | frame area used for displaying Emacs windows, below the title-bar, | 3679 | |
| 3639 | GTK+ menu bar, and tool bar (since these are drawn by the window | 3680 | For the following functions, X and Y coordinates are reported in |
| 3640 | manager and/or GTK+, not by Emacs). But if Emacs is not built with | 3681 | integer character units, i.e., numbers of lines and columns |
| 3641 | GTK+, the origin is at the upper left corner of the tool bar (since in | 3682 | respectively. On a graphical display, each ``line'' and ``column'' |
| 3642 | this case Emacs itself draws the tool bar). In both cases, the X and | 3683 | corresponds to the height and width of a default character specified by |
| 3643 | Y coordinates increase rightward and downward respectively. | 3684 | the frame's default font (@pxref{Frame Font}). |
| 3644 | 3685 | ||
| 3645 | Except where noted, X and Y coordinates are reported in integer | 3686 | @defun window-edges &optional window body absolute pixelwise |
| 3646 | character units, i.e., numbers of lines and columns respectively. On a | ||
| 3647 | graphical display, each ``line'' and ``column'' corresponds to the | ||
| 3648 | height and width of a default character specified by the frame's | ||
| 3649 | default font. | ||
| 3650 | |||
| 3651 | @defun window-edges &optional window | ||
| 3652 | This function returns a list of the edge coordinates of @var{window}. | 3687 | This function returns a list of the edge coordinates of @var{window}. |
| 3653 | If @var{window} is omitted or @code{nil}, it defaults to the selected | 3688 | If @var{window} is omitted or @code{nil}, it defaults to the selected |
| 3654 | window. | 3689 | window. |
| @@ -3665,44 +3700,73 @@ header line, mode line, scroll bar, fringes, window divider and display | |||
| 3665 | margins. On a text terminal, if the window has a neighbor on its right, | 3700 | margins. On a text terminal, if the window has a neighbor on its right, |
| 3666 | its right edge includes the separator line between the window and its | 3701 | its right edge includes the separator line between the window and its |
| 3667 | neighbor. | 3702 | neighbor. |
| 3668 | @end defun | ||
| 3669 | 3703 | ||
| 3670 | @defun window-inside-edges &optional window | 3704 | If the optional argument @var{body} is @code{nil}, this means to |
| 3671 | This function is similar to @code{window-edges}, but the returned edge | 3705 | return the edges corresponding to the total size of @var{window}. |
| 3672 | values are for the text area of the window. They exclude any header | 3706 | @var{body} non-@code{nil} means to return the edges of @var{window}'s |
| 3673 | line, mode line, scroll bar, fringes, window divider, display margins, | 3707 | body (aka text area). If @var{body} is non-@code{nil}, @var{window} |
| 3674 | and vertical separator. | 3708 | must specify a live window. |
| 3709 | |||
| 3710 | If the optional argument @var{absolute} is @code{nil}, this means to | ||
| 3711 | return edges relative to the native position of @var{window}'s frame. | ||
| 3712 | @var{absolute} non-@code{nil} means to return coordinates relative to | ||
| 3713 | the origin (0, 0) of @var{window}'s display. On non-graphical systems | ||
| 3714 | this argument has no effect. | ||
| 3715 | |||
| 3716 | If the optional argument @var{pixelwise} is @code{nil}, this means to | ||
| 3717 | return the coordinates in terms of the default character width and | ||
| 3718 | height of @var{window}'s frame (@pxref{Frame Font}), rounded if | ||
| 3719 | necessary. @var{pixelwise} non-@code{nil} means to return the | ||
| 3720 | coordinates in pixels. Note that the pixel specified by @var{right} and | ||
| 3721 | @var{bottom} is immediately outside of these edges. If @var{absolute} | ||
| 3722 | is non-@code{nil}, @var{pixelwise} is implicitly non-@code{nil} too. | ||
| 3675 | @end defun | 3723 | @end defun |
| 3676 | 3724 | ||
| 3677 | @defun window-top-line &optional window | 3725 | @defun window-body-edges &optional window |
| 3678 | This function returns the Y coordinate of the topmost row of | 3726 | This function returns the edges of @var{window}'s body (@pxref{Window |
| 3679 | @var{window}, equivalent to the @var{top} entry in the list returned | 3727 | Sizes}). Calling @code{(window-body-edges window)} is equivalent to |
| 3680 | by @code{window-edges}. | 3728 | calling @code{(window-edges window t)}, see above. |
| 3681 | @end defun | 3729 | @end defun |
| 3682 | 3730 | ||
| 3731 | @comment The following two functions are confusing and hardly used. | ||
| 3732 | @ignore | ||
| 3683 | @defun window-left-column &optional window | 3733 | @defun window-left-column &optional window |
| 3684 | This function returns the X coordinate of the leftmost column of | 3734 | This function returns the leftmost column of @var{window}. This value |
| 3685 | @var{window}, equivalent to the @var{left} entry in the list returned | 3735 | equals the @var{left} entry in the list returned by @code{(window-edges |
| 3686 | by @code{window-edges}. | 3736 | window)} minus the number of columns occupied by the internal border of |
| 3737 | @var{window}'s frame. | ||
| 3687 | @end defun | 3738 | @end defun |
| 3688 | 3739 | ||
| 3740 | @defun window-top-line &optional window | ||
| 3741 | This function returns the topmost row of @var{window}. This value is | ||
| 3742 | equal to the @var{top} entry in the list returned by @code{(window-edges | ||
| 3743 | window)} minus the number of lines occupied by the internal border of | ||
| 3744 | @var{window}'s frame. | ||
| 3745 | @end defun | ||
| 3746 | @end ignore | ||
| 3747 | |||
| 3689 | The following functions can be used to relate a set of | 3748 | The following functions can be used to relate a set of |
| 3690 | frame-relative coordinates to a window: | 3749 | frame-relative coordinates to a window: |
| 3691 | 3750 | ||
| 3692 | @defun window-at x y &optional frame | 3751 | @defun window-at x y &optional frame |
| 3693 | This function returns the live window at the frame-relative | 3752 | This function returns the live window at the coordinates @var{x} and |
| 3694 | coordinates @var{x} and @var{y}, on frame @var{frame}. If there is no | 3753 | @var{y} given in default character sizes (@pxref{Frame Font}) relative |
| 3695 | window at that position, the return value is @code{nil}. If | 3754 | to the native position of @var{frame} (@pxref{Frame Geometry}). |
| 3696 | @var{frame} is omitted or @code{nil}, it defaults to the selected | 3755 | |
| 3756 | If there is no window at that position, the return value is @code{nil}. | ||
| 3757 | If @var{frame} is omitted or @code{nil}, it defaults to the selected | ||
| 3697 | frame. | 3758 | frame. |
| 3698 | @end defun | 3759 | @end defun |
| 3699 | 3760 | ||
| 3700 | @defun coordinates-in-window-p coordinates window | 3761 | @defun coordinates-in-window-p coordinates window |
| 3701 | This function checks whether a window @var{window} occupies the | 3762 | This function checks whether a window @var{window} occupies the frame |
| 3702 | frame-relative coordinates @var{coordinates}, and if so, which part of | 3763 | relative coordinates @var{coordinates}, and if so, which part of the |
| 3703 | the window that is. @var{window} should be a live window. | 3764 | window that is. @var{window} should be a live window. |
| 3765 | |||
| 3704 | @var{coordinates} should be a cons cell of the form @code{(@var{x} | 3766 | @var{coordinates} should be a cons cell of the form @code{(@var{x} |
| 3705 | . @var{y})}, where @var{x} and @var{y} are frame-relative coordinates. | 3767 | . @var{y})}, where @var{x} and @var{y} are given in default character |
| 3768 | sizes (@pxref{Frame Font}) relative to the native position of | ||
| 3769 | @var{window}'s frame (@pxref{Frame Geometry}). | ||
| 3706 | 3770 | ||
| 3707 | If there is no window at the specified position, the return value is | 3771 | If there is no window at the specified position, the return value is |
| 3708 | @code{nil} . Otherwise, the return value is one of the following: | 3772 | @code{nil} . Otherwise, the return value is one of the following: |
| @@ -3757,46 +3821,96 @@ each text character is taken to be ``one pixel''. | |||
| 3757 | 3821 | ||
| 3758 | @defun window-pixel-edges &optional window | 3822 | @defun window-pixel-edges &optional window |
| 3759 | This function returns a list of pixel coordinates for the edges of | 3823 | This function returns a list of pixel coordinates for the edges of |
| 3760 | @var{window}. If @var{window} is omitted or @code{nil}, it defaults | 3824 | @var{window}. Calling @code{(window-pixel-edges window)} is equivalent |
| 3761 | to the selected window. | 3825 | to calling @code{(window-edges window nil nil t)}, see above. |
| 3826 | @end defun | ||
| 3762 | 3827 | ||
| 3763 | The return value has the form @code{(@var{left} @var{top} @var{right} | 3828 | @comment The following two functions are confusing and hardly used. |
| 3764 | @var{bottom})}. The list elements are, respectively, the X pixel | 3829 | @ignore |
| 3765 | coordinate of the left window edge, the Y pixel coordinate of the top | 3830 | @defun window-pixel-left &optional window |
| 3766 | edge, one more than the X pixel coordinate of the right edge, and one | 3831 | This function returns the left pixel edge of window @var{window}. This |
| 3767 | more than the Y pixel coordinate of the bottom edge. | 3832 | value equals the @var{left} entry in the list returned by |
| 3833 | @code{(window-pixel-edges window)} minus the number of pixels occupied | ||
| 3834 | by the internal border of @var{window}'s frame. @var{window} must be a | ||
| 3835 | valid window and defaults to the selected one. | ||
| 3768 | @end defun | 3836 | @end defun |
| 3769 | 3837 | ||
| 3770 | @defun window-inside-pixel-edges &optional window | 3838 | @defun window-pixel-top &optional window |
| 3771 | This function is like @code{window-pixel-edges}, except that it | 3839 | This function returns the top pixel edge of window @var{window}. This |
| 3772 | returns the pixel coordinates for the edges of the window's text area, | 3840 | value is equal to the @var{top} entry in the list returned by |
| 3773 | rather than the pixel coordinates for the edges of the window itself. | 3841 | @code{(window-pixel-edges window)} minus the number of pixels occupied |
| 3774 | @var{window} must specify a live window. | 3842 | by the internal border of @var{window}'s frame. @var{window} must be a |
| 3843 | valid window and defaults to the selected one. | ||
| 3844 | @end defun | ||
| 3845 | @end ignore | ||
| 3846 | |||
| 3847 | @defun window-body-pixel-edges &optional window | ||
| 3848 | This function returns the pixel edges of @var{window}'s body. Calling | ||
| 3849 | @code{(window-body-pixel-edges window)} is equivalent to calling | ||
| 3850 | @code{(window-edges window t nil t)}, see above. | ||
| 3775 | @end defun | 3851 | @end defun |
| 3776 | 3852 | ||
| 3777 | The following functions return window positions in pixels, relative | 3853 | The following functions return window positions in pixels, relative to |
| 3778 | to the display screen rather than the frame: | 3854 | the origin of the display screen rather than that of the frame: |
| 3779 | 3855 | ||
| 3780 | @defun window-absolute-pixel-edges &optional window | 3856 | @defun window-absolute-pixel-edges &optional window |
| 3781 | This function is like @code{window-pixel-edges}, except that it | 3857 | This function returns the pixel coordinates of @var{WINDOW} relative to |
| 3782 | returns the edge pixel coordinates relative to the top left corner of | 3858 | an origin at (0, 0) of the display of @var{window}'s frame. Calling |
| 3783 | the display screen. | 3859 | @code{(window-absolute-pixel-edges)} is equivalent to calling |
| 3860 | @code{(window-edges window nil t t)}, see above. | ||
| 3784 | @end defun | 3861 | @end defun |
| 3785 | 3862 | ||
| 3786 | @defun window-inside-absolute-pixel-edges &optional window | 3863 | @defun window-absolute-body-pixel-edges &optional window |
| 3787 | This function is like @code{window-inside-pixel-edges}, except that it | 3864 | This function returns the pixel coordinates of @var{WINDOW}'s body |
| 3788 | returns the edge pixel coordinates relative to the top left corner of | 3865 | relative to an origin at (0, 0) of the display of @var{window}'s frame. |
| 3789 | the display screen. @var{window} must specify a live window. | 3866 | Calling @code{(window-absolute-body-pixel-edges window)} is equivalent |
| 3790 | @end defun | 3867 | to calling @code{(window-edges window t t t)}, see above. |
| 3791 | 3868 | ||
| 3792 | @defun window-pixel-left &optional window | 3869 | Combined with @code{x-set-mouse-absolute-pixel-position}, this function |
| 3793 | This function returns the left pixel edge of window @var{window}. | 3870 | can be used to move the mouse pointer to an arbitrary buffer position |
| 3794 | @var{window} must be a valid window and defaults to the selected one. | 3871 | visible in some window: |
| 3872 | |||
| 3873 | @example | ||
| 3874 | @group | ||
| 3875 | (let ((edges (window-absolute-body-pixel-edges)) | ||
| 3876 | (position (pos-visible-in-window-p nil nil t))) | ||
| 3877 | (x-set-mouse-absolute-pixel-position | ||
| 3878 | (+ (nth 0 edges) (nth 0 position)) | ||
| 3879 | (+ (nth 1 edges) (nth 1 position)))) | ||
| 3880 | @end group | ||
| 3881 | @end example | ||
| 3882 | |||
| 3883 | On a graphical terminal this form ``warps'' the mouse cursor to the | ||
| 3884 | upper left corner of the glyph at the selected window's point. A | ||
| 3885 | position calculated this way can be also used to show a tooltip window | ||
| 3886 | there. | ||
| 3795 | @end defun | 3887 | @end defun |
| 3796 | 3888 | ||
| 3797 | @defun window-pixel-top &optional window | 3889 | The following function returns the screen coordinates of a buffer |
| 3798 | This function returns the top pixel edge of window @var{window}. | 3890 | position visible in a window: |
| 3799 | @var{window} must be a valid window and defaults to the selected one. | 3891 | |
| 3892 | @defun window-absolute-pixel-position &optional position window | ||
| 3893 | If the buffer position @var{position} is visible in window @var{window}, | ||
| 3894 | this function returns the display coordinates of the upper/left corner | ||
| 3895 | of the glyph at @var{position}. The return value is a cons of the X- | ||
| 3896 | and Y-coordinates of that corner, relative to an origin at (0, 0) of | ||
| 3897 | @var{window}'s display. It returns @code{nil} if @var{position} is not | ||
| 3898 | visible in @var{window}. | ||
| 3899 | |||
| 3900 | @var{window} must be a live window and defaults to the selected | ||
| 3901 | window. @var{position} defaults to the value of @code{window-point} | ||
| 3902 | of @var{window}. | ||
| 3903 | |||
| 3904 | This means that in order to move the mouse pointer to the position of | ||
| 3905 | point in the selected window, it's sufficient to write: | ||
| 3906 | |||
| 3907 | @example | ||
| 3908 | @group | ||
| 3909 | (let ((position (window-absolute-pixel-position))) | ||
| 3910 | (x-set-mouse-absolute-pixel-position | ||
| 3911 | (car position) (cdr position))) | ||
| 3912 | @end group | ||
| 3913 | @end example | ||
| 3800 | @end defun | 3914 | @end defun |
| 3801 | 3915 | ||
| 3802 | 3916 | ||