diff options
| author | Martin Rudalics | 2015-08-20 18:09:24 +0200 |
|---|---|---|
| committer | Martin Rudalics | 2015-08-20 18:09:24 +0200 |
| commit | e68d43eb8734b4ec466c489b43b26fe732e02dfd (patch) | |
| tree | 2be30940d343202c871f6a97b4858676a00ae5d4 /doc/lispref/frames.texi | |
| parent | d13dc271e52c7d977aee6f32c3d40b8b15b04c6c (diff) | |
| download | emacs-e68d43eb8734b4ec466c489b43b26fe732e02dfd.tar.gz emacs-e68d43eb8734b4ec466c489b43b26fe732e02dfd.zip | |
Describe frame geometry and related functions in Elisp manual
* doc/lispref/display.texi (Size of Displayed Text, Line Height)
(Showing Images): Update references.
* doc/lispref/elisp.texi (Top): Update node listing.
* doc/lispref/frames.texi (Frame Geometry): New node. Move
`Size and Position' section here.
(Size Parameters): Update references.
(Mouse Position): Update references and nomenclature. Describe
new functions `x-mouse-absolute-pixel-position' and
`x-set-mouse-absolute-pixel-position'.
* doc/lispref/windows.texi (Window Sizes): Update references.
(Resizing Windows): Update references. Move description of
`fit-frame-to-buffer' here.
(Coordinates and Windows): Update nomenclature and references.
Describe new arguments of `window-edges'. Comment out
descriptions of `window-left-column', `window-top-line',
`window-pixel-left' and `window-pixel-top'. Describe
`window-absolute-pixel-position'.
Diffstat (limited to 'doc/lispref/frames.texi')
| -rw-r--r-- | doc/lispref/frames.texi | 889 |
1 files changed, 575 insertions, 314 deletions
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}. |