+2014-07-24 Dmitry Antipov <dmantipov@yandex.ru>
+
+ Fix error reported by Angelo Graziosi <angelo.graziosi@alice.it> in
+ <http://lists.gnu.org/archive/html/emacs-devel/2014-07/msg00274.html>
+ and complete previous change.
+ * frame.c (adjust_frame_height): New function.
+ (Fset_frame_height, Fset_frame_size): Use it.
+ (x_set_frame_parameters): Take frame top margin into account.
+
2014-07-23 Dmitry Antipov <dmantipov@yandex.ru>
* frame.c (Fset_frame_height): Take frame top margin into account.
{
return make_number (FRAME_BOTTOM_DIVIDER_WIDTH (decode_any_frame (frame)));
}
-\f
+
+/* For requested height in *HEIGHTP, calculate new height of frame F in
+ character units and return true if actual height should be changed. */
+
+static bool
+adjust_frame_height (struct frame *f, int *heightp)
+{
+ if (FRAME_LINES (f) - FRAME_TOP_MARGIN (f) != *heightp)
+ {
+ *heightp += FRAME_TOP_MARGIN (f);
+ return 1;
+ }
+ return 0;
+}
+
DEFUN ("set-frame-height", Fset_frame_height, Sset_frame_height, 2, 4, 0,
doc: /* Specify that the frame FRAME has HEIGHT text lines.
Optional third arg PRETEND non-nil means that redisplay should use
{
if (NILP (pixelwise))
{
- if (FRAME_LINES (f) - FRAME_TOP_MARGIN (f) != XINT (height))
- x_set_window_size (f, 1, FRAME_COLS (f),
- XINT (height) + FRAME_TOP_MARGIN (f), 0);
+ int h = XINT (height);
+
+ if (adjust_frame_height (f, &h))
+ x_set_window_size (f, 1, FRAME_COLS (f), h, 0);
do_pending_window_change (0);
}
#ifdef HAVE_WINDOW_SYSTEM
if (FRAME_WINDOW_P (f))
{
+ int h = XINT (height);
+
if (!NILP (pixelwise)
? (XINT (width) != FRAME_TEXT_WIDTH (f)
- || XINT (height) != FRAME_TEXT_HEIGHT (f)
+ || h != FRAME_TEXT_HEIGHT (f)
|| f->new_height || f->new_width)
- : (XINT (width) != FRAME_COLS (f)
- || XINT (height) != FRAME_LINES (f)
+ : (adjust_frame_height (f, &h)
+ || XINT (width) != FRAME_COLS (f)
|| f->new_height || f->new_width))
{
- x_set_window_size (f, 1, XINT (width), XINT (height),
+ x_set_window_size (f, 1, XINT (width), h,
NILP (pixelwise) ? 0 : 1);
do_pending_window_change (0);
}
else if (EQ (prop, Qheight) && RANGED_INTEGERP (0, val, INT_MAX))
{
height_change = 1;
- height = XFASTINT (val) * FRAME_LINE_HEIGHT (f);
+ /* Add menu and tool bar lines to correctly resize F pixelwise. */
+ height
+ = (XFASTINT (val) + FRAME_TOP_MARGIN (f)) * FRAME_LINE_HEIGHT (f);
}
else if (EQ (prop, Qtop))
top = val;