diff options
author | Po Lu <luangruo@yahoo.com> | 2023-06-21 10:04:31 +0800 |
---|---|---|
committer | Po Lu <luangruo@yahoo.com> | 2023-06-21 10:06:34 +0800 |
commit | db6de49f231f863b21547173ce3ac9ab8e5e0d86 (patch) | |
tree | b75a06d53e56ccf514c51b908e4276ffd90a5034 /src/frame.h | |
parent | bc6068fe9451f62157c25c9568923ef6c49ed967 (diff) | |
download | emacs-db6de49f231f863b21547173ce3ac9ab8e5e0d86.tar.gz emacs-db6de49f231f863b21547173ce3ac9ab8e5e0d86.tar.bz2 emacs-db6de49f231f863b21547173ce3ac9ab8e5e0d86.zip |
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/frame.h')
-rw-r--r-- | src/frame.h | 83 |
1 files changed, 63 insertions, 20 deletions
diff --git a/src/frame.h b/src/frame.h index b95b94c7685..44eefa357fc 100644 --- a/src/frame.h +++ b/src/frame.h @@ -205,11 +205,9 @@ struct frame Lisp_Object current_tool_bar_string; #endif -#ifdef USE_GTK /* Where tool bar is, can be left, right, top or bottom. Except with GTK, the only supported position is `top'. */ Lisp_Object tool_bar_position; -#endif #if defined (HAVE_XFT) || defined (HAVE_FREETYPE) /* List of data specific to font-driver and frame, but common to faces. */ @@ -782,14 +780,9 @@ fset_tool_bar_items (struct frame *f, Lisp_Object val) { f->tool_bar_items = val; } -#ifdef USE_GTK -INLINE void -fset_tool_bar_position (struct frame *f, Lisp_Object val) -{ - f->tool_bar_position = val; -} -#endif /* USE_GTK */ + #if defined (HAVE_WINDOW_SYSTEM) && ! defined (HAVE_EXT_TOOL_BAR) + INLINE void fset_tool_bar_window (struct frame *f, Lisp_Object val) { @@ -805,7 +798,14 @@ fset_desired_tool_bar_string (struct frame *f, Lisp_Object val) { f->desired_tool_bar_string = val; } -#endif /* HAVE_WINDOW_SYSTEM && !USE_GTK && !HAVE_NS */ + +#endif /* HAVE_WINDOW_SYSTEM && !HAVE_EXT_TOOL_BAR */ + +INLINE void +fset_tool_bar_position (struct frame *f, Lisp_Object val) +{ + f->tool_bar_position = val; +} INLINE double NUMVAL (Lisp_Object x) @@ -984,27 +984,70 @@ default_pixels_per_inch_y (void) #define FRAME_EXTERNAL_TOOL_BAR(f) false #endif -/* This is really supported only with GTK. */ -#ifdef USE_GTK +/* Position of F's tool bar; one of Qtop, Qleft, Qright, or + Qbottom. + + Qleft and Qright are not supported outside GTK+. */ #define FRAME_TOOL_BAR_POSITION(f) (f)->tool_bar_position -#else -#define FRAME_TOOL_BAR_POSITION(f) ((void) (f), Qtop) -#endif /* Size of frame F's internal tool bar in frame lines and pixels. */ #define FRAME_TOOL_BAR_LINES(f) (f)->tool_bar_lines #define FRAME_TOOL_BAR_HEIGHT(f) (f)->tool_bar_height +/* Size of F's tool bar if it is placed at the top of the + frame, else 0. */ + +#define FRAME_TOOL_BAR_TOP_HEIGHT(f) \ + ((BASE_EQ ((f)->tool_bar_position, Qtop)) \ + ? (f)->tool_bar_height : 0) + +#define FRAME_TOOL_BAR_TOP_LINES(f) \ + ((BASE_EQ ((f)->tool_bar_position, Qtop)) \ + ? (f)->tool_bar_height : 0) + +/* Size of F's tool bar if it is placed at the bottom of the + frame. */ +#define FRAME_TOOL_BAR_BOTTOM_HEIGHT(f) \ + ((BASE_EQ ((f)->tool_bar_position, Qbottom)) \ + ? (f)->tool_bar_height : 0) + +#define FRAME_TOOL_BAR_BOTTOM_LINES(f) \ + ((BASE_EQ ((f)->tool_bar_position, Qbottom)) \ + ? (f)->tool_bar_lines : 0) + /* Height of frame F's top margin in frame lines. */ #define FRAME_TOP_MARGIN(F) \ (FRAME_MENU_BAR_LINES (F) \ + FRAME_TAB_BAR_LINES (F) \ - + FRAME_TOOL_BAR_LINES (F)) + + FRAME_TOOL_BAR_TOP_LINES (F)) /* Pixel height of frame F's top margin. */ + #define FRAME_TOP_MARGIN_HEIGHT(F) \ (FRAME_MENU_BAR_HEIGHT (F) \ + FRAME_TAB_BAR_HEIGHT (F) \ + + FRAME_TOOL_BAR_TOP_HEIGHT (F)) + +/* Height of F's bottom margin in frame lines. */ + +#define FRAME_BOTTOM_MARGIN(f) \ + (FRAME_TOOL_BAR_BOTTOM_LINES (f)) + +/* Pixel height of frame F's bottom margin. */ + +#define FRAME_BOTTOM_MARGIN_HEIGHT(f) \ + (FRAME_TOOL_BAR_BOTTOM_HEIGHT (f)) + +/* Size of both vertical margins combined. */ + +#define FRAME_MARGINS(F) \ + (FRAME_MENU_BAR_LINES (F) \ + + FRAME_TAB_BAR_LINES (F) \ + + FRAME_TOOL_BAR_LINES (F)) + +#define FRAME_MARGIN_HEIGHT(F) \ + (FRAME_MENU_BAR_HEIGHT (F) \ + + FRAME_TAB_BAR_HEIGHT (F) \ + FRAME_TOOL_BAR_HEIGHT (F)) /* True if frame F is currently visible. */ @@ -1625,7 +1668,7 @@ IMAGE_OPT_FROM_ID (struct frame *f, int id) #define FRAME_PIXEL_HEIGHT_TO_TEXT_LINES(f, height) \ (((height) \ - - FRAME_TOP_MARGIN_HEIGHT (f) \ + - FRAME_MARGIN_HEIGHT (f) \ - FRAME_SCROLL_BAR_AREA_HEIGHT (f) \ - 2 * FRAME_INTERNAL_BORDER_WIDTH (f)) \ / FRAME_LINE_HEIGHT (f)) @@ -1640,7 +1683,7 @@ IMAGE_OPT_FROM_ID (struct frame *f, int id) #define FRAME_TEXT_TO_PIXEL_HEIGHT(f, height) \ ((height) \ - + FRAME_TOP_MARGIN_HEIGHT (f) \ + + FRAME_MARGIN_HEIGHT (f) \ + FRAME_SCROLL_BAR_AREA_HEIGHT (f) \ + 2 * FRAME_INTERNAL_BORDER_WIDTH (f)) @@ -1654,7 +1697,7 @@ IMAGE_OPT_FROM_ID (struct frame *f, int id) #define FRAME_PIXEL_TO_TEXT_HEIGHT(f, height) \ ((height) \ - - FRAME_TOP_MARGIN_HEIGHT (f) \ + - FRAME_MARGIN_HEIGHT (f) \ - FRAME_SCROLL_BAR_AREA_HEIGHT (f) \ - 2 * FRAME_INTERNAL_BORDER_WIDTH (f)) @@ -1664,7 +1707,7 @@ IMAGE_OPT_FROM_ID (struct frame *f, int id) #define FRAME_INNER_HEIGHT(f) \ (FRAME_PIXEL_HEIGHT (f) \ - - FRAME_TOP_MARGIN_HEIGHT (f) \ + - FRAME_MARGIN_HEIGHT (f) \ - 2 * FRAME_INTERNAL_BORDER_WIDTH (f)) /* Value is the smallest width of any character in any font on frame F. */ |