summaryrefslogtreecommitdiff
path: root/src/xmenu.c
diff options
context:
space:
mode:
authorMartin Rudalics <rudalics@gmx.at>2014-11-07 11:49:22 +0100
committerMartin Rudalics <rudalics@gmx.at>2014-11-07 11:49:22 +0100
commit1c50b3adb636addc4244942e8f0e33b1e557ec07 (patch)
treefc452db1b888d5833e915778ad795c9d86f06678 /src/xmenu.c
parenta067ef9a5ddc9812e35734e8c027684e01d684ef (diff)
downloademacs-1c50b3adb636addc4244942e8f0e33b1e557ec07.tar.gz
Improve inhibiting of implied frame resizes.
* frames.texi (Size and Position): Rewrite description of `frame-inhibit-implied-resize'. * cus-start.el (frame-resize-pixelwise): Fix group. (frame-inhibit-implied-resize): Add entry. * dispnew.c (change_frame_size_1): Fix call of adjust_frame_size. * frame.c (Qsize, Qframe_position, Qframe_outer_size) (Qframe_inner_size, Qexternal_border_size, Qtitle_height) (Qmenu_bar_external, Qmenu_bar_size, Qtool_bar_external) (Qtool_bar_size): New constants. (frame_inhibit_resize, adjust_frame_size): New argument to handle case where frame_inhibit_implied_resize is a list. (Fmake_terminal_frame, Fset_frame_height, Fset_frame_width) (Fset_frame_size, x_set_left_fringe, x_set_right_fringe) (x_set_right_divider_width, x_set_bottom_divider_width) (x_set_vertical_scroll_bars, x_set_horizontal_scroll_bars) (x_set_scroll_bar_width, x_set_scroll_bar_height): Update callers. (frame-inhibit-implied-resize): Rewrite doc-string. * frame.h (frame_inhibit_resize, adjust_frame_size): Fix external declarations. (Qframe_position, Qframe_outer_size) (Qframe_inner_size, Qexternal_border_size, Qtitle_height) (Qmenu_bar_external, Qmenu_bar_size, Qtool_bar_external) (Qtool_bar_size): Extern them. * gtkutil.c (FRAME_TOTAL_PIXEL_HEIGHT, FRAME_TOTAL_PIXEL_WIDTH) (xg_height_or_width_changed): Remove. (xg_frame_set_char_size): Adjust adjust_frame_size calls. (menubar_map_cb, xg_update_frame_menubar, free_frame_menubar) (tb_size_cb, update_frame_tool_bar, free_frame_tool_bar) (xg_change_toolbar_position): Call adjust_frame_size directly. * nsfns.m (x_set_internal_border_width, Fx_create_frame): Fix calls of adjust_frame_size. * w32fns.c (x_set_internal_border_width, x_set_menu_bar_lines) (Fx_create_frame, x_create_tip_frame): Adjust adjust_frame_size calls. (x_set_tool_bar_lines, x_change_tool_bar_height): Make sure that frame can get resized when tool-bar-lines parameter changes from or to zero. (Fw32_frame_menu_bar_size): Return fourth value. (Fw32_frame_rect): Block input around system calls (Fx_frame_geometry): New function. * w32menu.c (set_frame_menubar): Adjust adjust_frame_size call. * w32term.c (x_new_font): Adjust adjust_frame_size call. * widget.c (EmacsFrameSetCharSize): Adjust frame_inhibit_resize call. * window.c (Fset_window_configuration): Adjust adjust_frame_size call. * xfns.c (x_set_menu_bar_lines, x_set_internal_border_width) (Fx_create_frame): Adjust adjust_frame_size calls. (x_set_tool_bar_lines, x_change_tool_bar_height): Make sure that frame can get resized when tool-bar-lines parameter changes from or to zero. (Fx_frame_geometry): New function. * xmenu.c (update_frame_menubar): On Lucid call adjust_frame_size with one pixel less height to avoid that repeatedly adding/removing the menu bar grows the frame. (free_frame_menubar): On Motif arrange to optionally preserve the old frame height when removing the menu bar. * xterm.c (x_new_font): Adjust adjust_frame_size call.
Diffstat (limited to 'src/xmenu.c')
-rw-r--r--src/xmenu.c37
1 files changed, 26 insertions, 11 deletions
diff --git a/src/xmenu.c b/src/xmenu.c
index eb783fe5070..0f69ee28e84 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -657,9 +657,15 @@ update_frame_menubar (struct frame *f)
lw_refigure_widget (x->column_widget, True);
/* Force the pane widget to resize itself. */
- adjust_frame_size (f, FRAME_TEXT_WIDTH (f), FRAME_TEXT_HEIGHT (f), 2, 0);
+#ifdef USE_LUCID
+ /* For reasons I don't know Lucid wants to add one pixel to the frame
+ height when adding the menu bar. Compensate that here. */
+ adjust_frame_size (f, -1, FRAME_TEXT_HEIGHT (f) - 1, 2, 0, Qmenu_bar_lines);
+#else
+ adjust_frame_size (f, -1, -1, 2, 0, Qmenu_bar_lines);
+#endif /* USE_LUCID */
unblock_input ();
-#endif
+#endif /* USE_GTK */
}
#ifdef USE_LUCID
@@ -1050,6 +1056,12 @@ void
free_frame_menubar (struct frame *f)
{
Widget menubar_widget;
+#ifdef USE_MOTIF
+ /* Motif automatically shrinks the frame in lw_destroy_all_widgets.
+ If we want to preserve the old height, calculate it now so we can
+ restore it below. */
+ int old_height = FRAME_TEXT_HEIGHT (f) + FRAME_MENUBAR_HEIGHT (f);
+#endif
eassert (FRAME_X_P (f));
@@ -1087,17 +1099,20 @@ free_frame_menubar (struct frame *f)
XtVaGetValues (f->output_data.x->widget, XtNx, &x1, XtNy, &y1, NULL);
if (x1 == 0 && y1 == 0)
XtVaSetValues (f->output_data.x->widget, XtNx, x0, XtNy, y0, NULL);
-#endif
- adjust_frame_size (f, FRAME_TEXT_WIDTH (f),
- FRAME_TEXT_HEIGHT (f), 2, 0);
- /*
- if (frame_inhibit_resize (f, 0))
- change_frame_size (f, 0, 0, 0, 0, 0, 1);
+ if (frame_inhibit_resize (f, 0, Qmenu_bar_lines))
+ adjust_frame_size (f, -1, old_height, 1, 0, Qmenu_bar_lines);
else
- x_set_window_size (f, 0, FRAME_TEXT_WIDTH (f),
- FRAME_TEXT_HEIGHT (f), 1);
- */
+#endif /* USE_MOTIF */
+ adjust_frame_size (f, -1, -1, 2, 0, Qmenu_bar_lines);
}
+ else
+ {
+#ifdef USE_MOTIF
+ if (frame_inhibit_resize (f, 0, Qmenu_bar_lines))
+ adjust_frame_size (f, -1, old_height, 1, 0, Qmenu_bar_lines);
+#endif
+ }
+
unblock_input ();
}
}