w->display_table = val;
}
static void
-wset_left_fringe_width (struct window *w, Lisp_Object val)
-{
- w->left_fringe_width = val;
-}
-static void
wset_left_margin_cols (struct window *w, Lisp_Object val)
{
w->left_margin_cols = val;
w->pointm = val;
}
static void
-wset_right_fringe_width (struct window *w, Lisp_Object val)
-{
- w->right_fringe_width = val;
-}
-static void
wset_right_margin_cols (struct window *w, Lisp_Object val)
{
w->right_margin_cols = val;
/* Initialize non-Lisp data. Note that allocate_window zeroes out all
non-Lisp data, so do it only for slots which should not be zero. */
w->nrows_scale_factor = w->ncols_scale_factor = 1;
+ w->left_fringe_width = w->right_fringe_width = -1;
w->phys_cursor_type = -1;
w->phys_cursor_width = -1;
w->column_number_displayed = -1;
/* Get special geometry settings from reference window. */
wset_left_margin_cols (n, r->left_margin_cols);
wset_right_margin_cols (n, r->right_margin_cols);
- wset_left_fringe_width (n, r->left_fringe_width);
- wset_right_fringe_width (n, r->right_fringe_width);
+ 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);
wset_vertical_scroll_bar_type (n, r->vertical_scroll_bar_type);
wset_display_table (w, p->display_table);
wset_left_margin_cols (w, p->left_margin_cols);
wset_right_margin_cols (w, p->right_margin_cols);
- wset_left_fringe_width (w, p->left_fringe_width);
- wset_right_fringe_width (w, p->right_fringe_width);
+ 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);
wset_vertical_scroll_bar_type (w, p->vertical_scroll_bar_type);
p->display_table = w->display_table;
p->left_margin_cols = w->left_margin_cols;
p->right_margin_cols = w->right_margin_cols;
- p->left_fringe_width = w->left_fringe_width;
- p->right_fringe_width = w->right_fringe_width;
+ 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->vertical_scroll_bar_type = w->vertical_scroll_bar_type;
the command `set-fringe-style'.
If optional fourth arg OUTSIDE-MARGINS is non-nil, draw the fringes
outside of the display margins. By default, fringes are drawn between
-display marginal areas and the text area. */)
- (Lisp_Object window, Lisp_Object left_width, Lisp_Object right_width, Lisp_Object outside_margins)
+display marginal areas and the text area.
+
+Return t if any fringe was actually changed and nil otherwise. */)
+ (Lisp_Object window, Lisp_Object left_width,
+ Lisp_Object right_width, Lisp_Object outside_margins)
{
struct window *w = decode_live_window (window);
- int outside = !NILP (outside_margins);
+ int left, right, outside = !NILP (outside_margins);
- if (!NILP (left_width))
- CHECK_NATNUM (left_width);
- if (!NILP (right_width))
- CHECK_NATNUM (right_width);
+ left = (NILP (left_width) ? -1
+ : (CHECK_NATNUM (left_width), XINT (left_width)));
+ right = (NILP (right_width) ? -1
+ : (CHECK_NATNUM (right_width), XINT (right_width)));
- /* Do nothing on a tty. */
+ /* Do nothing on a tty or if nothing to actually change. */
if (FRAME_WINDOW_P (WINDOW_XFRAME (w))
- && (!EQ (w->left_fringe_width, left_width)
- || !EQ (w->right_fringe_width, right_width)
+ && (w->left_fringe_width != left
+ || w->right_fringe_width != right
|| w->fringes_outside_margins != outside))
{
- wset_left_fringe_width (w, left_width);
- wset_right_fringe_width (w, right_width);
+ w->left_fringe_width = left;
+ w->right_fringe_width = right;
w->fringes_outside_margins = outside;
adjust_window_margins (w);
++windows_or_buffers_changed;
adjust_glyphs (XFRAME (WINDOW_FRAME (w)));
+ return Qt;
}
return Qnil;
Lisp_Object left_margin_cols;
Lisp_Object right_margin_cols;
- /* Width of left and right fringes.
- A value of nil or t means use frame values. */
- Lisp_Object left_fringe_width;
- Lisp_Object right_fringe_width;
-
/* Pixel width of scroll bars.
A value of nil or t means use frame values. */
Lisp_Object scroll_bar_width;
/* This is handy for undrawing the cursor. */
int phys_cursor_ascent, phys_cursor_height;
+ /* Width of left and right fringes, in pixels.
+ A value of -1 means use frame values. */
+ int left_fringe_width;
+ int right_fringe_width;
+
/* Non-zero if this window is a minibuffer window. */
unsigned mini : 1;
able to split windows horizontally nicely. */
#define WINDOW_FRINGE_COLS(W) \
- ((INTEGERP (W->left_fringe_width) \
- || INTEGERP (W->right_fringe_width)) \
- ? ((WINDOW_LEFT_FRINGE_WIDTH (W) \
- + WINDOW_RIGHT_FRINGE_WIDTH (W) \
+ ((W->left_fringe_width >= 0 \
+ && W->right_fringe_width >= 0) \
+ ? ((W->left_fringe_width \
+ + W->right_fringe_width \
+ WINDOW_FRAME_COLUMN_WIDTH (W) - 1) \
/ WINDOW_FRAME_COLUMN_WIDTH (W)) \
: FRAME_FRINGE_COLS (WINDOW_XFRAME (W)))
/* Pixel-width of the left and right fringe. */
#define WINDOW_LEFT_FRINGE_WIDTH(W) \
- (INTEGERP (W->left_fringe_width) \
- ? XFASTINT (W->left_fringe_width) \
+ (W->left_fringe_width >= 0 ? W->left_fringe_width \
: FRAME_LEFT_FRINGE_WIDTH (WINDOW_XFRAME (W)))
#define WINDOW_RIGHT_FRINGE_WIDTH(W) \
- (INTEGERP (W->right_fringe_width) \
- ? XFASTINT (W->right_fringe_width) \
+ (W->right_fringe_width >= 0 ? W->right_fringe_width \
: FRAME_RIGHT_FRINGE_WIDTH (WINDOW_XFRAME (W)))
/* Total width of fringes in pixels. */