emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117567: Fix error reported by Angelo Graziosi <addr


From: Dmitry Antipov
Subject: [Emacs-diffs] trunk r117567: Fix error reported by Angelo Graziosi <address@hidden> in
Date: Thu, 24 Jul 2014 05:49:54 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117567
revision-id: address@hidden
parent: address@hidden
committer: Dmitry Antipov <address@hidden>
branch nick: trunk
timestamp: Thu 2014-07-24 09:49:14 +0400
message:
  Fix error reported by Angelo Graziosi <address@hidden> 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.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/frame.c                    frame.c-20091113204419-o5vbwnq5f7feedwu-243
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-07-23 16:09:34 +0000
+++ b/src/ChangeLog     2014-07-24 05:49:14 +0000
@@ -1,3 +1,12 @@
+2014-07-24  Dmitry Antipov  <address@hidden>
+
+       Fix error reported by Angelo Graziosi <address@hidden> 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  <address@hidden>
 
        * frame.c (Fset_frame_height): Take frame top margin into account.

=== modified file 'src/frame.c'
--- a/src/frame.c       2014-07-23 16:09:34 +0000
+++ b/src/frame.c       2014-07-24 05:49:14 +0000
@@ -2565,7 +2565,21 @@
 {
   return make_number (FRAME_BOTTOM_DIVIDER_WIDTH (decode_any_frame (frame)));
 }
-
+
+/* 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
@@ -2584,9 +2598,10 @@
     {
       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);
        }
@@ -2653,15 +2668,17 @@
 #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);
        }
@@ -2865,7 +2882,9 @@
       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;


reply via email to

[Prev in Thread] Current Thread [Next in Thread]