diff options
| author | Dmitry Antipov | 2014-07-24 09:49:14 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2014-07-24 09:49:14 +0400 |
| commit | d6a393dd19e89519e96025168c4bf06a2d93f23d (patch) | |
| tree | 6bb51a7193550f759cca1e0f6330ad39dff07029 /src | |
| parent | 5fc3a9f5162ca6d8cd70586802e83e1a2c3cfdb0 (diff) | |
| download | emacs-d6a393dd19e89519e96025168c4bf06a2d93f23d.tar.gz emacs-d6a393dd19e89519e96025168c4bf06a2d93f23d.zip | |
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.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 9 | ||||
| -rw-r--r-- | src/frame.c | 37 |
2 files changed, 37 insertions, 9 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 51d77283ffd..f5ef9cedf28 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,12 @@ | |||
| 1 | 2014-07-24 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 2 | |||
| 3 | Fix error reported by Angelo Graziosi <angelo.graziosi@alice.it> in | ||
| 4 | <http://lists.gnu.org/archive/html/emacs-devel/2014-07/msg00274.html> | ||
| 5 | and complete previous change. | ||
| 6 | * frame.c (adjust_frame_height): New function. | ||
| 7 | (Fset_frame_height, Fset_frame_size): Use it. | ||
| 8 | (x_set_frame_parameters): Take frame top margin into account. | ||
| 9 | |||
| 1 | 2014-07-23 Dmitry Antipov <dmantipov@yandex.ru> | 10 | 2014-07-23 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 11 | ||
| 3 | * frame.c (Fset_frame_height): Take frame top margin into account. | 12 | * frame.c (Fset_frame_height): Take frame top margin into account. |
diff --git a/src/frame.c b/src/frame.c index e68a3db24ea..80046bee788 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -2565,7 +2565,21 @@ DEFUN ("frame-bottom-divider-width", Fbottom_divider_width, Sbottom_divider_widt | |||
| 2565 | { | 2565 | { |
| 2566 | return make_number (FRAME_BOTTOM_DIVIDER_WIDTH (decode_any_frame (frame))); | 2566 | return make_number (FRAME_BOTTOM_DIVIDER_WIDTH (decode_any_frame (frame))); |
| 2567 | } | 2567 | } |
| 2568 | 2568 | ||
| 2569 | /* For requested height in *HEIGHTP, calculate new height of frame F in | ||
| 2570 | character units and return true if actual height should be changed. */ | ||
| 2571 | |||
| 2572 | static bool | ||
| 2573 | adjust_frame_height (struct frame *f, int *heightp) | ||
| 2574 | { | ||
| 2575 | if (FRAME_LINES (f) - FRAME_TOP_MARGIN (f) != *heightp) | ||
| 2576 | { | ||
| 2577 | *heightp += FRAME_TOP_MARGIN (f); | ||
| 2578 | return 1; | ||
| 2579 | } | ||
| 2580 | return 0; | ||
| 2581 | } | ||
| 2582 | |||
| 2569 | DEFUN ("set-frame-height", Fset_frame_height, Sset_frame_height, 2, 4, 0, | 2583 | DEFUN ("set-frame-height", Fset_frame_height, Sset_frame_height, 2, 4, 0, |
| 2570 | doc: /* Specify that the frame FRAME has HEIGHT text lines. | 2584 | doc: /* Specify that the frame FRAME has HEIGHT text lines. |
| 2571 | Optional third arg PRETEND non-nil means that redisplay should use | 2585 | Optional third arg PRETEND non-nil means that redisplay should use |
| @@ -2584,9 +2598,10 @@ FRAME should be HEIGHT pixels high. */) | |||
| 2584 | { | 2598 | { |
| 2585 | if (NILP (pixelwise)) | 2599 | if (NILP (pixelwise)) |
| 2586 | { | 2600 | { |
| 2587 | if (FRAME_LINES (f) - FRAME_TOP_MARGIN (f) != XINT (height)) | 2601 | int h = XINT (height); |
| 2588 | x_set_window_size (f, 1, FRAME_COLS (f), | 2602 | |
| 2589 | XINT (height) + FRAME_TOP_MARGIN (f), 0); | 2603 | if (adjust_frame_height (f, &h)) |
| 2604 | x_set_window_size (f, 1, FRAME_COLS (f), h, 0); | ||
| 2590 | 2605 | ||
| 2591 | do_pending_window_change (0); | 2606 | do_pending_window_change (0); |
| 2592 | } | 2607 | } |
| @@ -2653,15 +2668,17 @@ Optional argument PIXELWISE non-nil means to measure in pixels. */) | |||
| 2653 | #ifdef HAVE_WINDOW_SYSTEM | 2668 | #ifdef HAVE_WINDOW_SYSTEM |
| 2654 | if (FRAME_WINDOW_P (f)) | 2669 | if (FRAME_WINDOW_P (f)) |
| 2655 | { | 2670 | { |
| 2671 | int h = XINT (height); | ||
| 2672 | |||
| 2656 | if (!NILP (pixelwise) | 2673 | if (!NILP (pixelwise) |
| 2657 | ? (XINT (width) != FRAME_TEXT_WIDTH (f) | 2674 | ? (XINT (width) != FRAME_TEXT_WIDTH (f) |
| 2658 | || XINT (height) != FRAME_TEXT_HEIGHT (f) | 2675 | || h != FRAME_TEXT_HEIGHT (f) |
| 2659 | || f->new_height || f->new_width) | 2676 | || f->new_height || f->new_width) |
| 2660 | : (XINT (width) != FRAME_COLS (f) | 2677 | : (adjust_frame_height (f, &h) |
| 2661 | || XINT (height) != FRAME_LINES (f) | 2678 | || XINT (width) != FRAME_COLS (f) |
| 2662 | || f->new_height || f->new_width)) | 2679 | || f->new_height || f->new_width)) |
| 2663 | { | 2680 | { |
| 2664 | x_set_window_size (f, 1, XINT (width), XINT (height), | 2681 | x_set_window_size (f, 1, XINT (width), h, |
| 2665 | NILP (pixelwise) ? 0 : 1); | 2682 | NILP (pixelwise) ? 0 : 1); |
| 2666 | do_pending_window_change (0); | 2683 | do_pending_window_change (0); |
| 2667 | } | 2684 | } |
| @@ -2865,7 +2882,9 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist) | |||
| 2865 | else if (EQ (prop, Qheight) && RANGED_INTEGERP (0, val, INT_MAX)) | 2882 | else if (EQ (prop, Qheight) && RANGED_INTEGERP (0, val, INT_MAX)) |
| 2866 | { | 2883 | { |
| 2867 | height_change = 1; | 2884 | height_change = 1; |
| 2868 | height = XFASTINT (val) * FRAME_LINE_HEIGHT (f); | 2885 | /* Add menu and tool bar lines to correctly resize F pixelwise. */ |
| 2886 | height | ||
| 2887 | = (XFASTINT (val) + FRAME_TOP_MARGIN (f)) * FRAME_LINE_HEIGHT (f); | ||
| 2869 | } | 2888 | } |
| 2870 | else if (EQ (prop, Qtop)) | 2889 | else if (EQ (prop, Qtop)) |
| 2871 | top = val; | 2890 | top = val; |