diff options
| author | Martin Rudalics | 2015-01-12 08:18:00 +0100 |
|---|---|---|
| committer | Martin Rudalics | 2015-01-12 08:18:00 +0100 |
| commit | fb35f1f715da1a931204894b132d7fb6eee0f361 (patch) | |
| tree | dfbedd451cf16a9b6f92bdb551e23b262f110fdb /src | |
| parent | d703a4dce564ede122f5c307889e4bd0e3f3e75c (diff) | |
| download | emacs-fb35f1f715da1a931204894b132d7fb6eee0f361.tar.gz emacs-fb35f1f715da1a931204894b132d7fb6eee0f361.zip | |
Adjust frame heights to real height of tool bar.
* frame.el (frame-notice-user-settings): Remove code dealing with
frame-initial-frame-tool-bar-height. Turn off `tool-bar-mode'
only if `window-system-frame-alist' or `default-frame-alist' ask
for it.
(make-frame): Update frame-adjust-size-history if needed.
* dispnew.c (change_frame_size_1): Pass Qchange_frame_size to
adjust_frame_size.
* frame.c (frame_default_tool_bar_height): New variable.
(adjust_frame_size): Possibly add requested adjustment to
Vframe_adjust_size_history.
(make_frame): Initialize tool_bar_redisplayed_once slot.
(Fset_frame_height, Fset_frame_width, Fset_frame_size): Clarify
doc-string. Call adjust_frame_size unconditionally (the frame's
text size may remain unaltered but the pixel size may change).
(x_figure_window_size): If frame_default_tool_bar_height was
set, use it instead of calculating the tool bar height from
DEFAULT_TOOL_BAR_IMAGE_HEIGHT. Don't set
Vframe_initial_frame_tool_bar_height.
(Qchange_frame_size, Qxg_frame_set_char_size)
(Qset_window_configuration, Qx_create_frame_1)
(Qx_create_frame_2): New symbols.
(Vframe_initial_frame_tool_bar_height): Remove.
(Vframe_adjust_size_history): New history variable for debugging
frame size adjustments.
* frame.h (struct frame): New boolean slot
tool_bar_redisplayed_once.
(frame_default_tool_bar_height): Extern.
* gtkutil.c (xg_frame_set_char_size): Pass Qxg_frame_set_char_size
to adjust_frame_size.
* nsfns.m (Fx_create_frame): Pass Pass Qx_create_frame_1 and
Qx_create_frame_2 to adjust_frame_size.
* w32fns.c (x_change_tool_bar_height): Call adjust_frame_size with
inhibit 1 when we have not redisplayed the tool bar yet.
(Fx_create_frame): Pass Pass Qx_create_frame_1 and
Qx_create_frame_2 to adjust_frame_size.
* w32menu.c (set_frame_menubar): Simplify adjust_frame_size
call.
* window.c (Fset_window_configuration): Pass
Qset_window_configuration to adjust_frame_size.
* xdisp.c (redisplay_tool_bar): Assign new height to
frame_default_tool_bar_height.
(redisplay_internal): If we haven't redisplayed this frame's
tool bar, call redisplay_tool_bar early so we can adjust the
frame size accordingly.
* xfns.c (x_change_tool_bar_height): Call adjust_frame_size with
inhibit 1 when we have not redisplayed the tool bar yet.
(Fx_create_frame): Pass Pass Qx_create_frame_1 and
Qx_create_frame_2 to adjust_frame_size.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 46 | ||||
| -rw-r--r-- | src/dispnew.c | 3 | ||||
| -rw-r--r-- | src/frame.c | 102 | ||||
| -rw-r--r-- | src/frame.h | 6 | ||||
| -rw-r--r-- | src/gtkutil.c | 2 | ||||
| -rw-r--r-- | src/nsfns.m | 6 | ||||
| -rw-r--r-- | src/w32fns.c | 13 | ||||
| -rw-r--r-- | src/w32menu.c | 3 | ||||
| -rw-r--r-- | src/window.c | 2 | ||||
| -rw-r--r-- | src/xdisp.c | 13 | ||||
| -rw-r--r-- | src/xfns.c | 13 |
11 files changed, 165 insertions, 44 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 75e9ad51835..ea6274f11f1 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,49 @@ | |||
| 1 | 2015-01-12 Martin Rudalics <rudalics@gmx.at> | ||
| 2 | |||
| 3 | * dispnew.c (change_frame_size_1): Pass Qchange_frame_size to | ||
| 4 | adjust_frame_size. | ||
| 5 | * frame.c (frame_default_tool_bar_height): New variable. | ||
| 6 | (adjust_frame_size): Possibly add requested adjustment to | ||
| 7 | Vframe_adjust_size_history. | ||
| 8 | (make_frame): Initialize tool_bar_redisplayed_once slot. | ||
| 9 | (Fset_frame_height, Fset_frame_width, Fset_frame_size): Clarify | ||
| 10 | doc-string. Call adjust_frame_size unconditionally (the frame's | ||
| 11 | text size may remain unaltered but the pixel size may change). | ||
| 12 | (x_figure_window_size): If frame_default_tool_bar_height was | ||
| 13 | set, use it instead of calculating the tool bar height from | ||
| 14 | DEFAULT_TOOL_BAR_IMAGE_HEIGHT. Don't set | ||
| 15 | Vframe_initial_frame_tool_bar_height. | ||
| 16 | (Qchange_frame_size, Qxg_frame_set_char_size) | ||
| 17 | (Qset_window_configuration, Qx_create_frame_1) | ||
| 18 | (Qx_create_frame_2): New symbols. | ||
| 19 | (Vframe_initial_frame_tool_bar_height): Remove. | ||
| 20 | (Vframe_adjust_size_history): New history variable for debugging | ||
| 21 | frame size adjustments. | ||
| 22 | * frame.h (struct frame): New boolean slot | ||
| 23 | tool_bar_redisplayed_once. | ||
| 24 | (frame_default_tool_bar_height): Extern. | ||
| 25 | * gtkutil.c (xg_frame_set_char_size): Pass Qxg_frame_set_char_size | ||
| 26 | to adjust_frame_size. | ||
| 27 | * nsfns.m (Fx_create_frame): Pass Pass Qx_create_frame_1 and | ||
| 28 | Qx_create_frame_2 to adjust_frame_size. | ||
| 29 | * w32fns.c (x_change_tool_bar_height): Call adjust_frame_size with | ||
| 30 | inhibit 1 when we have not redisplayed the tool bar yet. | ||
| 31 | (Fx_create_frame): Pass Pass Qx_create_frame_1 and | ||
| 32 | Qx_create_frame_2 to adjust_frame_size. | ||
| 33 | * w32menu.c (set_frame_menubar): Simplify adjust_frame_size | ||
| 34 | call. | ||
| 35 | * window.c (Fset_window_configuration): Pass | ||
| 36 | Qset_window_configuration to adjust_frame_size. | ||
| 37 | * xdisp.c (redisplay_tool_bar): Assign new height to | ||
| 38 | frame_default_tool_bar_height. | ||
| 39 | (redisplay_internal): If we haven't redisplayed this frame's | ||
| 40 | tool bar, call redisplay_tool_bar early so we can adjust the | ||
| 41 | frame size accordingly. | ||
| 42 | * xfns.c (x_change_tool_bar_height): Call adjust_frame_size with | ||
| 43 | inhibit 1 when we have not redisplayed the tool bar yet. | ||
| 44 | (Fx_create_frame): Pass Pass Qx_create_frame_1 and | ||
| 45 | Qx_create_frame_2 to adjust_frame_size. | ||
| 46 | |||
| 1 | 2015-01-12 Paul Eggert <eggert@cs.ucla.edu> | 47 | 2015-01-12 Paul Eggert <eggert@cs.ucla.edu> |
| 2 | 48 | ||
| 3 | Have 'make' output better GEN names | 49 | Have 'make' output better GEN names |
diff --git a/src/dispnew.c b/src/dispnew.c index cefcd0809a0..a643d58e492 100644 --- a/src/dispnew.c +++ b/src/dispnew.c | |||
| @@ -5523,7 +5523,8 @@ change_frame_size_1 (struct frame *f, int new_width, int new_height, | |||
| 5523 | 5523 | ||
| 5524 | /* Adjust frame size but make sure x_set_window_size does not | 5524 | /* Adjust frame size but make sure x_set_window_size does not |
| 5525 | get called. */ | 5525 | get called. */ |
| 5526 | adjust_frame_size (f, new_width, new_height, 5, pretend, Qnil); | 5526 | adjust_frame_size (f, new_width, new_height, 5, pretend, |
| 5527 | Qchange_frame_size); | ||
| 5527 | } | 5528 | } |
| 5528 | } | 5529 | } |
| 5529 | 5530 | ||
diff --git a/src/frame.c b/src/frame.c index 3d2ffbf624f..0eb51bd786c 100644 --- a/src/frame.c +++ b/src/frame.c | |||
| @@ -67,6 +67,9 @@ static struct frame *last_nonminibuf_frame; | |||
| 67 | /* False means there are no visible garbaged frames. */ | 67 | /* False means there are no visible garbaged frames. */ |
| 68 | bool frame_garbaged; | 68 | bool frame_garbaged; |
| 69 | 69 | ||
| 70 | /* The default tool bar height for future frames. */ | ||
| 71 | int frame_default_tool_bar_height; | ||
| 72 | |||
| 70 | #ifdef HAVE_WINDOW_SYSTEM | 73 | #ifdef HAVE_WINDOW_SYSTEM |
| 71 | static void x_report_frame_params (struct frame *, Lisp_Object *); | 74 | static void x_report_frame_params (struct frame *, Lisp_Object *); |
| 72 | #endif | 75 | #endif |
| @@ -358,6 +361,20 @@ adjust_frame_size (struct frame *f, int new_width, int new_height, int inhibit, | |||
| 358 | Lisp_Object frame; | 361 | Lisp_Object frame; |
| 359 | 362 | ||
| 360 | XSETFRAME (frame, f); | 363 | XSETFRAME (frame, f); |
| 364 | |||
| 365 | /* `make-frame' initializes Vframe_adjust_size_history to (Qt) and | ||
| 366 | strips its car when exiting. Just in case make sure its size never | ||
| 367 | exceeds 100. */ | ||
| 368 | if (!NILP (Fconsp (Vframe_adjust_size_history)) | ||
| 369 | && EQ (Fcar (Vframe_adjust_size_history), Qt) | ||
| 370 | && XFASTINT (Fsafe_length (Vframe_adjust_size_history)) <= 100) | ||
| 371 | Vframe_adjust_size_history = | ||
| 372 | Fcons (Qt, Fcons (list5 (make_number (0), | ||
| 373 | make_number (new_text_width), | ||
| 374 | make_number (new_text_height), | ||
| 375 | make_number (inhibit), parameter), | ||
| 376 | Fcdr (Vframe_adjust_size_history))); | ||
| 377 | |||
| 361 | /* The following two values are calculated from the old window body | 378 | /* The following two values are calculated from the old window body |
| 362 | sizes and any "new" settings for scroll bars, dividers, fringes and | 379 | sizes and any "new" settings for scroll bars, dividers, fringes and |
| 363 | margins (though the latter should have been processed already). */ | 380 | margins (though the latter should have been processed already). */ |
| @@ -425,6 +442,17 @@ adjust_frame_size (struct frame *f, int new_width, int new_height, int inhibit, | |||
| 425 | else if (inhibit_vertical) | 442 | else if (inhibit_vertical) |
| 426 | new_text_height = old_text_height; | 443 | new_text_height = old_text_height; |
| 427 | 444 | ||
| 445 | if (!NILP (Fconsp (Vframe_adjust_size_history)) | ||
| 446 | && EQ (Fcar (Vframe_adjust_size_history), Qt) | ||
| 447 | && XFASTINT (Fsafe_length (Vframe_adjust_size_history)) <= 100) | ||
| 448 | Vframe_adjust_size_history = | ||
| 449 | Fcons (Qt, Fcons (list5 (make_number (1), | ||
| 450 | make_number (new_text_width), | ||
| 451 | make_number (new_text_height), | ||
| 452 | make_number (new_cols), | ||
| 453 | make_number (new_lines)), | ||
| 454 | Fcdr (Vframe_adjust_size_history))); | ||
| 455 | |||
| 428 | x_set_window_size (f, 0, new_text_width, new_text_height, 1); | 456 | x_set_window_size (f, 0, new_text_width, new_text_height, 1); |
| 429 | f->resized_p = true; | 457 | f->resized_p = true; |
| 430 | 458 | ||
| @@ -496,6 +524,17 @@ adjust_frame_size (struct frame *f, int new_width, int new_height, int inhibit, | |||
| 496 | SET_FRAME_COLS (f, new_cols); | 524 | SET_FRAME_COLS (f, new_cols); |
| 497 | SET_FRAME_LINES (f, new_lines); | 525 | SET_FRAME_LINES (f, new_lines); |
| 498 | 526 | ||
| 527 | if (!NILP (Fconsp (Vframe_adjust_size_history)) | ||
| 528 | && EQ (Fcar (Vframe_adjust_size_history), Qt) | ||
| 529 | && XFASTINT (Fsafe_length (Vframe_adjust_size_history)) <= 100) | ||
| 530 | Vframe_adjust_size_history = | ||
| 531 | Fcons (Qt, Fcons (list5 (make_number (2), | ||
| 532 | make_number (new_text_width), | ||
| 533 | make_number (new_text_height), | ||
| 534 | make_number (new_cols), | ||
| 535 | make_number (new_lines)), | ||
| 536 | Fcdr (Vframe_adjust_size_history))); | ||
| 537 | |||
| 499 | { | 538 | { |
| 500 | struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f)); | 539 | struct window *w = XWINDOW (FRAME_SELECTED_WINDOW (f)); |
| 501 | int text_area_x, text_area_y, text_area_width, text_area_height; | 540 | int text_area_x, text_area_y, text_area_width, text_area_height; |
| @@ -554,6 +593,7 @@ make_frame (bool mini_p) | |||
| 554 | f->garbaged = true; | 593 | f->garbaged = true; |
| 555 | f->can_x_set_window_size = false; | 594 | f->can_x_set_window_size = false; |
| 556 | f->can_run_window_configuration_change_hook = false; | 595 | f->can_run_window_configuration_change_hook = false; |
| 596 | f->tool_bar_redisplayed_once = false; | ||
| 557 | f->column_width = 1; /* !FRAME_WINDOW_P value. */ | 597 | f->column_width = 1; /* !FRAME_WINDOW_P value. */ |
| 558 | f->line_height = 1; /* !FRAME_WINDOW_P value. */ | 598 | f->line_height = 1; /* !FRAME_WINDOW_P value. */ |
| 559 | #ifdef HAVE_WINDOW_SYSTEM | 599 | #ifdef HAVE_WINDOW_SYSTEM |
| @@ -2808,7 +2848,7 @@ DEFUN ("frame-bottom-divider-width", Fbottom_divider_width, Sbottom_divider_widt | |||
| 2808 | } | 2848 | } |
| 2809 | 2849 | ||
| 2810 | DEFUN ("set-frame-height", Fset_frame_height, Sset_frame_height, 2, 4, 0, | 2850 | DEFUN ("set-frame-height", Fset_frame_height, Sset_frame_height, 2, 4, 0, |
| 2811 | doc: /* Set height of frame FRAME to HEIGHT lines. | 2851 | doc: /* Set text height of frame FRAME to HEIGHT lines. |
| 2812 | Optional third arg PRETEND non-nil means that redisplay should use | 2852 | Optional third arg PRETEND non-nil means that redisplay should use |
| 2813 | HEIGHT lines but that the idea of the actual height of the frame should | 2853 | HEIGHT lines but that the idea of the actual height of the frame should |
| 2814 | not be changed. | 2854 | not be changed. |
| @@ -2827,14 +2867,13 @@ multiple of the default frame font height. */) | |||
| 2827 | pixel_height = (!NILP (pixelwise) | 2867 | pixel_height = (!NILP (pixelwise) |
| 2828 | ? XINT (height) | 2868 | ? XINT (height) |
| 2829 | : XINT (height) * FRAME_LINE_HEIGHT (f)); | 2869 | : XINT (height) * FRAME_LINE_HEIGHT (f)); |
| 2830 | if (pixel_height != FRAME_TEXT_HEIGHT (f)) | 2870 | adjust_frame_size (f, -1, pixel_height, 1, !NILP (pretend), Qheight); |
| 2831 | adjust_frame_size (f, -1, pixel_height, 1, !NILP (pretend), Qheight); | ||
| 2832 | 2871 | ||
| 2833 | return Qnil; | 2872 | return Qnil; |
| 2834 | } | 2873 | } |
| 2835 | 2874 | ||
| 2836 | DEFUN ("set-frame-width", Fset_frame_width, Sset_frame_width, 2, 4, 0, | 2875 | DEFUN ("set-frame-width", Fset_frame_width, Sset_frame_width, 2, 4, 0, |
| 2837 | doc: /* Set width of frame FRAME to WIDTH columns. | 2876 | doc: /* Set text width of frame FRAME to WIDTH columns. |
| 2838 | Optional third arg PRETEND non-nil means that redisplay should use WIDTH | 2877 | Optional third arg PRETEND non-nil means that redisplay should use WIDTH |
| 2839 | columns but that the idea of the actual width of the frame should not | 2878 | columns but that the idea of the actual width of the frame should not |
| 2840 | be changed. | 2879 | be changed. |
| @@ -2853,14 +2892,13 @@ multiple of the default frame font width. */) | |||
| 2853 | pixel_width = (!NILP (pixelwise) | 2892 | pixel_width = (!NILP (pixelwise) |
| 2854 | ? XINT (width) | 2893 | ? XINT (width) |
| 2855 | : XINT (width) * FRAME_COLUMN_WIDTH (f)); | 2894 | : XINT (width) * FRAME_COLUMN_WIDTH (f)); |
| 2856 | if (pixel_width != FRAME_TEXT_WIDTH (f)) | 2895 | adjust_frame_size (f, pixel_width, -1, 1, !NILP (pretend), Qwidth); |
| 2857 | adjust_frame_size (f, pixel_width, -1, 1, !NILP (pretend), Qwidth); | ||
| 2858 | 2896 | ||
| 2859 | return Qnil; | 2897 | return Qnil; |
| 2860 | } | 2898 | } |
| 2861 | 2899 | ||
| 2862 | DEFUN ("set-frame-size", Fset_frame_size, Sset_frame_size, 3, 4, 0, | 2900 | DEFUN ("set-frame-size", Fset_frame_size, Sset_frame_size, 3, 4, 0, |
| 2863 | doc: /* Set size of FRAME to WIDTH by HEIGHT, measured in characters. | 2901 | doc: /* Set text size of FRAME to WIDTH by HEIGHT, measured in characters. |
| 2864 | Optional argument PIXELWISE non-nil means to measure in pixels. Note: | 2902 | Optional argument PIXELWISE non-nil means to measure in pixels. Note: |
| 2865 | When `frame-resize-pixelwise' is nil, some window managers may refuse to | 2903 | When `frame-resize-pixelwise' is nil, some window managers may refuse to |
| 2866 | honor a WIDTH that is not an integer multiple of the default frame font | 2904 | honor a WIDTH that is not an integer multiple of the default frame font |
| @@ -2880,10 +2918,7 @@ font height. */) | |||
| 2880 | pixel_height = (!NILP (pixelwise) | 2918 | pixel_height = (!NILP (pixelwise) |
| 2881 | ? XINT (height) | 2919 | ? XINT (height) |
| 2882 | : XINT (height) * FRAME_LINE_HEIGHT (f)); | 2920 | : XINT (height) * FRAME_LINE_HEIGHT (f)); |
| 2883 | 2921 | adjust_frame_size (f, pixel_width, pixel_height, 1, 0, Qsize); | |
| 2884 | if (pixel_width != FRAME_TEXT_WIDTH (f) | ||
| 2885 | || pixel_height != FRAME_TEXT_HEIGHT (f)) | ||
| 2886 | adjust_frame_size (f, pixel_width, pixel_height, 1, 0, Qsize); | ||
| 2887 | 2922 | ||
| 2888 | return Qnil; | 2923 | return Qnil; |
| 2889 | } | 2924 | } |
| @@ -4492,23 +4527,27 @@ x_figure_window_size (struct frame *f, Lisp_Object parms, bool toolbar_p) | |||
| 4492 | frames without having to guess how tall the tool bar will get. */ | 4527 | frames without having to guess how tall the tool bar will get. */ |
| 4493 | if (toolbar_p && FRAME_TOOL_BAR_LINES (f)) | 4528 | if (toolbar_p && FRAME_TOOL_BAR_LINES (f)) |
| 4494 | { | 4529 | { |
| 4495 | int margin, relief; | 4530 | if (frame_default_tool_bar_height) |
| 4531 | FRAME_TOOL_BAR_HEIGHT (f) = frame_default_tool_bar_height; | ||
| 4532 | else | ||
| 4533 | { | ||
| 4534 | int margin, relief; | ||
| 4496 | 4535 | ||
| 4497 | relief = (tool_bar_button_relief >= 0 | 4536 | relief = (tool_bar_button_relief >= 0 |
| 4498 | ? tool_bar_button_relief | 4537 | ? tool_bar_button_relief |
| 4499 | : DEFAULT_TOOL_BAR_BUTTON_RELIEF); | 4538 | : DEFAULT_TOOL_BAR_BUTTON_RELIEF); |
| 4500 | 4539 | ||
| 4501 | if (RANGED_INTEGERP (1, Vtool_bar_button_margin, INT_MAX)) | 4540 | if (RANGED_INTEGERP (1, Vtool_bar_button_margin, INT_MAX)) |
| 4502 | margin = XFASTINT (Vtool_bar_button_margin); | 4541 | margin = XFASTINT (Vtool_bar_button_margin); |
| 4503 | else if (CONSP (Vtool_bar_button_margin) | 4542 | else if (CONSP (Vtool_bar_button_margin) |
| 4504 | && RANGED_INTEGERP (1, XCDR (Vtool_bar_button_margin), INT_MAX)) | 4543 | && RANGED_INTEGERP (1, XCDR (Vtool_bar_button_margin), INT_MAX)) |
| 4505 | margin = XFASTINT (XCDR (Vtool_bar_button_margin)); | 4544 | margin = XFASTINT (XCDR (Vtool_bar_button_margin)); |
| 4506 | else | 4545 | else |
| 4507 | margin = 0; | 4546 | margin = 0; |
| 4508 | 4547 | ||
| 4509 | FRAME_TOOL_BAR_HEIGHT (f) | 4548 | FRAME_TOOL_BAR_HEIGHT (f) |
| 4510 | = DEFAULT_TOOL_BAR_IMAGE_HEIGHT + 2 * margin + 2 * relief; | 4549 | = DEFAULT_TOOL_BAR_IMAGE_HEIGHT + 2 * margin + 2 * relief; |
| 4511 | Vframe_initial_frame_tool_bar_height = make_number (FRAME_TOOL_BAR_HEIGHT (f)); | 4550 | } |
| 4512 | } | 4551 | } |
| 4513 | 4552 | ||
| 4514 | top = x_get_arg (dpyinfo, parms, Qtop, 0, 0, RES_TYPE_NUMBER); | 4553 | top = x_get_arg (dpyinfo, parms, Qtop, 0, 0, RES_TYPE_NUMBER); |
| @@ -4779,6 +4818,11 @@ syms_of_frame (void) | |||
| 4779 | DEFSYM (Qtool_bar_external, "tool-bar-external"); | 4818 | DEFSYM (Qtool_bar_external, "tool-bar-external"); |
| 4780 | DEFSYM (Qtool_bar_size, "tool-bar-size"); | 4819 | DEFSYM (Qtool_bar_size, "tool-bar-size"); |
| 4781 | DEFSYM (Qframe_inner_size, "frame-inner-size"); | 4820 | DEFSYM (Qframe_inner_size, "frame-inner-size"); |
| 4821 | DEFSYM (Qchange_frame_size, "change-frame-size"); | ||
| 4822 | DEFSYM (Qxg_frame_set_char_size, "xg-frame-set-char-size"); | ||
| 4823 | DEFSYM (Qset_window_configuration, "set-window-configuration"); | ||
| 4824 | DEFSYM (Qx_create_frame_1, "x-create-frame-1"); | ||
| 4825 | DEFSYM (Qx_create_frame_2, "x-create-frame-2"); | ||
| 4782 | 4826 | ||
| 4783 | #ifdef HAVE_NS | 4827 | #ifdef HAVE_NS |
| 4784 | DEFSYM (Qns_parse_geometry, "ns-parse-geometry"); | 4828 | DEFSYM (Qns_parse_geometry, "ns-parse-geometry"); |
| @@ -4968,10 +5012,6 @@ or call the function `tool-bar-mode'. */); | |||
| 4968 | Vtool_bar_mode = Qnil; | 5012 | Vtool_bar_mode = Qnil; |
| 4969 | #endif | 5013 | #endif |
| 4970 | 5014 | ||
| 4971 | DEFVAR_LISP ("frame-initial-frame-tool-bar-height", Vframe_initial_frame_tool_bar_height, | ||
| 4972 | doc: /* Height of tool bar of initial frame. */); | ||
| 4973 | Vframe_initial_frame_tool_bar_height = make_number (0); | ||
| 4974 | |||
| 4975 | DEFVAR_KBOARD ("default-minibuffer-frame", Vdefault_minibuffer_frame, | 5015 | DEFVAR_KBOARD ("default-minibuffer-frame", Vdefault_minibuffer_frame, |
| 4976 | doc: /* Minibufferless frames use this frame's minibuffer. | 5016 | doc: /* Minibufferless frames use this frame's minibuffer. |
| 4977 | Emacs cannot create minibufferless frames unless this is set to an | 5017 | Emacs cannot create minibufferless frames unless this is set to an |
| @@ -5050,6 +5090,10 @@ even if this option is non-nil. */); | |||
| 5050 | frame_inhibit_implied_resize = Qt; | 5090 | frame_inhibit_implied_resize = Qt; |
| 5051 | #endif | 5091 | #endif |
| 5052 | 5092 | ||
| 5093 | DEFVAR_LISP ("frame-adjust-size-history", Vframe_adjust_size_history, | ||
| 5094 | doc: /* History of frame size adjustments. */); | ||
| 5095 | Vframe_adjust_size_history = Qnil; | ||
| 5096 | |||
| 5053 | staticpro (&Vframe_list); | 5097 | staticpro (&Vframe_list); |
| 5054 | 5098 | ||
| 5055 | defsubr (&Sframep); | 5099 | defsubr (&Sframep); |
diff --git a/src/frame.h b/src/frame.h index d1ed4d4a67e..cb0044cfe23 100644 --- a/src/frame.h +++ b/src/frame.h | |||
| @@ -336,6 +336,10 @@ struct frame | |||
| 336 | for this frame. */ | 336 | for this frame. */ |
| 337 | bool_bf can_run_window_configuration_change_hook : 1; | 337 | bool_bf can_run_window_configuration_change_hook : 1; |
| 338 | 338 | ||
| 339 | /* True means tool bar has been redisplayed at least once in current | ||
| 340 | session. */ | ||
| 341 | bool_bf tool_bar_redisplayed_once : 1; | ||
| 342 | |||
| 339 | /* Bitfield area ends here. */ | 343 | /* Bitfield area ends here. */ |
| 340 | 344 | ||
| 341 | /* Number of lines (rounded up) of tool bar. REMOVE THIS */ | 345 | /* Number of lines (rounded up) of tool bar. REMOVE THIS */ |
| @@ -1096,6 +1100,8 @@ SET_FRAME_VISIBLE (struct frame *f, int v) | |||
| 1096 | 1100 | ||
| 1097 | extern Lisp_Object selected_frame; | 1101 | extern Lisp_Object selected_frame; |
| 1098 | 1102 | ||
| 1103 | extern int frame_default_tool_bar_height; | ||
| 1104 | |||
| 1099 | extern struct frame *decode_window_system_frame (Lisp_Object); | 1105 | extern struct frame *decode_window_system_frame (Lisp_Object); |
| 1100 | extern struct frame *decode_live_frame (Lisp_Object); | 1106 | extern struct frame *decode_live_frame (Lisp_Object); |
| 1101 | extern struct frame *decode_any_frame (Lisp_Object); | 1107 | extern struct frame *decode_any_frame (Lisp_Object); |
diff --git a/src/gtkutil.c b/src/gtkutil.c index bedac8451e2..694278a2b4c 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -954,7 +954,7 @@ xg_frame_set_char_size (struct frame *f, int width, int height) | |||
| 954 | x_wait_for_event (f, ConfigureNotify); | 954 | x_wait_for_event (f, ConfigureNotify); |
| 955 | } | 955 | } |
| 956 | else | 956 | else |
| 957 | adjust_frame_size (f, -1, -1, 5, 0, Qnil); | 957 | adjust_frame_size (f, -1, -1, 5, 0, Qxg_frame_set_char_size); |
| 958 | } | 958 | } |
| 959 | 959 | ||
| 960 | /* Handle height/width changes (i.e. add/remove/move menu/toolbar). | 960 | /* Handle height/width changes (i.e. add/remove/move menu/toolbar). |
diff --git a/src/nsfns.m b/src/nsfns.m index 828ee88e635..cc2e49641e8 100644 --- a/src/nsfns.m +++ b/src/nsfns.m | |||
| @@ -1251,7 +1251,8 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 1251 | 1251 | ||
| 1252 | /* Read comment about this code in corresponding place in xfns.c. */ | 1252 | /* Read comment about this code in corresponding place in xfns.c. */ |
| 1253 | adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), | 1253 | adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), |
| 1254 | FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 5, 1, Qnil); | 1254 | FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 5, 1, |
| 1255 | Qx_create_frame_1); | ||
| 1255 | 1256 | ||
| 1256 | /* The resources controlling the menu-bar and tool-bar are | 1257 | /* The resources controlling the menu-bar and tool-bar are |
| 1257 | processed specially at startup, and reflected in the mode | 1258 | processed specially at startup, and reflected in the mode |
| @@ -1325,7 +1326,8 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 1325 | /* Allow x_set_window_size, now. */ | 1326 | /* Allow x_set_window_size, now. */ |
| 1326 | f->can_x_set_window_size = true; | 1327 | f->can_x_set_window_size = true; |
| 1327 | 1328 | ||
| 1328 | adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f), 0, 1, Qnil); | 1329 | adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f), 0, 1, |
| 1330 | Qx_create_frame_2); | ||
| 1329 | 1331 | ||
| 1330 | if (! f->output_data.ns->explicit_parent) | 1332 | if (! f->output_data.ns->explicit_parent) |
| 1331 | { | 1333 | { |
diff --git a/src/w32fns.c b/src/w32fns.c index 789a91a3c96..3b8346a07fd 100644 --- a/src/w32fns.c +++ b/src/w32fns.c | |||
| @@ -1744,8 +1744,11 @@ x_change_tool_bar_height (struct frame *f, int height) | |||
| 1744 | /* Recalculate toolbar height. */ | 1744 | /* Recalculate toolbar height. */ |
| 1745 | f->n_tool_bar_rows = 0; | 1745 | f->n_tool_bar_rows = 0; |
| 1746 | 1746 | ||
| 1747 | adjust_frame_size (f, -1, -1, (old_height == 0 || height == 0) ? 2 : 4, 0, | 1747 | adjust_frame_size (f, -1, -1, |
| 1748 | Qtool_bar_lines); | 1748 | (!f->tool_bar_redisplayed_once ? 1 |
| 1749 | : (old_height == 0 || height == 0) ? 2 | ||
| 1750 | : 4), | ||
| 1751 | 0, Qtool_bar_lines); | ||
| 1749 | 1752 | ||
| 1750 | /* adjust_frame_size might not have done anything, garbage frame | 1753 | /* adjust_frame_size might not have done anything, garbage frame |
| 1751 | here. */ | 1754 | here. */ |
| @@ -4617,7 +4620,8 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 4617 | had one frame line vs one toolbar line which left us with a zero | 4620 | had one frame line vs one toolbar line which left us with a zero |
| 4618 | root window height which was obviously wrong as well ... */ | 4621 | root window height which was obviously wrong as well ... */ |
| 4619 | adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), | 4622 | adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), |
| 4620 | FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 5, 1, Qnil); | 4623 | FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 5, 1, |
| 4624 | Qx_create_frame_1); | ||
| 4621 | 4625 | ||
| 4622 | /* The X resources controlling the menu-bar and tool-bar are | 4626 | /* The X resources controlling the menu-bar and tool-bar are |
| 4623 | processed specially at startup, and reflected in the mode | 4627 | processed specially at startup, and reflected in the mode |
| @@ -4685,7 +4689,8 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 4685 | /* Allow x_set_window_size, now. */ | 4689 | /* Allow x_set_window_size, now. */ |
| 4686 | f->can_x_set_window_size = true; | 4690 | f->can_x_set_window_size = true; |
| 4687 | 4691 | ||
| 4688 | adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f), 0, 1, Qnil); | 4692 | adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f), 0, 1, |
| 4693 | Qx_create_frame_2); | ||
| 4689 | 4694 | ||
| 4690 | /* Tell the server what size and position, etc, we want, and how | 4695 | /* Tell the server what size and position, etc, we want, and how |
| 4691 | badly we want them. This should be done after we have the menu | 4696 | badly we want them. This should be done after we have the menu |
diff --git a/src/w32menu.c b/src/w32menu.c index 7a946d2dc75..a65e399ba5b 100644 --- a/src/w32menu.c +++ b/src/w32menu.c | |||
| @@ -501,8 +501,7 @@ set_frame_menubar (struct frame *f, bool first_time, bool deep_p) | |||
| 501 | /* Force the window size to be recomputed so that the frame's text | 501 | /* Force the window size to be recomputed so that the frame's text |
| 502 | area remains the same, if menubar has just been created. */ | 502 | area remains the same, if menubar has just been created. */ |
| 503 | if (old_widget == NULL) | 503 | if (old_widget == NULL) |
| 504 | adjust_frame_size (f, FRAME_TEXT_WIDTH (f), | 504 | adjust_frame_size (f, -1, -1, 2, 0, Qmenu_bar_lines); |
| 505 | FRAME_TEXT_HEIGHT (f), 2, 0, Qmenu_bar_lines); | ||
| 506 | } | 505 | } |
| 507 | 506 | ||
| 508 | unblock_input (); | 507 | unblock_input (); |
diff --git a/src/window.c b/src/window.c index 1d2221fd9b2..5ae95f27d64 100644 --- a/src/window.c +++ b/src/window.c | |||
| @@ -6421,7 +6421,7 @@ the return value is nil. Otherwise the value is t. */) | |||
| 6421 | /* Allow x_set_window_size again and apply frame size changes if | 6421 | /* Allow x_set_window_size again and apply frame size changes if |
| 6422 | needed. */ | 6422 | needed. */ |
| 6423 | f->can_x_set_window_size = true; | 6423 | f->can_x_set_window_size = true; |
| 6424 | adjust_frame_size (f, -1, -1, 1, 0, Qnil); | 6424 | adjust_frame_size (f, -1, -1, 1, 0, Qset_window_configuration); |
| 6425 | 6425 | ||
| 6426 | adjust_frame_glyphs (f); | 6426 | adjust_frame_glyphs (f); |
| 6427 | unblock_input (); | 6427 | unblock_input (); |
diff --git a/src/xdisp.c b/src/xdisp.c index 31702ed4135..f006f8e0b94 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -12352,6 +12352,7 @@ redisplay_tool_bar (struct frame *f) | |||
| 12352 | if (new_height != WINDOW_PIXEL_HEIGHT (w)) | 12352 | if (new_height != WINDOW_PIXEL_HEIGHT (w)) |
| 12353 | { | 12353 | { |
| 12354 | x_change_tool_bar_height (f, new_height); | 12354 | x_change_tool_bar_height (f, new_height); |
| 12355 | frame_default_tool_bar_height = new_height; | ||
| 12355 | /* Always do that now. */ | 12356 | /* Always do that now. */ |
| 12356 | clear_glyph_matrix (w->desired_matrix); | 12357 | clear_glyph_matrix (w->desired_matrix); |
| 12357 | f->fonts_changed = 1; | 12358 | f->fonts_changed = 1; |
| @@ -12446,6 +12447,7 @@ redisplay_tool_bar (struct frame *f) | |||
| 12446 | if (change_height_p) | 12447 | if (change_height_p) |
| 12447 | { | 12448 | { |
| 12448 | x_change_tool_bar_height (f, new_height); | 12449 | x_change_tool_bar_height (f, new_height); |
| 12450 | frame_default_tool_bar_height = new_height; | ||
| 12449 | clear_glyph_matrix (w->desired_matrix); | 12451 | clear_glyph_matrix (w->desired_matrix); |
| 12450 | f->n_tool_bar_rows = nrows; | 12452 | f->n_tool_bar_rows = nrows; |
| 12451 | f->fonts_changed = 1; | 12453 | f->fonts_changed = 1; |
| @@ -13775,6 +13777,17 @@ redisplay_internal (void) | |||
| 13775 | 13777 | ||
| 13776 | retry_frame: | 13778 | retry_frame: |
| 13777 | 13779 | ||
| 13780 | #if defined (HAVE_WINDOW_SYSTEM) && !defined (USE_GTK) && !defined (HAVE_NS) | ||
| 13781 | /* Redisplay internal tool bar if this is the first time so we | ||
| 13782 | can adjust the frame height right now, if necessary. */ | ||
| 13783 | if (!f->tool_bar_redisplayed_once) | ||
| 13784 | { | ||
| 13785 | if (redisplay_tool_bar (f)) | ||
| 13786 | adjust_frame_glyphs (f); | ||
| 13787 | f->tool_bar_redisplayed_once = true; | ||
| 13788 | } | ||
| 13789 | #endif | ||
| 13790 | |||
| 13778 | if (FRAME_WINDOW_P (f) || FRAME_TERMCAP_P (f) || f == sf) | 13791 | if (FRAME_WINDOW_P (f) || FRAME_TERMCAP_P (f) || f == sf) |
| 13779 | { | 13792 | { |
| 13780 | bool gcscrollbars | 13793 | bool gcscrollbars |
diff --git a/src/xfns.c b/src/xfns.c index 4a417526dcd..936c769a2de 100644 --- a/src/xfns.c +++ b/src/xfns.c | |||
| @@ -1130,8 +1130,11 @@ x_change_tool_bar_height (struct frame *f, int height) | |||
| 1130 | /* Recalculate toolbar height. */ | 1130 | /* Recalculate toolbar height. */ |
| 1131 | f->n_tool_bar_rows = 0; | 1131 | f->n_tool_bar_rows = 0; |
| 1132 | 1132 | ||
| 1133 | adjust_frame_size (f, -1, -1, (old_height == 0 || height == 0) ? 2 : 4, 0, | 1133 | adjust_frame_size (f, -1, -1, |
| 1134 | Qtool_bar_lines); | 1134 | (!f->tool_bar_redisplayed_once ? 1 |
| 1135 | : (old_height == 0 || height == 0) ? 2 | ||
| 1136 | : 4), | ||
| 1137 | 0, Qtool_bar_lines); | ||
| 1135 | 1138 | ||
| 1136 | /* adjust_frame_size might not have done anything, garbage frame | 1139 | /* adjust_frame_size might not have done anything, garbage frame |
| 1137 | here. */ | 1140 | here. */ |
| @@ -3160,7 +3163,8 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 3160 | had one frame line vs one toolbar line which left us with a zero | 3163 | had one frame line vs one toolbar line which left us with a zero |
| 3161 | root window height which was obviously wrong as well ... */ | 3164 | root window height which was obviously wrong as well ... */ |
| 3162 | adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), | 3165 | adjust_frame_size (f, FRAME_COLS (f) * FRAME_COLUMN_WIDTH (f), |
| 3163 | FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 5, 1, Qnil); | 3166 | FRAME_LINES (f) * FRAME_LINE_HEIGHT (f), 5, 1, |
| 3167 | Qx_create_frame_1); | ||
| 3164 | 3168 | ||
| 3165 | /* Set the menu-bar-lines and tool-bar-lines parameters. We don't | 3169 | /* Set the menu-bar-lines and tool-bar-lines parameters. We don't |
| 3166 | look up the X resources controlling the menu-bar and tool-bar | 3170 | look up the X resources controlling the menu-bar and tool-bar |
| @@ -3234,7 +3238,8 @@ This function is an internal primitive--use `make-frame' instead. */) | |||
| 3234 | /* Consider frame official, now. */ | 3238 | /* Consider frame official, now. */ |
| 3235 | f->can_x_set_window_size = true; | 3239 | f->can_x_set_window_size = true; |
| 3236 | 3240 | ||
| 3237 | adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f), 0, 1, Qnil); | 3241 | adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f), 0, 1, |
| 3242 | Qx_create_frame_2); | ||
| 3238 | 3243 | ||
| 3239 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) | 3244 | #if defined (USE_X_TOOLKIT) || defined (USE_GTK) |
| 3240 | /* Create the menu bar. */ | 3245 | /* Create the menu bar. */ |