aboutsummaryrefslogtreecommitdiffstats
path: root/doc/lispref/frames.texi
diff options
context:
space:
mode:
Diffstat (limited to 'doc/lispref/frames.texi')
-rw-r--r--doc/lispref/frames.texi510
1 files changed, 397 insertions, 113 deletions
diff --git a/doc/lispref/frames.texi b/doc/lispref/frames.texi
index 50467d1dfd5..b430f7c6fad 100644
--- a/doc/lispref/frames.texi
+++ b/doc/lispref/frames.texi
@@ -974,14 +974,7 @@ Parameters}). The text size of the initial frame can be also set with
974the help of an X-style geometry specification. @xref{Emacs Invocation,, 974the help of an X-style geometry specification. @xref{Emacs Invocation,,
975Command Line Arguments for Emacs Invocation, emacs, The GNU Emacs 975Command Line Arguments for Emacs Invocation, emacs, The GNU Emacs
976Manual}. Below we list some functions to access and set the size of an 976Manual}. Below we list some functions to access and set the size of an
977existing, visible frame. 977existing, visible frame, by default the selected one.
978
979@defun frame-text-height &optional frame
980@defunx frame-text-width &optional frame
981These functions return the height and width of the text area of
982@var{frame} (@pxref{Frame Layout}), measured in pixels. For a text
983terminal, the results are in characters rather than pixels.
984@end defun
985 978
986@defun frame-height &optional frame 979@defun frame-height &optional frame
987@defunx frame-width &optional frame 980@defunx frame-width &optional frame
@@ -997,11 +990,33 @@ rounded down to the number of characters of the default font that fully
997fit into the text area. 990fit into the text area.
998@end defun 991@end defun
999 992
1000@defun frame-pixel-height &optional frame 993The functions following next return the pixel widths and heights of the
1001@defunx frame-pixel-width &optional frame 994native, outer and inner frame and the text area (@pxref{Frame Layout})
1002These functions return the native width and height, see @ref{Frame 995of a given frame. For a text terminal, the results are in characters
1003Layout}) of @var{frame} in pixels. For a text terminal, the results are 996rather than pixels.
1004in characters rather than pixels. 997
998@defun frame-outer-width &optional frame
999@defunx frame-outer-height &optional frame
1000These functions return the outer width and height of @var{frame} in
1001pixels.
1002@end defun
1003
1004@defun frame-native-height &optional frame
1005@defunx frame-native-width &optional frame
1006These functions return the native width and height of @var{frame} in
1007pixels.
1008@end defun
1009
1010@defun frame-inner-width &optional frame
1011@defunx frame-inner-height &optional frame
1012These functions return the inner width and height of @var{frame} in
1013pixels.
1014@end defun
1015
1016@defun frame-text-width &optional frame
1017@defunx frame-text-height &optional frame
1018These functions return the width and height of the text area of
1019@var{frame} in pixels.
1005@end defun 1020@end defun
1006 1021
1007On window systems that support it, Emacs tries by default to make the 1022On window systems that support it, Emacs tries by default to make the
@@ -1345,6 +1360,8 @@ text terminals.
1345* Buffer Parameters:: Which buffers have been or should be shown. 1360* Buffer Parameters:: Which buffers have been or should be shown.
1346* Frame Interaction Parameters:: Parameters for interacting with other 1361* Frame Interaction Parameters:: Parameters for interacting with other
1347 frames. 1362 frames.
1363* Mouse Dragging Parameters:: Parameters for resizing and moving
1364 frames with the mouse.
1348* Management Parameters:: Communicating with the window manager. 1365* Management Parameters:: Communicating with the window manager.
1349* Cursor Parameters:: Controlling the cursor appearance. 1366* Cursor Parameters:: Controlling the cursor appearance.
1350* Font and Color Parameters:: Fonts and colors for the frame text. 1367* Font and Color Parameters:: Fonts and colors for the frame text.
@@ -1404,18 +1421,19 @@ named, this parameter will be @code{nil}.
1404@cindex frame position 1421@cindex frame position
1405 1422
1406Parameters describing the X- and Y-offsets of a frame are always 1423Parameters describing the X- and Y-offsets of a frame are always
1407measured in pixels. For normal, non-child frames they specify the 1424measured in pixels. For a normal, non-child frame they specify the
1408frame's absolute outer position (@pxref{Frame Geometry}) with respect to 1425frame's outer position (@pxref{Frame Geometry}) relative to its
1409its display's origin. For a child frame (@pxref{Child Frames}) they 1426display's origin. For a child frame (@pxref{Child Frames}) they specify
1410specify the frame's outer position relative to the native position of 1427the frame's outer position relative to the native position of the
1411the frame's parent frame. (Note that none of these parameters is 1428frame's parent frame. (Note that none of these parameters is meaningful
1412meaningful on TTY frames.) 1429on TTY frames.)
1413 1430
1414@table @code 1431@table @code
1415@vindex left, a frame parameter 1432@vindex left, a frame parameter
1416@item left 1433@item left
1417The position, in pixels, of the left outer edge of the frame with 1434The position, in pixels, of the left outer edge of the frame with
1418respect to the left edge of the frame's display or parent frame. 1435respect to the left edge of the frame's display or parent frame. It can
1436be specified in one of the following ways.
1419 1437
1420@table @asis 1438@table @asis
1421@item an integer 1439@item an integer
@@ -1436,6 +1454,30 @@ right edge of the display or parent frame. The integer @var{pos} may be
1436positive or negative; a negative value specifies a position outside the 1454positive or negative; a negative value specifies a position outside the
1437screen or parent frame or on a monitor other than the primary one (for 1455screen or parent frame or on a monitor other than the primary one (for
1438multi-monitor displays). 1456multi-monitor displays).
1457
1458@cindex left position ratio
1459@cindex top position ratio
1460@item a floating-point value
1461A floating-point value in the range 0.0 to 1.0 specifies the left edge's
1462offset via the @dfn{left position ratio} of the frame---the ratio of the
1463left edge of its outer frame to the width of the frame's workarea
1464(@pxref{Multiple Terminals}) or its parent's native frame (@pxref{Child
1465Frames}) minus the width of the outer frame. Thus, a left position
1466ratio of 0.0 flushes a frame to the left, a ratio of 0.5 centers it and
1467a ratio of 1.0 flushes it to the right of its display or parent frame.
1468Similarly, the @dfn{top position ratio} of a frame is the ratio of the
1469frame's top position to the height of its workarea or parent frame minus
1470the height of the frame.
1471
1472Emacs will try to keep the position ratios of a child frame unaltered if
1473that frame has a non-@code{nil} @code{keep-ratio} parameter
1474(@pxref{Frame Interaction Parameters}) and its parent frame is resized.
1475
1476Since the outer size of a frame (@pxref{Frame Geometry}) is usually
1477unavailable before a frame has been made visible, it is generally not
1478advisable to use floating-point values when creating decorated frames.
1479Floating-point values are more suited for ensuring that an (undecorated)
1480child frame is positioned nicely within the area of its parent frame.
1439@end table 1481@end table
1440 1482
1441Some window managers ignore program-specified positions. If you want to 1483Some window managers ignore program-specified positions. If you want to
@@ -1448,17 +1490,19 @@ following example:
1448 nil '((user-position . t) (left . (+ -4)))) 1490 nil '((user-position . t) (left . (+ -4))))
1449@end example 1491@end example
1450 1492
1451In general, it is not a good idea to specify negative offsets to 1493In general, it is not a good idea to position a frame relative to the
1452position a frame relative to the right or bottom edge of its display. 1494right or bottom edge of its display. Positioning the initial or a new
1453Positioning the initial or a new frame is either not accurate (because 1495frame is either not accurate (because the size of the outer frame is not
1454the size of the outer frame is not yet fully known before the frame has 1496yet fully known before the frame has been made visible) or will cause
1455been made visible) or will cause additional flicker (if the frame is 1497additional flicker (if the frame has to be repositioned after becoming
1456repositioned after becoming visible). 1498visible).
1457 1499
1458 Note also, that negative offsets are not stored internally and are not 1500 Note also, that positions specified relative to the right/bottom edge
1459returned by the function @code{frame-parameters}. This means that the 1501of a display, workarea or parent frame as well as floating-point offsets
1460desktop saving routines will restore the frame from the positive offsets 1502are stored internally as integer offsets relative to the left/top edge
1461obtained by that function. 1503of the display, workarea or parent frame edge. They are also returned
1504as such by functions like @code{frame-parameters} and restored as such
1505by the desktop saving routines.
1462 1506
1463@vindex top, a frame parameter 1507@vindex top, a frame parameter
1464@item top 1508@item top
@@ -1523,24 +1567,61 @@ function @code{frame-restack} (@pxref{Raising and Lowering}).
1523@subsubsection Size Parameters 1567@subsubsection Size Parameters
1524@cindex window size on display 1568@cindex window size on display
1525 1569
1526 Frame parameters specify frame sizes in character units. On 1570Frame parameters usually specify frame sizes in character units. On
1527graphical displays, the @code{default} face determines the actual 1571graphical displays, the @code{default} face determines the actual pixel
1528pixel sizes of these character units (@pxref{Face Attributes}). 1572sizes of these character units (@pxref{Face Attributes}).
1529 1573
1530@table @code 1574@table @code
1531@vindex width, a frame parameter 1575@vindex width, a frame parameter
1532@item width 1576@item width
1533The width of the frame's text area (@pxref{Frame Geometry}), in 1577This parameter specifies the width of the frame. It can be specified as
1534characters. The value can be also a cons cell of the symbol 1578in the following ways:
1535@code{text-pixels} and an integer denoting the width of the text area in 1579
1536pixels. 1580@table @asis
1581@item an integer
1582A positive integer specifies the width of the frame's text area
1583(@pxref{Frame Geometry}) in characters.
1584
1585@item a cons cell
1586If this is a cons cell with the symbol @code{text-pixels} in its
1587@sc{car}, the @sc{cdr} of that cell specifies the width of the frame's
1588text area in pixels.
1589
1590@cindex frame width ratio
1591@cindex frame height ratio
1592@item a floating-point value
1593A floating-point number between 0.0 and 1.0 can be used to specify the
1594width of a frame via its @dfn{width ratio}---the ratio of its outer
1595width (@pxref{Frame Geometry}) to the width of the frame's workarea
1596(@pxref{Multiple Terminals}) or its parent frame's (@pxref{Child
1597Frames}) native frame. Thus, a value of 0.5 makes the frame occupy half
1598of the width of its workarea or parent frame, a value of 1.0 the full
1599width. Similarly, the @dfn{height ratio} of a frame is the ratio of its
1600outer height to the height of its workarea or its parent's native frame.
1601
1602Emacs will try to keep the width and height ratio of a child frame
1603unaltered if that frame has a non-@code{nil} @code{keep-ratio} parameter
1604(@pxref{Frame Interaction Parameters}) and its parent frame is resized.
1605
1606Since the outer size of a frame is usually unavailable before a frame
1607has been made visible, it is generally not advisable to use
1608floating-point values when creating decorated frames. Floating-point
1609values are more suited to ensure that a child frame always fits within
1610the area of its parent frame as, for example, when customizing
1611@code{display-buffer-alist} (@pxref{Choosing Window}) via
1612@code{display-buffer-in-child-frame}.
1613@end table
1614
1615Regardless of how this parameter was specified, functions reporting the
1616value of this parameter like @code{frame-parameters} always report the
1617width of the frame's text area in characters as an integer rounded, if
1618necessary, to a multiple of the frame's default character width. That
1619value is also used by the desktop saving routines.
1537 1620
1538@vindex height, a frame parameter 1621@vindex height, a frame parameter
1539@item height 1622@item height
1540The height of the frame's text area (@pxref{Frame Geometry}), in 1623This parameter specifies the height of the frame. It works just like
1541characters. The value can be also a cons cell of the symbol 1624@code{width}, except vertically instead of horizontally.
1542@code{text-pixels} and an integer denoting the height of the text area
1543in pixels.
1544 1625
1545@vindex user-size, a frame parameter 1626@vindex user-size, a frame parameter
1546@item user-size 1627@item user-size
@@ -1551,25 +1632,25 @@ user-position}) does for the position parameters @code{top} and
1551 1632
1552@vindex min-width, a frame parameter 1633@vindex min-width, a frame parameter
1553@item min-width 1634@item min-width
1554This parameter specifies the minimum native width of the frame 1635This parameter specifies the minimum native width (@pxref{Frame
1555(@pxref{Frame Geometry}), in characters. Normally, the functions that 1636Geometry}) of the frame, in characters. Normally, the functions that
1556establish a frame's initial width or resize a frame horizontally make 1637establish a frame's initial width or resize a frame horizontally make
1557sure that all the frame's windows, vertical scroll bars, fringes, 1638sure that all the frame's windows, vertical scroll bars, fringes,
1558margins and vertical dividers can be displayed. This parameter, if 1639margins and vertical dividers can be displayed. This parameter, if
1559non-@code{nil} allows to make a frame narrower than that with the 1640non-@code{nil} allows to make a frame narrower than that with the
1560consequence that any components that do not fit on the frame will be 1641consequence that any components that do not fit will be clipped by the
1561clipped by the window manager. 1642window manager.
1562 1643
1563@vindex min-height, a frame parameter 1644@vindex min-height, a frame parameter
1564@item min-height 1645@item min-height
1565This parameter specifies the minimum height of the native (@pxref{Frame 1646This parameter specifies the minimum native height (@pxref{Frame
1566Geometry}), in characters. Normally, the functions that establish a 1647Geometry}) of the frame, in characters. Normally, the functions that
1567frame's initial size or resize a frame make sure that all the frame's 1648establish a frame's initial size or resize a frame make sure that all
1568windows, horizontal scroll bars and dividers, mode and header lines, the 1649the frame's windows, horizontal scroll bars and dividers, mode and
1569echo area and the internal menu and tool bar can be displayed. This 1650header lines, the echo area and the internal menu and tool bar can be
1570parameter, if non-@code{nil} allows to make a frame smaller than that 1651displayed. This parameter, if non-@code{nil} allows to make a frame
1571with the consequence that any components that do not fit on the frame 1652smaller than that with the consequence that any components that do not
1572will be clipped by the window-system or window manager. 1653fit will be clipped by the window manager.
1573 1654
1574@cindex fullboth frames 1655@cindex fullboth frames
1575@cindex fullheight frames 1656@cindex fullheight frames
@@ -1623,6 +1704,20 @@ file as, for example
1623 1704
1624This will give a new frame full height after typing in it @key{F11} for 1705This will give a new frame full height after typing in it @key{F11} for
1625the first time. 1706the first time.
1707
1708@vindex fit-frame-to-buffer-margins, a frame parameter
1709@item fit-frame-to-buffer-margins
1710This parameter allows to override the value of the option
1711@code{fit-frame-to-buffer-margins} when fitting this frame to the buffer
1712of its root window with @code{fit-frame-to-buffer} (@pxref{Resizing
1713Windows}).
1714
1715@vindex fit-frame-to-buffer-sizes, a frame parameter
1716@item fit-frame-to-buffer-sizes
1717This parameter allows to override the value of the option
1718@code{fit-frame-to-buffer-sizes} when fitting this frame to the buffer
1719of its root window with @code{fit-frame-to-buffer} (@pxref{Resizing
1720Windows}).
1626@end table 1721@end table
1627 1722
1628 1723
@@ -1646,9 +1741,9 @@ Geometry}).
1646 1741
1647@vindex vertical-scroll-bars, a frame parameter 1742@vindex vertical-scroll-bars, a frame parameter
1648@item vertical-scroll-bars 1743@item vertical-scroll-bars
1649Whether the frame has scroll bars for vertical scrolling, and which side 1744Whether the frame has scroll bars (@pxref{Scroll Bars}) for vertical
1650of the frame they should be on. The possible values are @code{left}, 1745scrolling, and which side of the frame they should be on. The possible
1651@code{right}, and @code{nil} for no scroll bars. 1746values are @code{left}, @code{right}, and @code{nil} for no scroll bars.
1652 1747
1653@vindex horizontal-scroll-bars, a frame parameter 1748@vindex horizontal-scroll-bars, a frame parameter
1654@item horizontal-scroll-bars 1749@item horizontal-scroll-bars
@@ -1692,30 +1787,40 @@ to not draw bottom dividers.
1692 1787
1693@vindex menu-bar-lines frame parameter 1788@vindex menu-bar-lines frame parameter
1694@item menu-bar-lines 1789@item menu-bar-lines
1695The number of lines to allocate at the top of the frame for a menu bar. 1790The number of lines to allocate at the top of the frame for a menu bar
1696The default is one if Menu Bar mode is enabled and zero otherwise. 1791(@pxref{Menu Bar}). The default is one if Menu Bar mode is enabled and
1697@xref{Menu Bars,,,emacs, The GNU Emacs Manual}. For an external menu 1792zero otherwise. @xref{Menu Bars,,,emacs, The GNU Emacs Manual}. For an
1698bar, this value remains unchanged even when the menu bar wraps to two or 1793external menu bar (@pxref{Frame Layout}), this value remains unchanged
1699more lines. In that case, the @code{menu-bar-size} value returned by 1794even when the menu bar wraps to two or more lines. In that case, the
1700@code{frame-geometry} (@pxref{Frame Geometry}) allows to derive whether 1795@code{menu-bar-size} value returned by @code{frame-geometry}
1701the menu bar actually occupies one or more lines. 1796(@pxref{Frame Geometry}) allows to derive whether the menu bar actually
1797occupies one or more lines.
1702 1798
1703@vindex tool-bar-lines frame parameter 1799@vindex tool-bar-lines frame parameter
1704@item tool-bar-lines 1800@item tool-bar-lines
1705The number of lines to use for the tool bar. The default is one if Tool 1801The number of lines to use for the tool bar (@pxref{Tool Bar}). The
1706Bar mode is enabled and zero otherwise. @xref{Tool Bars,,,emacs, The 1802default is one if Tool Bar mode is enabled and zero otherwise.
1707GNU Emacs Manual}. This value may change whenever the tool bar wraps. 1803@xref{Tool Bars,,,emacs, The GNU Emacs Manual}. This value may change
1804whenever the tool bar wraps (@pxref{Frame Layout}).
1708 1805
1709@vindex tool-bar-position frame parameter 1806@vindex tool-bar-position frame parameter
1710@item tool-bar-position 1807@item tool-bar-position
1711The position of the tool bar. Currently only for the GTK tool bar. 1808The position of the tool bar when Emacs was built with GTK+. Its value
1712Value can be one of @code{top}, @code{bottom} @code{left}, @code{right}. 1809can be one of @code{top}, @code{bottom} @code{left}, @code{right}. The
1713The default is @code{top}. 1810default is @code{top}.
1714 1811
1715@vindex line-spacing, a frame parameter 1812@vindex line-spacing, a frame parameter
1716@item line-spacing 1813@item line-spacing
1717Additional space to leave below each text line, in pixels (a positive 1814Additional space to leave below each text line, in pixels (a positive
1718integer). @xref{Line Height}, for more information. 1815integer). @xref{Line Height}, for more information.
1816
1817@vindex no-special-glyphs, a frame parameter
1818@item no-special-glyphs
1819If this is non-@code{nil}, it suppresses the display of any truncation
1820and continuation glyphs (@pxref{Truncation}) for all buffers displayed
1821by this frame. This is useful to eliminate such glyphs when fitting a
1822frame to its buffer via @code{fit-frame-to-buffer} (@pxref{Resizing
1823Windows}).
1719@end table 1824@end table
1720 1825
1721 1826
@@ -1781,15 +1886,115 @@ Frames}.
1781@item mouse-wheel-frame 1886@item mouse-wheel-frame
1782If non-@code{nil}, this parameter specifies the frame whose windows will 1887If non-@code{nil}, this parameter specifies the frame whose windows will
1783be scrolled whenever the mouse wheel is scrolled with the mouse pointer 1888be scrolled whenever the mouse wheel is scrolled with the mouse pointer
1784hovering over this frame (@pxref{Mouse Commands,,, emacs, The GNU Emacs 1889hovering over this frame, see @ref{Mouse Commands,,, emacs, The GNU
1785Manual}). 1890Emacs Manual}.
1786 1891
1787@vindex no-other-frame, a frame parameter 1892@vindex no-other-frame, a frame parameter
1788@item no-other-frame 1893@item no-other-frame
1789If this is non-@code{nil}, then this frame is not eligible as candidate 1894If this is non-@code{nil}, then this frame is not eligible as candidate
1790for the functions @code{next-frame}, @code{previous-frame} 1895for the functions @code{next-frame}, @code{previous-frame}
1791(@pxref{Finding All Frames}) and @code{other-frame} (@pxref{Frame 1896(@pxref{Finding All Frames}) and @code{other-frame}, see @ref{Frame
1792Commands,,, emacs, The GNU Emacs Manual}). 1897Commands,,, emacs, The GNU Emacs Manual}.
1898
1899@vindex auto-hide-function, a frame parameter
1900@item auto-hide-function
1901When this parameter specifies a function, that function will be called
1902instead of the function specified by the variable
1903@code{frame-auto-hide-function} when quitting the frame's only window
1904(@pxref{Quitting Windows}) and there are other frames left.
1905
1906@vindex minibuffer-exit, a frame parameter
1907@item minibuffer-exit
1908When this parameter is non-@code{nil}, Emacs will by default make this
1909frame invisible whenever the minibuffer (@pxref{Minibuffers}) is exited.
1910Alternatively, it can specify the functions @code{iconify-frame} and
1911@code{delete-frame}. This parameter is useful to make a child frame
1912disappear automatically (similar to how Emacs deals with a window) when
1913exiting the minibuffer.
1914
1915@vindex keep-ratio, a frame parameter
1916@item keep-ratio
1917This parameter is currently meaningful for child frames (@pxref{Child
1918Frames}) only. If it is non-@code{nil}, then Emacs will try to keep the
1919frame's size (width and height) ratios (@pxref{Size Parameters}) as well
1920as its left and right position ratios (@pxref{Position Parameters})
1921unaltered whenever its parent frame is resized.
1922
1923If the value of this parameter is @code{nil}, the frame's position and
1924size remain unaltered when the parent frame is resized, so the position
1925and size ratios may change. If the value of this parameter is @code{t},
1926Emacs will try to preserve the frame's size and position ratios, hence
1927the frame's size and position relative to its parent frame may change.
1928
1929More individual control is possible by using a cons cell: In that case
1930the frame's width ratio is preserved if the @sc{car} of the cell is
1931either @code{t} or @code{width-only}. The height ratio is preserved if
1932the @sc{car} of the cell is either @code{t} or @code{height-only}. The
1933left position ratio is preserved if the @sc{cdr} of the cell is either
1934@code{t} or @code{left-only}. The top position ratio is preserved if
1935the @sc{cdr} of the cell is either @code{t} or @code{top-only}.
1936@end table
1937
1938
1939@node Mouse Dragging Parameters
1940@subsubsection Mouse Dragging Parameters
1941@cindex mouse dragging parameters
1942@cindex parameters for resizing frames with the mouse
1943@cindex parameters for moving frames with the mouse
1944
1945The parameters described below provide support for resizing a frame by
1946dragging its internal borders with the mouse. They also allow moving a
1947frame with the mouse by dragging the header line of its topmost or the
1948mode line of its bottommost window.
1949
1950These parameters are mostly useful for child frames (@pxref{Child
1951Frames}) that come without window manager decorations. If necessary,
1952they can be used for undecorated top-level frames as well.
1953
1954@table @code
1955@vindex drag-internal-border, a frame parameter
1956@item drag-internal-border
1957If non-@code{nil}, the frame can be resized by dragging its internal
1958borders, if present, with the mouse.
1959
1960@vindex drag-with-header-line, a frame parameter
1961@item drag-with-header-line
1962If non-@code{nil}, the frame can be moved with the mouse by dragging the
1963header line of its topmost window.
1964
1965@vindex drag-with-mode-line, a frame parameter
1966@item drag-with-mode-line
1967If non-@code{nil}, the frame can be moved with the mouse by dragging the
1968mode line of its bottommost window. Note that such a frame is not
1969allowed to have its own minibuffer window.
1970
1971@vindex snap-width, a frame parameter
1972@item snap-width
1973A frame that is moved with the mouse will ``snap'' at the border(s) of
1974the display or its parent frame whenever it is dragged as near to such
1975an edge as the number of pixels specified by this parameter.
1976
1977@vindex top-visible, a frame parameter
1978@item top-visible
1979If this parameter is a number, the top edge of the frame never appears
1980above the top edge of its display or parent frame. Moreover, as many
1981pixels of the frame as specified by that number will remain visible when
1982the frame is moved against any of the remaining edges of its display or
1983parent frame. Setting this parameter is useful to guard against
1984dragging a child frame with a non-@code{nil}
1985@code{drag-with-header-line} parameter completely out of the area
1986of its parent frame.
1987
1988@vindex bottom-visible, a frame parameter
1989@item bottom-visible
1990If this parameter is a number, the bottom edge of the frame never
1991appears below the bottom edge of its display or parent frame. Moreover,
1992as many pixels of the frame as specified by that number will remain
1993visible when the frame is moved against any of the remaining edges of
1994its display or parent frame. Setting this parameter is useful to guard
1995against dragging a child frame with a non-@code{nil}
1996@code{drag-with-mode-line} parameter completely out of the area of
1997its parent frame.
1793@end table 1998@end table
1794 1999
1795 2000
@@ -1797,9 +2002,9 @@ Commands,,, emacs, The GNU Emacs Manual}).
1797@subsubsection Window Management Parameters 2002@subsubsection Window Management Parameters
1798@cindex window manager interaction, and frame parameters 2003@cindex window manager interaction, and frame parameters
1799 2004
1800 The following frame parameters control various aspects of the 2005 The following frame parameters control various aspects of the frame's
1801frame's interaction with the window manager. They have no effect on 2006interaction with the window manager or window system. They have no
1802text terminals. 2007effect on text terminals.
1803 2008
1804@table @code 2009@table @code
1805@vindex visibility, a frame parameter 2010@vindex visibility, a frame parameter
@@ -1908,7 +2113,8 @@ If non-@code{nil}, this means that this is an @dfn{override redirect}
1908frame---a frame not handled by window managers under X. Override 2113frame---a frame not handled by window managers under X. Override
1909redirect frames have no window manager decorations, can be positioned 2114redirect frames have no window manager decorations, can be positioned
1910and resized only via Emacs' positioning and resizing functions and are 2115and resized only via Emacs' positioning and resizing functions and are
1911usually drawn on top of all other frames. 2116usually drawn on top of all other frames. Setting this parameter has
2117no effect on MS-Windows.
1912 2118
1913@ignore 2119@ignore
1914@vindex parent-id, a frame parameter 2120@vindex parent-id, a frame parameter
@@ -2080,6 +2286,9 @@ The @code{alpha} frame parameter can also be a cons cell
2080@code{(@var{active} . @var{inactive})}, where @var{active} is the 2286@code{(@var{active} . @var{inactive})}, where @var{active} is the
2081opacity of the frame when it is selected, and @var{inactive} is the 2287opacity of the frame when it is selected, and @var{inactive} is the
2082opacity when it is not selected. 2288opacity when it is not selected.
2289
2290Some window systems do not support the @code{alpha} parameter for child
2291frames (@pxref{Child Frames}).
2083@end table 2292@end table
2084 2293
2085The following frame parameters are semi-obsolete in that they are 2294The following frame parameters are semi-obsolete in that they are
@@ -2824,57 +3033,78 @@ unwanted frames are iconified instead.
2824@cindex child frames 3033@cindex child frames
2825@cindex parent frames 3034@cindex parent frames
2826 3035
2827On some window-systems the @code{parent-frame} parameter (@pxref{Frame 3036Child frames are objects halfway between windows (@pxref{Windows}) and
2828Interaction Parameters}) can be used to make a frame a child of the 3037``normal'' frames. Like windows, they are attached to an owning frame.
2829frame specified by that parameter. The frame specified by that 3038Unlike windows, they may overlap each other---changing the size or
2830parameter will then be the frame's parent frame as long as the parameter 3039position of one child frame does not change the size or position of any
2831is not changed or reset. Technically, this makes the child frame's 3040of its sibling child frames.
2832window-system window a child window of the parent frame's window-system 3041
2833window. 3042 By design, operations to make or modify child frames are implemented
3043with the help of frame parameters (@pxref{Frame Parameters}) without any
3044specialized functions or customizable variables. Note that child frames
3045are meaningful on graphical terminals only.
3046
3047 To create a new child frame or to convert a normal frame into a child
3048frame, set that frame's @code{parent-frame} parameter (@pxref{Frame
3049Interaction Parameters}) to that of an already existing frame. The
3050frame specified by that parameter will then be the frame's parent frame
3051as long as the parameter is not changed or reset. Technically, this
3052makes the child frame's window-system window a child window of the
3053parent frame's window-system window.
2834 3054
3055@cindex top-level frame
3056@cindex reparent frame
3057@cindex nest frame
2835 The @code{parent-frame} parameter can be changed at any time. Setting 3058 The @code{parent-frame} parameter can be changed at any time. Setting
2836it to another frame ``reparents'' the child frame. Setting it to 3059it to another frame @dfn{reparents} the child frame. Setting it to
2837another child frame makes the frame a ``nested'' child frame. Setting 3060another child frame makes the frame a @dfn{nested} child frame. Setting
2838it to @code{nil} restores the frame's status as a top-level frame---one 3061it to @code{nil} restores the frame's status as a @dfn{top-level
2839whose window-system window is a child of its display's root window. 3062frame}---a frame whose window-system window is a child of its display's
3063root window.
2840 3064
2841 Since child frames can be arbitrarily nested, a frame can be both a 3065 Since child frames can be arbitrarily nested, a frame can be both a
2842child and a parent frame. Also, the relative roles of child and parent 3066child and a parent frame. Also, the relative roles of child and parent
2843frame may be reversed at any time (though it's usually a good idea to 3067frame may be reversed at any time (though it's usually a good idea to
2844keep the size of child frames sufficiently smaller than that of their 3068keep the size of a child frame sufficiently smaller than that of its
2845parent). An error will be signaled for the attempt to make a frame an 3069parent). An error will be signaled for the attempt to make a frame an
2846ancestor of itself. 3070ancestor of itself.
2847 3071
2848 A child frame is clipped at the native edges (@pxref{Frame Geometry}) 3072 Most window-systems clip a child frame at the native edges
2849of its parent frame---everything outside these edges is invisible. Its 3073(@pxref{Frame Geometry}) of its parent frame---everything outside these
2850@code{left} and @code{top} parameters specify positions relative to the 3074edges is usually invisible. A child frame's @code{left} and @code{top}
2851top-left corner of its parent's native frame. When either of the frames 3075parameters specify a position relative to the top-left corner of its
2852is resized, the relative position of the child frame remains unaltered. 3076parent's native frame. When the parent frame is resized, this position
2853Hence, resizing either of these frames can hide or reveal parts of the 3077remains conceptually unaltered.
2854child frame.
2855 3078
2856 NS builds do not clip child frames at the parent frame's edges, 3079 NS builds do not clip child frames at the parent frame's edges,
2857allowing them to be positioned so they do not obscure the parent 3080allowing them to be positioned so they do not obscure the parent frame
2858frame while still being visible themselves. 3081while still being visible themselves.
2859 3082
2860 Usually, moving a parent frame moves along all its child frames and 3083 Usually, moving a parent frame moves along all its child frames and
2861their descendants as well, keeping their relative positions unaltered. 3084their descendants as well, keeping their relative positions unaltered.
2862The hook @code{move-frame-functions} (@pxref{Frame Position}) is run for 3085Note that the hook @code{move-frame-functions} (@pxref{Frame Position})
2863a child frame only when the position of the child frame relative to its 3086is run for a child frame only when the position of the child frame
2864parent frame changes. When a parent frame is resized, the child frame 3087relative to its parent frame changes. It is not run for a child frame
2865retains its position respective to the left and upper native edges of 3088when the position of the parent frame changes.
2866its parent. In this case, the position respective to the lower or right 3089
2867native edge of the parent frame is usually lost. 3090 When a parent frame is resized, its child frames conceptually retain
3091their previous sizes and their positions relative to the left upper
3092corner of the parent. This means that a child frame may become
3093(partially) invisible when its parent frame shrinks. The parameter
3094@code{keep-ratio} (@pxref{Frame Interaction Parameters}) can be used to
3095resize and reposition a child frame proportionally whenever its parent
3096frame is resized. This may avoid obscuring parts of a frame when its
3097parent frame is shrunk.
2868 3098
2869 A visible child frame always appears on top of its parent frame thus 3099 A visible child frame always appears on top of its parent frame thus
2870obscuring parts of it, except on NS builds where it may be positioned 3100obscuring parts of it, except on NS builds where it may be positioned
2871beneath the parent. This is comparable to the window-system window of 3101beneath the parent. This is comparable to the window-system window of a
2872a top-level frame which also always appears on top of its parent 3102top-level frame which also always appears on top of its parent
2873window---the desktop's root window. When a parent frame is iconified 3103window---the desktop's root window. When a parent frame is iconified or
2874or made invisible (@pxref{Visibility of Frames}), its child frames are 3104made invisible (@pxref{Visibility of Frames}), its child frames are made
2875made invisible. When a parent frame is deiconified or made visible, 3105invisible. When a parent frame is deiconified or made visible, its
2876its child frames are made visible. When a parent frame is about to be 3106child frames are made visible. When a parent frame is about to be
2877deleted, (@pxref{Deleting Frames}) its child frames are recursively 3107deleted (@pxref{Deleting Frames}), its child frames are recursively
2878deleted before it. 3108deleted before it.
2879 3109
2880 Whether a child frame can have a menu or tool bar is window-system or 3110 Whether a child frame can have a menu or tool bar is window-system or
@@ -2892,7 +3122,55 @@ outer border can be used. On MS-Windows, specifying a non-zero outer
2892border width will show a one-pixel wide external border. Under all 3122border width will show a one-pixel wide external border. Under all
2893window-systems, the internal border can be used. In either case, it's 3123window-systems, the internal border can be used. In either case, it's
2894advisable to disable a child frame's window manager decorations with the 3124advisable to disable a child frame's window manager decorations with the
2895@code{undecorated} frame parameter @pxref{Management Parameters}). 3125@code{undecorated} frame parameter (@pxref{Management Parameters}).
3126
3127 To resize or move an undecorated child frame with the mouse, special
3128frame parameters (@pxref{Mouse Dragging Parameters}) have to be used.
3129The internal border of a child frame, if present, can be used to resize
3130the frame with the mouse, provided that frame has a non-@code{nil}
3131@code{drag-internal-border} parameter. If set, the @code{snap-width}
3132parameter indicates the number of pixels where the frame @dfn{snaps} at
3133the respective edge or corner of its parent frame.
3134
3135 There are two ways to drag an entire child frame with the mouse: The
3136@code{drag-with-mode-line} parameter, if non-@code{nil}, allows to drag
3137a frame without minibuffer window (@pxref{Minibuffer Windows}) via the
3138mode line area of its bottommost window. The
3139@code{drag-with-header-line} parameter, if non-@code{nil}, allows to
3140drag the frame via the header line area of its topmost window.
3141
3142 In order to give a child frame a draggable header or mode line, the
3143window parameters @code{mode-line-format} and @code{header-line-format}
3144are handy (@pxref{Window Parameters}). These allow to remove an
3145unwanted mode line (when @code{drag-with-header-line} is chosen) and to
3146remove mouse-sensitive areas which might interfere with frame dragging.
3147
3148 To avoid that dragging moves a frame completely out of its parent's
3149native frame, something which might happen when the mouse cursor
3150overshoots and makes the frame difficult to retrieve once the mouse
3151button has been released, it is advisable to set the frame's
3152@code{top-visible} or @code{bottom-visible} parameter correspondingly.
3153
3154 The @code{top-visible} parameter specifies the number of pixels at the
3155top of the frame that always remain visible within the parent's native
3156frame during dragging and should be set when specifying a non-@code{nil}
3157@code{drag-with-header-line} parameter. The @code{bottom-visible}
3158parameter specifies the number of pixels at the bottom of the frame that
3159always remain visible within the parent's native frame during dragging
3160and should be preferred when specifying a non-@code{nil}
3161@code{drag-with-mode-line} parameter.
3162
3163 When a child frame is used for displaying a buffer via
3164@code{display-buffer-in-child-frame} (@pxref{Display Action Functions}),
3165the frame's @code{auto-hide-function} parameter (@pxref{Frame
3166Interaction Parameters}) can be set to a function, in order to
3167appropriately deal with the frame when the window displaying the buffer
3168shall be quit.
3169
3170 When a child frame is used during minibuffer interaction, for example,
3171to display completions in a separate window, the @code{minibuffer-exit}
3172parameter (@pxref{Frame Interaction Parameters}) is useful in order to
3173deal with the frame when the minibuffer is exited.
2896 3174
2897 The behavior of child frames deviates from that of top-level frames in 3175 The behavior of child frames deviates from that of top-level frames in
2898a number of other ways as well. Here we sketch a few of them: 3176a number of other ways as well. Here we sketch a few of them:
@@ -2930,7 +3208,7 @@ work on all window-systems. Some will drop the object on the parent
2930frame or on some ancestor instead. 3208frame or on some ancestor instead.
2931@end itemize 3209@end itemize
2932 3210
2933 The following two functions may be useful when working with child and 3211 The following two functions can be useful when working with child and
2934parent frames: 3212parent frames:
2935 3213
2936@defun frame-parent &optional frame 3214@defun frame-parent &optional frame
@@ -2951,6 +3229,12 @@ of @var{descendant}'s parent frame. Both, @var{ancestor} and
2951frame. 3229frame.
2952@end defun 3230@end defun
2953 3231
3232Note also the function @code{window-largest-empty-rectangle}
3233(@pxref{Coordinates and Windows}) which can be used to inscribe a child
3234frame in the largest empty area of an existing window. This can be
3235useful to avoid that a child frame obscures any text shown in that
3236window.
3237
2954 3238
2955@node Mouse Tracking 3239@node Mouse Tracking
2956@section Mouse Tracking 3240@section Mouse Tracking