The drawing below sketches the layout of a frame on a graphical terminal:
<------------ Outer Frame Width -----------> ___________________________________________ ^(0) ___________ External Border __________ | | | |_____________ Title Bar ______________| | | | (1)_____________ Menu Bar ______________| | ^ | | (2)_____________ Tool Bar ______________| | ^ | | (3) _________ Internal Border ________ | | ^ | | | | ^ | | | | | | | | | | | | | Outer | | | Inner | | | Native Frame | | | Frame | | | Frame Height | | | Height | | | Height | | | | | | | | | | | | |<--+--- Inner Frame Width ------->| | | | | | | | | | | | | | | | |___v______________________________| | | | | | |___________ Internal Border __________| | v v |______________ External Border _____________| <-------- Native Frame Width -------->
In practice not all of the areas shown in the drawing will or may be present. The meaning of these areas is:
The upper left corner of the outer frame (indicated by ‘(0)’ in the
drawing above) is the outer position or the frame. It is
specified by and settable via the
parameters (see Position Parameters) as well as the functions
set-frame-position (see Size and Position).
The external border should not be confused with the outer
border specified by the
border-width frame parameter
(see Layout Parameters). Since the outer border is usually ignored
on most platforms it is not covered here.
The top left corner of the native frame specifies the native position of the frame. (1)–(3) in the drawing above indicate that position for the various builds:
Accordingly, the native height of a frame includes the height of the tool bar but not that of the menu bar (Lucid, Motif, Windows) or those of the menu bar and the tool bar (non-toolkit and text terminal frames).
The native position of a frame is the reference position of functions
that set or return the current position of the mouse (see Mouse Position) and for functions dealing with the position of windows like
(see Coordinates and Windows).
As a rule, the inner frame is subdivided into the frame's root window
(see Windows and Frames) and the frame's minibuffer window
(see Minibuffer Windows). There are two notable exceptions to this
rule: A minibuffer-less frame contains a root window only and does
not contain a minibuffer window. A minibuffer-only frame contains
only a minibuffer window which also serves as that frame's root window.
See Initial Parameters for how to create such frame
The absolute position of a frame or its edges is usually given in terms of pixels counted from an origin at position (0, 0) of the frame's display. Note that with multiple monitors the origin does not necessarily coincide with the top left corner of the entire usable display area. Hence the absolute outer position of a frame or the absolute positions of the edges of the outer, native or inner frame can be negative in such an environment even when that frame is completely visible.
For a frame on a graphical terminal the following function returns the sizes of the areas described above:
This function returns geometric attributes of frame. The return value is an association list of the attributes listed below. All coordinate, height and width values are integers counting pixels.
- A cons of the absolute X- and Y-coordinates of the outer position of frame, relative to the origin at position (0, 0) of frame's display.
- A cons of the outer width and height of frame.
- A cons of the horizontal and vertical width of frame's external borders as supplied by the window manager. If the window manager doesn't supply these values, Emacs will try to guess them from the coordinates of the outer and inner frame.
- A cons of the width and height of the title bar of frame as supplied by the window manager or operating system. If both of them are zero, the frame has no title bar. If only the width is zero, Emacs was not able to retrieve the width information.
- If non-
nil, this means the menu bar is external (not part of the native frame of frame).
- A cons of the width and height of the menu bar of frame.
- If non-
nil, this means the tool bar is external (not part of the native frame of frame).
- This tells on which side the tool bar on frame is and can be one of
bottom. The only toolkit that currently supports a value other than
- A cons of the width and height of the tool bar of frame.
- The width of the internal border of frame.
The following function can be used to retrieve the edges of the outer, native and inner frame.
This function returns the edges of the outer, native or inner frame of frame. frame must be a live frame and defaults to the selected one. The list returned has the form (left top right bottom) where all values are in pixels relative to the position (0, 0) of frame's display. For terminal frames left and top are both zero.
Optional argument type specifies the type of the edges to return: type
outer-edgesmeans to return the outer edges of frame,
nil) means to return its native edges and
inner-edgesmeans to return its inner edges.
Notice that the pixels at the positions bottom and right lie immediately outside the corresponding frame. This means that if you have, for example, two side-by-side frames positioned such that the right outer edge of the frame on the left equals the left outer edge of the frame on the right, the pixels representing that edge are part of the frame on the right.