Frame Size And Position
-----------------------
You can read or change the size and position of a frame using the
frame parameters `left', `top', `height', and `width'. Whatever
geometry parameters you don't specify are chosen by the window manager
in its usual fashion.
Here are some special features for working with sizes and positions.
(For the precise meaning of "selected frame" used by these functions,
see Note:Input Focus.)
- Function: set-frame-position frame left top
This function sets the position of the top left corner of FRAME to
LEFT and TOP. These arguments are measured in pixels, and
normally count from the top left corner of the screen.
Negative parameter values position the bottom edge of the window
up from the bottom edge of the screen, or the right window edge to
the left of the right edge of the screen. It would probably be
better if the values were always counted from the left and top, so
that negative arguments would position the frame partly off the
top or left edge of the screen, but it seems inadvisable to change
that now.
- Function: frame-height &optional frame
- Function: frame-width &optional frame
These functions return the height and width of FRAME, measured in
lines and columns. If you don't supply FRAME, they use the
selected frame.
- Function: screen-height
- Function: screen-width
These functions are old aliases for `frame-height' and
`frame-width'. When you are using a non-window terminal, the size
of the frame is normally the same as the size of the terminal
screen.
- Function: frame-pixel-height &optional frame
- Function: frame-pixel-width &optional frame
These functions return the height and width of FRAME, measured in
pixels. If you don't supply FRAME, they use the selected frame.
- Function: frame-char-height &optional frame
- Function: frame-char-width &optional frame
These functions return the height and width of a character in
FRAME, measured in pixels. The values depend on the choice of
font. If you don't supply FRAME, these functions use the selected
frame.
- Function: set-frame-size frame cols rows
This function sets the size of FRAME, measured in characters; COLS
and ROWS specify the new width and height.
To set the size based on values measured in pixels, use
`frame-char-height' and `frame-char-width' to convert them to
units of characters.
- Function: set-frame-height frame lines &optional pretend
This function resizes FRAME to a height of LINES lines. The sizes
of existing windows in FRAME are altered proportionally to fit.
If PRETEND is non-`nil', then Emacs displays LINES lines of output
in FRAME, but does not change its value for the actual height of
the frame. This is only useful for a terminal frame. Using a
smaller height than the terminal actually implements may be useful
to reproduce behavior observed on a smaller screen, or if the
terminal malfunctions when using its whole screen. Setting the
frame height "for real" does not always work, because knowing the
correct actual size may be necessary for correct cursor
positioning on a terminal frame.
- Function: set-frame-width frame width &optional pretend
This function sets the width of FRAME, measured in characters.
The argument PRETEND has the same meaning as in `set-frame-height'.
The older functions `set-screen-height' and `set-screen-width' were
used to specify the height and width of the screen, in Emacs versions
that did not support multiple frames. They are semi-obsolete, but
still work; they apply to the selected frame.
- Function: x-parse-geometry geom
The function `x-parse-geometry' converts a standard X window
geometry string to an alist that you can use as part of the
argument to `make-frame'.
The alist describes which parameters were specified in GEOM, and
gives the values specified for them. Each element looks like
`(PARAMETER . VALUE)'. The possible PARAMETER values are `left',
`top', `width', and `height'.
For the size parameters, the value must be an integer. The
position parameter names `left' and `top' are not totally accurate,
because some values indicate the position of the right or bottom
edges instead. These are the VALUE possibilities for the position
parameters:
an integer
A positive integer relates the left edge or top edge of the
window to the left or top edge of the screen. A negative
integer relates the right or bottom edge of the window to the
right or bottom edge of the screen.
`(+ POSITION)'
This specifies the position of the left or top edge of the
window relative to the left or top edge of the screen. The
integer POSITION may be positive or negative; a negative
value specifies a position outside the screen.
`(- POSITION)'
This specifies the position of the right or bottom edge of
the window relative to the right or bottom edge of the
screen. The integer POSITION may be positive or negative; a
negative value specifies a position outside the screen.
Here is an example:
(x-parse-geometry "35x70+0-0")
=> ((height . 70) (width . 35)
(top - 0) (left . 0))