summaryrefslogtreecommitdiff
path: root/src/xfns.c
diff options
context:
space:
mode:
authorPo Lu <luangruo@yahoo.com>2023-06-21 10:04:31 +0800
committerPo Lu <luangruo@yahoo.com>2023-06-21 10:06:34 +0800
commitdb6de49f231f863b21547173ce3ac9ab8e5e0d86 (patch)
treeb75a06d53e56ccf514c51b908e4276ffd90a5034 /src/xfns.c
parentbc6068fe9451f62157c25c9568923ef6c49ed967 (diff)
downloademacs-db6de49f231f863b21547173ce3ac9ab8e5e0d86.tar.gz
Allow displaying tool bar on the bottom of the frame
* src/xterm.c (x_clear_under_internal_border): Subtract bottom margins before clearing bottom border. (XTflash): Subtract bottom margins before flashing mini window. * src/xfns.c (x_set_tool_bar_position): Allow setting different values outside of GTK+. (frame_geometry): Adjust inner width and height for tool bars placed on the bottom. * src/xdisp.c (init_xdisp): Calculate using top margins only. * src/window.c (resize_frame_windows): Fix commentary. * src/w32fns.c (Fw32_frame_geometry): Report tool bar position correctly. (w32_clear_under_internal_border): Subtract bottom margins prior to clearing bottom border. (w32_set_tool_bar_position): New function. (Fw32_frame_edges): Subtract bottom tool bar from inner width and height. (w32_frame_parm_handlers): Add `set_tool_bar_position' parameter handler. * src/pgtkterm.c (pgtk_flash): Subtract bottom margins before clearing bottom border. (XTflash): Subtract bottom margins before flashing mini window. * src/pgtkfns.c (frame_geometry): Set `inner_top' correctly. (Fpgtk_set_mouse_absolute_pixel_position): (Fpgtk_mouse_absolute_pixel_position): (Fpgtk_page_setup_dialog): (Fpgtk_get_page_setup): Wrap lines which cause C Mode to hang. * src/nsterm.m (ns_clear_under_internal_border): Subtract bottom margins before clearing bottom border. * src/nsfns.m (ns_set_tool_bar_position): New function. Error if arg is not top. (ns_frame_parm_handlers): Add that as the handler for `tool-bar-position', to prevent it from being set to an invalid value. * src/haikuterm.c (haiku_flash): Subtract bottom margins before flashing mini window. (haiku_clear_under_internal_border): Subtract bottom margins before clearing bottom border. * src/haikufns.c (haiku_set_tool_bar_position): Allow setting values other than `top'. (frame_geometry): Take bottom margin into account when calculating inner dimensions. * src/frame.h (struct frame): Always define `tool_bar_position'. (fset_tool_bar_position): Define function everywhere. (FRAME_TOOL_BAR_POSITION): Define correctly on all toolkits. (FRAME_TOOL_BAR_TOP_HEIGHT): (FRAME_TOOL_BAR_TOP_LINES): (FRAME_TOOL_BAR_BOTTOM_HEIGHT): (FRAME_TOOL_BAR_BOTTOM_LINES): New macros. Each pair returns the tool bar dimensions only if the tool bar position is set appropriately. (FRAME_TOP_MARGIN, FRAME_TOP_MARGIN_HEIGHT): Only add tool bar height if it is placed at the top of the frame. (FRAME_BOTTOM_MARGIN, FRAME_BOTTOM_MARGIN_HEIGHT): Add ``bottom margins''. (FRAME_MARGINS, FRAME_MARGIN_HEIGHT): Move original margin macro here. (FRAME_PIXEL_HEIGHT_TO_TEXT_LINES): (FRAME_TEXT_TO_PIXEL_HEIGHT): (FRAME_PIXEL_TO_TEXT_HEIGHT): (FRAME_INNER_HEIGHT): Subtract both vertical margins. * src/frame.c (adjust_frame_size): Subtract both top and bottom margins to determine the inner height. (make_frame): Initialize `f->tool_bar_position' unconditionally. * src/dispnew.c (adjust_frame_glyphs_for_window_redisplay): Place internal tool bar on bottom if requested. * doc/lispref/frames.texi (Frame Layout): Describe the possibility of the tool bar being placed below the inner area of the frame. (Layout Parameters): Describe that `tool-bar-position' is now supported almost everywhere.
Diffstat (limited to 'src/xfns.c')
-rw-r--r--src/xfns.c52
1 files changed, 41 insertions, 11 deletions
diff --git a/src/xfns.c b/src/xfns.c
index 234a48c908f..a58e854811b 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -807,23 +807,45 @@ x_set_tool_bar_position (struct frame *f,
Lisp_Object new_value,
Lisp_Object old_value)
{
- Lisp_Object choice = list4 (Qleft, Qright, Qtop, Qbottom);
+#ifdef USE_GTK
+ Lisp_Object choice;
+
+ choice = list4 (Qleft, Qright, Qtop, Qbottom);
if (!NILP (Fmemq (new_value, choice)))
{
-#ifdef USE_GTK
if (!EQ (new_value, old_value))
{
xg_change_toolbar_position (f, new_value);
fset_tool_bar_position (f, new_value);
}
-#else
- if (!EQ (new_value, Qtop))
- error ("The only supported tool bar position is top");
-#endif
+#else /* !USE_GTK */
+ if (!EQ (new_value, Qtop) && !EQ (new_value, Qbottom))
+ error ("Tool bar position must be either `top' or `bottom'");
+
+ if (EQ (new_value, old_value))
+ return;
+
+ /* Set the tool bar position. */
+ fset_tool_bar_position (f, new_value);
+
+ /* Now reconfigure frame glyphs to place the tool bar at the
+ bottom. While the inner height has not changed, call
+ `resize_frame_windows' to place each of the windows at its
+ new position. */
+
+ adjust_frame_size (f, -1, -1, 3, false, Qtool_bar_position);
+ adjust_frame_glyphs (f);
+ SET_FRAME_GARBAGED (f);
+
+ if (FRAME_X_WINDOW (f))
+ x_clear_under_internal_border (f);
+#endif /* USE_GTK */
+#ifdef USE_GTK
}
else
wrong_choice (choice, new_value);
+#endif /* USE_GTK */
}
#ifdef HAVE_XDBE
@@ -6673,10 +6695,11 @@ Internal use only, use `display-monitor-attributes-list' instead. */)
}
/* Return geometric attributes of FRAME. According to the value of
- ATTRIBUTES return the outer edges of FRAME (Qouter_edges), the native
- edges of FRAME (Qnative_edges), or the inner edges of frame
+ ATTRIBUTES return the outer edges of FRAME (Qouter_edges), the
+ native edges of FRAME (Qnative_edges), or the inner edges of frame
(Qinner_edges). Any other value means to return the geometry as
returned by Fx_frame_geometry. */
+
static Lisp_Object
frame_geometry (Lisp_Object frame, Lisp_Object attribute)
{
@@ -6765,8 +6788,8 @@ frame_geometry (Lisp_Object frame, Lisp_Object attribute)
tab_bar_height = FRAME_TAB_BAR_HEIGHT (f);
tab_bar_width = (tab_bar_height
- ? native_width - 2 * internal_border_width
- : 0);
+ ? native_width - 2 * internal_border_width
+ : 0);
inner_top += tab_bar_height;
#ifdef HAVE_EXT_TOOL_BAR
@@ -6806,7 +6829,14 @@ frame_geometry (Lisp_Object frame, Lisp_Object attribute)
tool_bar_width = (tool_bar_height
? native_width - 2 * internal_border_width
: 0);
- inner_top += tool_bar_height;
+
+ /* Subtract or add to the inner dimensions based on the tool bar
+ position. */
+
+ if (EQ (FRAME_TOOL_BAR_POSITION (f), Qtop))
+ inner_top += tool_bar_height;
+ else
+ inner_bottom -= tool_bar_height;
#endif
/* Construct list. */