Most window-systems clip child frames at the native edges (see Frame Geometry) of their parent frame—everything outside these edges is
usually invisible. A child frame’s left and top
parameters specify a position relative to the top-left corner of its
parent’s native frame. When the parent frame is resized, this position
remains conceptually unaltered.
NS builds and text terminals do not clip child frames at the parent frame’s edges, allowing them to be positioned so they do not obscure the parent frame while still being visible themselves.
Note also the function window-largest-empty-rectangle
(see Coordinates and Windows) which can be used to inscribe a child
frame in the largest empty area of an existing window. This can be
useful to avoid that a child frame obscures any text shown in that
window.
Usually, moving a parent frame moves along all its child frames and
their descendants as well, keeping their relative positions unaltered.
Note that the hook move-frame-functions (see Frame Position)
is run for a child frame only when the position of the child frame
relative to its parent frame changes.
When a parent frame is resized, its child frames conceptually retain
their previous sizes and their positions relative to the left upper
corner of the parent. This means that a child frame may become
(partially) invisible when its parent frame shrinks. The parameter
keep-ratio (see Frame Interaction Parameters) can be used to
resize and reposition a child frame proportionally whenever its parent
frame is resized. This may avoid obscuring parts of a frame when its
parent frame is shrunk.
A visible child frame always appears on top of its parent frame thus
obscuring parts of it, except on NS builds where it may be positioned
beneath the parent. This is comparable to the window-system window of a
top-level frame which also always appears on top of its parent
window—the desktop’s root window. When a parent frame is iconified or
made invisible (see Visibility of Frames), any child frames
descending from it will not be shown either even if
frame-visible-p returns t for them. When a parent frame
is deiconified or made visible, any child frames descending from it will
be shown again (provided they and all their ancestor frames are visible
too). If a child frame is used as surrogate minibuffer frame
(see Minibuffers and Frames), it’s up to the application to
guarantee the frame’s visibility whenever the minibuffer is activated.
Whether a child frame can have a menu or tool bar is window-system or window manager dependent. Most window-systems explicitly disallow menu bars for child frames. It seems advisable to disable both, menu and tool bars, via the frame’s initial parameters settings. On a text terminal, child frames use the menu bar of their root frame (provided it has one).
Usually, child frames do not exhibit window manager decorations like a title bar or external borders (see Frame Geometry). When the child frame does not show a menu or tool bar, any other of the frame’s borders (see Layout Parameters) can be used instead of the external borders.
In particular, under X (but not when building with GTK+), the frame’s
outer border can be used. On MS-Windows, specifying a non-zero outer
border width will show a one-pixel wide external border. Under all
window-systems, the internal border can be used. In either case, it’s
advisable to disable a child frame’s window manager decorations with the
undecorated frame parameter (see Window Management Parameters). On
a text terminal, on the other hand, it’s better to leave that parameter
alone so your child frame will be drawn with an outer border.
To resize or move a border-less child frame with the mouse, special
frame parameters (see Mouse Dragging Parameters) have to be used.
The internal border of a child frame, if present, can be used to resize
the frame with the mouse, provided that frame has a non-nil
drag-internal-border parameter. If set, the snap-width
parameter indicates the number of pixels where the frame snaps at
the respective edge or corner of its parent frame. On a text terminal,
the outer border can used for resizing.
There are two ways to drag an entire child frame with the mouse: The
drag-with-mode-line parameter, if non-nil, enables
dragging a frame without minibuffer window (see Minibuffer Windows) via the mode line area of its bottommost window. The
drag-with-header-line parameter, if non-nil, enables
dragging the frame via the header line area of its topmost window.
In order to give a child frame a draggable header or mode line, the
window parameters mode-line-format and header-line-format
are handy (see Window Parameters). These allow removing an
unwanted mode line (when drag-with-header-line is chosen) and to
remove mouse-sensitive areas which might interfere with frame dragging.
When the user drags a frame with a mouse and overshoots, it’s easy
to drag a frame out of the screen area of its parent. Retrieving such
a frame can be hairy once the mouse button has been released. To
prevent such a situation, it is advisable to set the frame’s
top-visible or bottom-visible parameter (see Mouse Dragging Parameters).
Set the top-visible parameter of a child frame to a number
when you intend to allow the user dragging that frame by its header
line. Setting top-visible to a number inhibits dragging the
top edge of the child frame above the top edge of its parent. Set the
bottom-visible parameter to a number when you intend to drag
that frame via its mode line; this inhibits dragging the bottom edge
of the child frame beneath the bottom edge of its parent. In either
case, that number also specifies width and height (in pixels) of the
area of the child frame that remains visible during dragging.
When a child frame is used for displaying a buffer via
display-buffer-in-child-frame (see Action Functions for Buffer Display), the frame’s auto-hide-function parameter
(see Frame Interaction Parameters) can be set to a function, in
order to appropriately deal with the frame when the window displaying
the buffer shall be quit.
When a child frame is used during minibuffer interaction, for example,
to display completions in a separate window, the minibuffer-exit
parameter (see Frame Interaction Parameters) is useful in order to
deal with the frame when the minibuffer is exited.