+2013-08-14 Dmitry Antipov <dmantipov@yandex.ru>
+
+ * window.h (struct window): Convert scroll_bar_width
+ from Lisp_Object to integer. Adjust comment.
+ (WINDOW_CONFIG_SCROLL_BAR_WIDTH, WINDOW_CONFIG_SCROLL_BAR_COLS):
+ Adjust users.
+ * window.c (wset_scroll_bar_width): Remove.
+ (make_window): Initialize scroll_bar_width.
+ (Fsplit_window_internal): Use direct assignment.
+ (Fset_window_configuration, save_window_save):
+ Convert Lisp_Object to integer and back where appropriate.
+ (Fset_window_scroll_bars): Adjust user. Return t if any scroll
+ bar was actually changed, and mention this in docstring.
+
2013-08-13 Paul Eggert <eggert@cs.ucla.edu>
* decompress.c: Minor simplifications.
w->pointm = val;
}
static void
-wset_scroll_bar_width (struct window *w, Lisp_Object val)
-{
- w->scroll_bar_width = val;
-}
-static void
wset_start (struct window *w, Lisp_Object val)
{
w->start = val;
w->left_fringe_width = w->right_fringe_width = -1;
w->phys_cursor_type = -1;
w->phys_cursor_width = -1;
+ w->scroll_bar_width = -1;
w->column_number_displayed = -1;
/* Reset window_list. */
n->left_fringe_width = r->left_fringe_width;
n->right_fringe_width = r->right_fringe_width;
n->fringes_outside_margins = r->fringes_outside_margins;
- wset_scroll_bar_width (n, r->scroll_bar_width);
+ n->scroll_bar_width = r->scroll_bar_width;
wset_vertical_scroll_bar_type (n, r->vertical_scroll_bar_type);
/* Directly assign orthogonal coordinates and sizes. */
w->left_fringe_width = XINT (p->left_fringe_width);
w->right_fringe_width = XINT (p->right_fringe_width);
w->fringes_outside_margins = !NILP (p->fringes_outside_margins);
- wset_scroll_bar_width (w, p->scroll_bar_width);
+ w->scroll_bar_width = XINT (p->scroll_bar_width);
wset_vertical_scroll_bar_type (w, p->vertical_scroll_bar_type);
wset_dedicated (w, p->dedicated);
wset_combination_limit (w, p->combination_limit);
p->left_fringe_width = make_number (w->left_fringe_width);
p->right_fringe_width = make_number (w->right_fringe_width);
p->fringes_outside_margins = w->fringes_outside_margins ? Qt : Qnil;
- p->scroll_bar_width = w->scroll_bar_width;
+ p->scroll_bar_width = make_number (w->scroll_bar_width);
p->vertical_scroll_bar_type = w->vertical_scroll_bar_type;
p->dedicated = w->dedicated;
p->combination_limit = w->combination_limit;
bar: left, right, or nil.
If WIDTH is nil, use the frame's scroll-bar width.
If VERTICAL-TYPE is t, use the frame's scroll-bar type.
-Fourth parameter HORIZONTAL-TYPE is currently unused. */)
- (Lisp_Object window, Lisp_Object width, Lisp_Object vertical_type, Lisp_Object horizontal_type)
+Fourth parameter HORIZONTAL-TYPE is currently unused.
+
+Return t if scroll bars was actually changed and nil otherwise. */)
+ (Lisp_Object window, Lisp_Object width,
+ Lisp_Object vertical_type, Lisp_Object horizontal_type)
{
struct window *w = decode_live_window (window);
+ int iwidth = (NILP (width) ? -1 : (CHECK_NATNUM (width), XINT (width)));
- if (!NILP (width))
- {
- CHECK_RANGED_INTEGER (width, 0, INT_MAX);
-
- if (XINT (width) == 0)
- vertical_type = Qnil;
- }
+ if (iwidth == 0)
+ vertical_type = Qnil;
if (!(NILP (vertical_type)
|| EQ (vertical_type, Qleft)
|| EQ (vertical_type, Qt)))
error ("Invalid type of vertical scroll bar");
- if (!EQ (w->scroll_bar_width, width)
+ if (w->scroll_bar_width != iwidth
|| !EQ (w->vertical_scroll_bar_type, vertical_type))
{
- wset_scroll_bar_width (w, width);
+ w->scroll_bar_width = iwidth;
wset_vertical_scroll_bar_type (w, vertical_type);
adjust_window_margins (w);
++windows_or_buffers_changed;
adjust_glyphs (XFRAME (WINDOW_FRAME (w)));
+ return Qt;
}
return Qnil;
it yet, or if the frame doesn't have any scroll bars, this is nil. */
Lisp_Object vertical_scroll_bar;
- /* Pixel width of scroll bars.
- A value of nil or t means use frame values. */
- Lisp_Object scroll_bar_width;
-
/* Type of vertical scroll bar. A value of nil means
no scroll bar. A value of t means use frame value. */
Lisp_Object vertical_scroll_bar_type;
int left_margin_cols;
int right_margin_cols;
+ /* Pixel width of scroll bars.
+ A value of -1 means use frame values. */
+ int scroll_bar_width;
+
/* Non-zero if this window is a minibuffer window. */
unsigned mini : 1;
nonzero. */
#define WINDOW_CONFIG_SCROLL_BAR_WIDTH(w) \
- (INTEGERP (w->scroll_bar_width) \
- ? XFASTINT (w->scroll_bar_width) \
+ (w->scroll_bar_width >= 0 ? w->scroll_bar_width \
: FRAME_CONFIG_SCROLL_BAR_WIDTH (WINDOW_XFRAME (w)))
/* Width that a scroll bar in window W should have, if there is one.
this is still nonzero. */
#define WINDOW_CONFIG_SCROLL_BAR_COLS(w) \
- (INTEGERP (w->scroll_bar_width) \
- ? ((XFASTINT (w->scroll_bar_width) \
+ (w->scroll_bar_width >= 0 \
+ ? ((w->scroll_bar_width \
+ WINDOW_FRAME_COLUMN_WIDTH (w) - 1) \
/ WINDOW_FRAME_COLUMN_WIDTH (w)) \
: FRAME_CONFIG_SCROLL_BAR_COLS (WINDOW_XFRAME (w)))