Commit 81c7f3af authored by Paul Eggert's avatar Paul Eggert

Minor style tweaks for recent tab changes

* src/dispextern.h (MR_PARTIALLY_VISIBLE_AT_TOP):
* src/window.c (Fwindow_mode_line_height)
(Fwindow_header_line_height, Fwindow_tab_line_height)
(Fwindow_right_divider_width, Fwindow_bottom_divider_width)
(Fwindow_scroll_bar_width, Fwindow_scroll_bar_height):
(Fset_window_configuration, Fcurrent_window_configuration):
Omit unnecessary parens.
* src/dispextern.h (CURRENT_MODE_LINE_HEIGHT)
(CURRENT_HEADER_LINE_HEIGHT, CURRENT_TAB_LINE_HEIGHT):
Add parens needed to make these macros function-like.
* src/window.c (window_resize_check):
* src/window.h (WINDOW_TAB_BAR_P):
* src/xdisp.c (tab_bar_item_info): Reindent.
* src/window.c (window_wants_mode_line)
(window_wants_header_line, window_wants_tab_line):
Simplify (a && b ? 1 : 0) to (a && b).
parent be27f02b
Pipeline #3456 passed with stage
in 57 minutes and 2 seconds
......@@ -1178,7 +1178,7 @@ struct glyph_row *matrix_row (struct glyph_matrix *, int);
((ROW)->height != (ROW)->visible_height)
#define MR_PARTIALLY_VISIBLE_AT_TOP(W, ROW) \
((ROW)->y < (WINDOW_TAB_LINE_HEIGHT ((W)) + WINDOW_HEADER_LINE_HEIGHT ((W))))
((ROW)->y < WINDOW_TAB_LINE_HEIGHT (W) + WINDOW_HEADER_LINE_HEIGHT (W))
#define MR_PARTIALLY_VISIBLE_AT_BOTTOM(W, ROW) \
(((ROW)->y + (ROW)->height - (ROW)->extra_line_spacing) \
......@@ -1489,39 +1489,39 @@ struct glyph_string
a default based on the height of the font of the face `mode-line'. */
#define CURRENT_MODE_LINE_HEIGHT(W) \
(W->mode_line_height >= 0 \
? W->mode_line_height \
: (W->mode_line_height \
= (MATRIX_MODE_LINE_HEIGHT (W->current_matrix) \
? MATRIX_MODE_LINE_HEIGHT (W->current_matrix) \
((W)->mode_line_height >= 0 \
? (W)->mode_line_height \
: ((W)->mode_line_height \
= (MATRIX_MODE_LINE_HEIGHT ((W)->current_matrix) \
? MATRIX_MODE_LINE_HEIGHT ((W)->current_matrix) \
: estimate_mode_line_height \
(XFRAME (W->frame), CURRENT_MODE_LINE_FACE_ID (W)))))
(XFRAME ((W)->frame), CURRENT_MODE_LINE_FACE_ID (W)))))
/* Return the current height of the header line of window W. If not known
from W->header_line_height, look at W's current glyph matrix, or return
an estimation based on the height of the font of the face `header-line'. */
#define CURRENT_HEADER_LINE_HEIGHT(W) \
(W->header_line_height >= 0 \
? W->header_line_height \
: (W->header_line_height \
= (MATRIX_HEADER_LINE_HEIGHT (W->current_matrix) \
? MATRIX_HEADER_LINE_HEIGHT (W->current_matrix) \
((W)->header_line_height >= 0 \
? (W)->header_line_height \
: ((W)->header_line_height \
= (MATRIX_HEADER_LINE_HEIGHT ((W)->current_matrix) \
? MATRIX_HEADER_LINE_HEIGHT ((W)->current_matrix) \
: estimate_mode_line_height \
(XFRAME (W->frame), HEADER_LINE_FACE_ID))))
(XFRAME ((W)->frame), HEADER_LINE_FACE_ID))))
/* Return the current height of the tab line of window W. If not known
from W->tab_line_height, look at W's current glyph matrix, or return
an estimation based on the height of the font of the face `tab-line'. */
#define CURRENT_TAB_LINE_HEIGHT(W) \
(W->tab_line_height >= 0 \
? W->tab_line_height \
: (W->tab_line_height \
= (MATRIX_TAB_LINE_HEIGHT (W->current_matrix) \
? MATRIX_TAB_LINE_HEIGHT (W->current_matrix) \
((W)->tab_line_height >= 0 \
? (W)->tab_line_height \
: ((W)->tab_line_height \
= (MATRIX_TAB_LINE_HEIGHT ((W)->current_matrix) \
? MATRIX_TAB_LINE_HEIGHT ((W)->current_matrix) \
: estimate_mode_line_height \
(XFRAME (W->frame), TAB_LINE_FACE_ID))))
(XFRAME ((W)->frame), TAB_LINE_FACE_ID))))
/* Return the height of the desired mode line of window W. */
......
......@@ -1120,7 +1120,7 @@ DEFUN ("window-mode-line-height", Fwindow_mode_line_height,
WINDOW must be a live window and defaults to the selected one. */)
(Lisp_Object window)
{
return (make_fixnum (WINDOW_MODE_LINE_HEIGHT (decode_live_window (window))));
return make_fixnum (WINDOW_MODE_LINE_HEIGHT (decode_live_window (window)));
}
DEFUN ("window-header-line-height", Fwindow_header_line_height,
......@@ -1129,7 +1129,7 @@ DEFUN ("window-header-line-height", Fwindow_header_line_height,
WINDOW must be a live window and defaults to the selected one. */)
(Lisp_Object window)
{
return (make_fixnum (WINDOW_HEADER_LINE_HEIGHT (decode_live_window (window))));
return make_fixnum (WINDOW_HEADER_LINE_HEIGHT (decode_live_window (window)));
}
DEFUN ("window-tab-line-height", Fwindow_tab_line_height,
......@@ -1138,7 +1138,7 @@ DEFUN ("window-tab-line-height", Fwindow_tab_line_height,
WINDOW must be a live window and defaults to the selected one. */)
(Lisp_Object window)
{
return (make_fixnum (WINDOW_TAB_LINE_HEIGHT (decode_live_window (window))));
return make_fixnum (WINDOW_TAB_LINE_HEIGHT (decode_live_window (window)));
}
DEFUN ("window-right-divider-width", Fwindow_right_divider_width,
......@@ -1147,7 +1147,7 @@ DEFUN ("window-right-divider-width", Fwindow_right_divider_width,
WINDOW must be a live window and defaults to the selected one. */)
(Lisp_Object window)
{
return (make_fixnum (WINDOW_RIGHT_DIVIDER_WIDTH (decode_live_window (window))));
return make_fixnum (WINDOW_RIGHT_DIVIDER_WIDTH (decode_live_window (window)));
}
DEFUN ("window-bottom-divider-width", Fwindow_bottom_divider_width,
......@@ -1156,7 +1156,7 @@ DEFUN ("window-bottom-divider-width", Fwindow_bottom_divider_width,
WINDOW must be a live window and defaults to the selected one. */)
(Lisp_Object window)
{
return (make_fixnum (WINDOW_BOTTOM_DIVIDER_WIDTH (decode_live_window (window))));
return make_fixnum (WINDOW_BOTTOM_DIVIDER_WIDTH (decode_live_window (window)));
}
DEFUN ("window-scroll-bar-width", Fwindow_scroll_bar_width,
......@@ -1165,7 +1165,7 @@ DEFUN ("window-scroll-bar-width", Fwindow_scroll_bar_width,
WINDOW must be a live window and defaults to the selected one. */)
(Lisp_Object window)
{
return (make_fixnum (WINDOW_SCROLL_BAR_AREA_WIDTH (decode_live_window (window))));
return make_fixnum (WINDOW_SCROLL_BAR_AREA_WIDTH (decode_live_window (window)));
}
DEFUN ("window-scroll-bar-height", Fwindow_scroll_bar_height,
......@@ -1174,7 +1174,7 @@ DEFUN ("window-scroll-bar-height", Fwindow_scroll_bar_height,
WINDOW must be a live window and defaults to the selected one. */)
(Lisp_Object window)
{
return (make_fixnum (WINDOW_SCROLL_BAR_AREA_HEIGHT (decode_live_window (window))));
return make_fixnum (WINDOW_SCROLL_BAR_AREA_HEIGHT (decode_live_window (window)));
}
DEFUN ("window-hscroll", Fwindow_hscroll, Swindow_hscroll, 0, 1, 0,
......@@ -4470,8 +4470,8 @@ window_resize_check (struct window *w, bool horflag)
hardcodes the values of `window-safe-min-width' (2) and
`window-safe-min-height' (1) which are defined in window.el. */
return (XFIXNUM (w->new_pixel) >= (horflag
? (2 * FRAME_COLUMN_WIDTH (f))
: FRAME_LINE_HEIGHT (f)));
? 2 * FRAME_COLUMN_WIDTH (f)
: FRAME_LINE_HEIGHT (f)));
}
......@@ -5350,15 +5350,13 @@ window_wants_mode_line (struct window *w)
Lisp_Object window_mode_line_format =
window_parameter (w, Qmode_line_format);
return ((WINDOW_LEAF_P (w)
&& !MINI_WINDOW_P (w)
&& !WINDOW_PSEUDO_P (w)
&& !EQ (window_mode_line_format, Qnone)
&& (!NILP (window_mode_line_format)
|| !NILP (BVAR (XBUFFER (WINDOW_BUFFER (w)), mode_line_format)))
&& WINDOW_PIXEL_HEIGHT (w) > WINDOW_FRAME_LINE_HEIGHT (w))
? 1
: 0);
return (WINDOW_LEAF_P (w)
&& !MINI_WINDOW_P (w)
&& !WINDOW_PSEUDO_P (w)
&& !EQ (window_mode_line_format, Qnone)
&& (!NILP (window_mode_line_format)
|| !NILP (BVAR (XBUFFER (WINDOW_BUFFER (w)), mode_line_format)))
&& WINDOW_PIXEL_HEIGHT (w) > WINDOW_FRAME_LINE_HEIGHT (w));
}
......@@ -5381,18 +5379,16 @@ window_wants_header_line (struct window *w)
Lisp_Object window_header_line_format =
window_parameter (w, Qheader_line_format);
return ((WINDOW_LEAF_P (w)
&& !MINI_WINDOW_P (w)
&& !WINDOW_PSEUDO_P (w)
&& !EQ (window_header_line_format, Qnone)
&& (!NILP (window_header_line_format)
|| !NILP (BVAR (XBUFFER (WINDOW_BUFFER (w)), header_line_format)))
&& (WINDOW_PIXEL_HEIGHT (w)
> (window_wants_mode_line (w)
? 2 * WINDOW_FRAME_LINE_HEIGHT (w)
: WINDOW_FRAME_LINE_HEIGHT (w))))
? 1
: 0);
return (WINDOW_LEAF_P (w)
&& !MINI_WINDOW_P (w)
&& !WINDOW_PSEUDO_P (w)
&& !EQ (window_header_line_format, Qnone)
&& (!NILP (window_header_line_format)
|| !NILP (BVAR (XBUFFER (WINDOW_BUFFER (w)), header_line_format)))
&& (WINDOW_PIXEL_HEIGHT (w)
> (window_wants_mode_line (w)
? 2 * WINDOW_FRAME_LINE_HEIGHT (w)
: WINDOW_FRAME_LINE_HEIGHT (w))));
}
......@@ -5410,24 +5406,23 @@ window_wants_header_line (struct window *w)
* to accommodate a mode line and a header line too if necessary (the
* mode line and a header line prevail).
*/
bool
window_wants_tab_line (struct window *w)
{
Lisp_Object window_tab_line_format =
window_parameter (w, Qtab_line_format);
return ((WINDOW_LEAF_P (w)
&& !MINI_WINDOW_P (w)
&& !WINDOW_PSEUDO_P (w)
&& !EQ (window_tab_line_format, Qnone)
&& (!NILP (window_tab_line_format)
|| !NILP (BVAR (XBUFFER (WINDOW_BUFFER (w)), tab_line_format)))
&& (WINDOW_PIXEL_HEIGHT (w)
> (((window_wants_mode_line (w) ? 1 : 0)
+ (window_wants_header_line (w) ? 1 : 0)
+ 1) * WINDOW_FRAME_LINE_HEIGHT (w))))
? 1
: 0);
return (WINDOW_LEAF_P (w)
&& !MINI_WINDOW_P (w)
&& !WINDOW_PSEUDO_P (w)
&& !EQ (window_tab_line_format, Qnone)
&& (!NILP (window_tab_line_format)
|| !NILP (BVAR (XBUFFER (WINDOW_BUFFER (w)), tab_line_format)))
&& (WINDOW_PIXEL_HEIGHT (w)
> (((window_wants_mode_line (w) ? 1 : 0)
+ (window_wants_header_line (w) ? 1 : 0)
+ 1) * WINDOW_FRAME_LINE_HEIGHT (w))));
}
/* Return number of lines of text in window W, not counting the mode
......@@ -7192,7 +7187,7 @@ the return value is nil. Otherwise the value is t. */)
minibuf_selected_window = data->minibuf_selected_window;
SAFE_FREE ();
return (FRAME_LIVE_P (f) ? Qt : Qnil);
return FRAME_LIVE_P (f) ? Qt : Qnil;
}
......@@ -7481,7 +7476,7 @@ saved by this function. */)
ASET (tem, i, make_nil_vector (VECSIZE (struct saved_window)));
save_window_save (FRAME_ROOT_WINDOW (f), XVECTOR (tem), 0);
XSETWINDOW_CONFIGURATION (tem, data);
return (tem);
return tem;
}
/* Called after W's margins, fringes or scroll bars was adjusted. */
......
......@@ -750,11 +750,11 @@ wset_next_buffers (struct window *w, Lisp_Object val)
/* True if W is a tab bar window. */
#if defined (HAVE_WINDOW_SYSTEM)
#define WINDOW_TAB_BAR_P(W) \
(WINDOWP (WINDOW_XFRAME (W)->tab_bar_window) \
&& (W) == XWINDOW (WINDOW_XFRAME (W)->tab_bar_window))
# define WINDOW_TAB_BAR_P(W) \
(WINDOWP (WINDOW_XFRAME (W)->tab_bar_window) \
&& (W) == XWINDOW (WINDOW_XFRAME (W)->tab_bar_window))
#else
#define WINDOW_TAB_BAR_P(W) false
# define WINDOW_TAB_BAR_P(W) false
#endif
/* True if W is a tool bar window. */
......
......@@ -13176,7 +13176,8 @@ redisplay_tab_bar (struct frame *f)
GLYPH doesn't display a tab-bar item. */
static bool
tab_bar_item_info (struct frame *f, struct glyph *glyph, int *prop_idx, bool *close_p)
tab_bar_item_info (struct frame *f, struct glyph *glyph,
int *prop_idx, bool *close_p)
{
Lisp_Object prop;
int charpos;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment