Function: set-frame-size-and-position-pixelwise
set-frame-size-and-position-pixelwise is a function defined in
frame.c.
Signature
(set-frame-size-and-position-pixelwise FRAME WIDTH HEIGHT X Y &optional GRAVITY)
Documentation
Set FRAME's size to WIDTH and HEIGHT and its position to (X, Y).
FRAME must be a live frame and defaults to the selected one.
WIDTH and HEIGHT must be positive integers and specify the new pixel
width and height of FRAME's text area in pixels. If WIDTH or HEIGHT do
not specify a value that is a multiple of FRAME's character sizes, you
may have to set frame-resize-pixelwise to a non-nil value in order to
get the exact size in pixels.
X and Y specify the coordinates of the left and top edge of FRAME's outer frame in pixels relative to an origin (0, 0) of FRAME's display or parent frame. Negative values mean the top or left edge may be outside the display or parent frame.
GRAVITY specifies the new gravity of FRAME and must be a value in the range 0..10. It defaults to 1.
This function uses any existing backend of the toolkit to resize and
move FRAME in one compound step. If the backend does not provide such a
function, it calls set-frame-size followed by set-frame-position
instead. See 'set-frame-size-and-position'.
Probably introduced at or before Emacs version 31.1.
Source Code
// Defined in /usr/src/emacs/src/frame.c
{
struct frame *f = decode_live_frame (frame);
if (NILP (gravity))
f->win_gravity = 1;
else
f->win_gravity = check_integer_range (gravity, 0, 10);
if (FRAME_WINDOW_P (f)
&& FRAME_TERMINAL (f)->set_window_size_and_position_hook)
{
int text_width = check_integer_range (width, 1, INT_MAX);
int text_height = check_integer_range (height, 1, INT_MAX);
f->left_pos = check_integer_range (x, INT_MIN, INT_MAX);
f->top_pos = check_integer_range (y, INT_MIN, INT_MAX);
adjust_frame_size (f, text_width, text_height, 1, false,
Qsize_and_position);
}
else
{
Fset_frame_size (frame, width, height, Qt);
int left_pos = check_integer_range (x, INT_MIN, INT_MAX);
int top_pos = check_integer_range (y, INT_MIN, INT_MAX);
Lisp_Object left
= Fcons (Qleft, left_pos < 0 ? list2 (Qplus, x) : x);
Lisp_Object top
= Fcons (Qtop, top_pos < 0 ? list2 (Qplus, y) : y);
Fmodify_frame_parameters (frame, list2 (left, top));
}
return Qnil;
}