summaryrefslogtreecommitdiff
path: root/src/xmenu.c
diff options
context:
space:
mode:
authorMartin Rudalics <rudalics@gmx.at>2015-10-13 12:11:43 +0200
committerMartin Rudalics <rudalics@gmx.at>2015-10-13 12:11:43 +0200
commitd4fe840df0b5fdb3aed538fae2ced143a471f60a (patch)
tree13ff9d7115616a99af7e0257277a1ca6edf31f72 /src/xmenu.c
parente53e1a0426539aa3f2902632fdd8025da8f710f2 (diff)
downloademacs-d4fe840df0b5fdb3aed538fae2ced143a471f60a.tar.gz
Allow setting frame pixel sizes from frame parameters (Bug#21415)
Also fix some misfeatures in frame (re-)sizing code, add more debugging information and remove some dead code. * lisp/frame.el (frame-notice-user-settings, make-frame): Change parameter names when setting `frame-size-history'. (frame--size-history): New function. * src/frame.c (frame_inhibit_resize): If frame has not been made yet, return t if inhibit_horizontal_resize or inhibit_vertical_resize bit have been set. (adjust_frame_size): Simplify. (make_frame): Initialize inhibit_horizontal_resize, inhibit_vertical_resize, tool_bar_redisplayed, tool_bar_resized. (Fframe_after_make_frame): Reset inhibit_horizontal_resize and inhibit_vertical_resize slots. (x_set_frame_parameters): Handle `text-pixels' specification for width and height parameters. Don't consider new_height or new_width changes. Call adjust_frame_size instead of Fset_frame_size. (x_figure_window_size): Two new arguments x_width and y_width returning frame's figures width and height. Calculate tool bar height before frame sizes so SET_FRAME_HEIGHT can pick it up. Handle `text-pixels' specification for width and height parameters. (Qtext_pixels, Qx_set_frame_parameters, Qset_frame_size) (Qx_set_window_size_1, Qx_set_window_size_2) (Qx_set_window_size_3, Qx_set_menu_bar_lines) (Qupdate_frame_menubar, Qfree_frame_menubar_1) (Qfree_frame_menubar_2): New symbols. * src/frame.h (structure frame): New booleans tool_bar_redisplayed, tool_bar_resized, inhibit_horizontal_resize, inhibit_vertical_resize. (x_figure_window_size): Update external declaration. * src/gtkutil.c (xg_frame_set_char_size): Set size hints before calling gtk_window_resize. (update_frame_tool_bar): Make inhibiting of frame resizing more discriminative. Set tool_bar_resized bit. * src/nsfns.m (x_set_tool_bar_lines): Make inhibiting of frame resizing more discriminative. Call adjust_frame_size instead of x_set_window_size. (Fx_create_frame): Handle x_width and x_height if set by x_figure_window_size. * src/nsterm.m (x_set_window_size): For GNUSTEP build don't subtract 3 from tool bar height. (x_set_window_size): Add frame_size_history_add call. (x_new_font): Call adjust_frame_size instead of x_set_window_size. * src/w32fns.c (x_change_tool_bar_height): Reset tool_bar_redisplayed and tool_bar_resized bits when adding tool bar. Make inhibiting of frame resizing more discriminative. (w32_wnd_proc): Remove dead code in WM_WINDOWPOSCHANGING case. (Fx_create_frame): Handle x_width and x_height if set by x_figure_window_size. Set size hints before adjusting frame size. (x_create_tip_frame): Adjust x_figure_window_size call. * src/w32term.c (x_set_window_size): Add frame_size_history_add call. * src/widget.c (set_frame_size): Remove dead code. Add frame_size_history_add call. When frame_resize_pixelwise is t use FRAME_PIXEL_WIDTH and FRAME_PIXEL_HEIGHT instead of pixel_width and pixel_height. (update_various_frame_slots): Remove dead code. (EmacsFrameResize): Add more information in frame_size_history_add call. (EmacsFrameQueryGeometry): Round only when frame_resize_pixelwise is not set. * src/xdisp.c (redisplay_tool_bar): Set tool_bar_redisplayed bits. * src/xfns.c (x_set_menu_bar_lines): Change argument name. (x_change_tool_bar_height): Reset tool_bar_redisplayed and tool_bar_resized bits when adding tool bar. Make inhibiting of frame resizing more discriminative. (Fx_create_frame): Handle x_width and x_height if set by x_figure_window_size. Set size hints before adjusting frame size. (x_create_tip_frame): Adjust x_figure_window_size call. * src/xmenu.c (update_frame_menubar): Don't handle Lucid specially. (set_frame_menubar): On Lucid never add core-border-width to avoid that adding XtNinternalBorderWidth adds it again. (free_frame_menubar): Handle frame_inhibit_resize true for Motif. * src/xterm.c (x_new_font): In non-toolkit case handle size change of menu bar. (x_set_window_size_1): Fix calls to frame_size_history_add. (x_wm_set_size_hint): Remove dead code. Set size_hints.min_width and size_hints.min_height to base_width and base_height.
Diffstat (limited to 'src/xmenu.c')
-rw-r--r--src/xmenu.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/xmenu.c b/src/xmenu.c
index 192ed89e2c6..4379cddaf2e 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -636,13 +636,7 @@ update_frame_menubar (struct frame *f)
lw_refigure_widget (x->column_widget, True);
/* Force the pane widget to resize itself. */
- int new_height = -1;
-#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. */
- new_height = FRAME_TEXT_HEIGHT (f) - 1;
-#endif /* USE_LUCID */
- adjust_frame_size (f, -1, new_height, 2, false, Qmenu_bar_lines);
+ adjust_frame_size (f, -1, -1, 2, false, Qupdate_frame_menubar);
unblock_input ();
#endif /* USE_GTK */
}
@@ -979,7 +973,15 @@ set_frame_menubar (struct frame *f, bool first_time, bool deep_p)
menubar_size
= (f->output_data.x->menubar_widget
? (f->output_data.x->menubar_widget->core.height
- + f->output_data.x->menubar_widget->core.border_width)
+#ifndef USE_LUCID
+ /* Damn me... With Lucid I get a core.border_width of 1
+ only the first time this is called and an ibw of 1 every
+ time this is called. So the first time this is called I
+ was off by one. Fix that here by never adding
+ core.border_width for Lucid. */
+ + f->output_data.x->menubar_widget->core.border_width
+#endif /* USE_LUCID */
+ )
: 0);
#ifdef USE_LUCID
@@ -990,9 +992,10 @@ set_frame_menubar (struct frame *f, bool first_time, bool deep_p)
if (FRAME_EXTERNAL_MENU_BAR (f))
{
Dimension ibw = 0;
+
XtVaGetValues (f->output_data.x->column_widget,
XtNinternalBorderWidth, &ibw, NULL);
- menubar_size += ibw;
+ menubar_size += ibw;
}
#endif /* USE_LUCID */
@@ -1073,21 +1076,24 @@ free_frame_menubar (struct frame *f)
if (f->output_data.x->widget)
{
- int new_height = -1;
#ifdef USE_MOTIF
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);
if (frame_inhibit_resize (f, false, Qmenu_bar_lines))
- new_height = old_height;
+ adjust_frame_size (f, -1, old_height, 1, false, Qfree_frame_menubar_1);
+ else
+ adjust_frame_size (f, -1, -1, 2, false, Qfree_frame_menubar_1);
+#else
+ adjust_frame_size (f, -1, -1, 2, false, Qfree_frame_menubar_1);
#endif /* USE_MOTIF */
- adjust_frame_size (f, -1, new_height, 2, false, Qmenu_bar_lines);
}
else
{
#ifdef USE_MOTIF
- if (frame_inhibit_resize (f, false, Qmenu_bar_lines))
- adjust_frame_size (f, -1, old_height, 1, false, Qmenu_bar_lines);
+ if (WINDOWP (FRAME_ROOT_WINDOW (f))
+ && frame_inhibit_resize (f, false, Qmenu_bar_lines))
+ adjust_frame_size (f, -1, old_height, 1, false, Qfree_frame_menubar_2);
#endif
}