+2013-08-13 Dmitry Antipov <dmantipov@yandex.ru>
+
+ * window.h (WINDOW_FRINGE_EXTENDED_P): New macro.
+ * nsterm.m (ns_set_vertical_scroll_bar): Use it. Use convenient
+ bool instead of BOOL.
+ * w32term.h (struct scroll_bar): Convert fringe_extended_p
+ from Lisp_Object to bitfield. Adjust comment.
+ * w32term.c (x_scroll_bar_create): Adjust user.
+ Use WINDOW_FRINGE_EXTENDED_P and bool for boolean.
+ * xterm.c (XTset_vertical_scroll_bar): Likewise.
+ Use bool for boolean.
+ * xterm.h (struct scroll_bar): Prefer commonly used `unsigned'
+ to `unsigned int' when defining a bitfield.
+
2013-08-13 Paul Eggert <eggert@cs.ucla.edu>
* decompress.c (Fzlib_decompress_region): Try to clarify 'avail_out'.
int window_y, window_height;
int top, left, height, width, sb_width, sb_left;
EmacsScroller *bar;
- BOOL fringe_extended_p;
+ bool fringe_extended_p;
/* optimization; display engine sends WAY too many of these.. */
if (!NILP (window->vertical_scroll_bar))
v = [view frame];
r.origin.y = (v.size.height - r.size.height - r.origin.y);
- if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (window))
- fringe_extended_p = (WINDOW_LEFTMOST_P (window)
- && WINDOW_LEFT_FRINGE_WIDTH (window)
- && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (window)
- || WINDOW_LEFT_MARGIN_COLS (window) == 0));
- else
- fringe_extended_p = (WINDOW_RIGHTMOST_P (window)
- && WINDOW_RIGHT_FRINGE_WIDTH (window)
- && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (window)
- || WINDOW_RIGHT_MARGIN_COLS (window) == 0));
+ fringe_extended_p = WINDOW_FRINGE_EXTENDED_P (w);
XSETWINDOW (win, window);
block_input ();
XSETINT (bar->start, 0);
XSETINT (bar->end, 0);
bar->dragging = Qnil;
- bar->fringe_extended_p = Qnil;
+ bar->fringe_extended_p = 0;
/* Requires geometry to be set before call to create the real window */
struct scroll_bar *bar;
int top, height, left, sb_left, width, sb_width;
int window_y, window_height;
- int fringe_extended_p;
+ bool fringe_extended_p;
/* Get window dimensions. */
window_box (w, -1, 0, &window_y, 0, &window_height);
else
sb_left = left + (WINDOW_LEFTMOST_P (w) ? 0 : width - sb_width);
- if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w))
- fringe_extended_p = (WINDOW_LEFTMOST_P (w)
- && WINDOW_LEFT_FRINGE_WIDTH (w)
- && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
- || WINDOW_LEFT_MARGIN_COLS (w) == 0));
- else
- fringe_extended_p = (WINDOW_RIGHTMOST_P (w)
- && WINDOW_RIGHT_FRINGE_WIDTH (w)
- && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
- || WINDOW_RIGHT_MARGIN_COLS (w) == 0));
+ fringe_extended_p = WINDOW_FRINGE_EXTENDED_P (w);
/* Does the scroll bar exist yet? */
if (NILP (w->vertical_scroll_bar))
hwnd = SCROLL_BAR_W32_WINDOW (bar);
/* If already correctly positioned, do nothing. */
- if ( XINT (bar->left) == sb_left
- && XINT (bar->top) == top
- && XINT (bar->width) == sb_width
- && XINT (bar->height) == height
- && !NILP (bar->fringe_extended_p) == fringe_extended_p )
+ if (XINT (bar->left) == sb_left
+ && XINT (bar->top) == top
+ && XINT (bar->width) == sb_width
+ && XINT (bar->height) == height
+ && bar->fringe_extended_p == fringe_extended_p)
{
/* Redraw after clear_frame. */
if (!my_show_window (f, hwnd, SW_NORMAL))
unblock_input ();
}
}
- bar->fringe_extended_p = fringe_extended_p ? Qt : Qnil;
+ bar->fringe_extended_p = fringe_extended_p;
w32_set_scroll_bar_thumb (bar, portion, position, whole);
XSETVECTOR (barobj, bar);
being dragged, this is Qnil. */
Lisp_Object dragging;
- /* t if the background of the fringe that is adjacent to a scroll
+ /* 1 if the background of the fringe that is adjacent to a scroll
bar is extended to the gap between the fringe and the bar. */
- Lisp_Object fringe_extended_p;
+ unsigned fringe_extended_p : 1;
};
/* Turning a lisp vector value into a pointer to a struct scroll_bar. */
#define WINDOW_TEXT_TO_FRAME_PIXEL_X(W, X) \
(window_box_left ((W), TEXT_AREA) + (X))
-/* This is the window in which the terminal's cursor should
- be left when nothing is being done with it. This must
- always be a leaf window, and its buffer is selected by
- the top level editing loop at the end of each command.
-
- This value is always the same as
- FRAME_SELECTED_WINDOW (selected_frame). */
+/* Nonzero if the background of the window W's fringe that is adjacent to
+ a scroll bar is extended to the gap between the fringe and the bar. */
+
+#define WINDOW_FRINGE_EXTENDED_P(w) \
+ (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w) \
+ ? (WINDOW_LEFTMOST_P (w) \
+ && WINDOW_LEFT_FRINGE_WIDTH (w) \
+ && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) \
+ || WINDOW_LEFT_MARGIN_COLS (w) == 0)) \
+ : (WINDOW_RIGHTMOST_P (w) \
+ && WINDOW_RIGHT_FRINGE_WIDTH (w) \
+ && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w) \
+ || WINDOW_RIGHT_MARGIN_COLS (w) == 0)))
+
+/* This is the window in which the terminal's cursor should be left when
+ nothing is being done with it. This must always be a leaf window, and its
+ buffer is selected by the top level editing loop at the end of each command.
+
+ This value is always the same as FRAME_SELECTED_WINDOW (selected_frame). */
extern Lisp_Object selected_window;
int top, height, left, sb_left, width, sb_width;
int window_y, window_height;
#ifdef USE_TOOLKIT_SCROLL_BARS
- int fringe_extended_p;
+ bool fringe_extended_p;
#endif
/* Get window dimensions. */
#endif
#ifdef USE_TOOLKIT_SCROLL_BARS
- if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w))
- fringe_extended_p = (WINDOW_LEFTMOST_P (w)
- && WINDOW_LEFT_FRINGE_WIDTH (w)
- && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
- || WINDOW_LEFT_MARGIN_COLS (w) == 0));
- else
- fringe_extended_p = (WINDOW_RIGHTMOST_P (w)
- && WINDOW_RIGHT_FRINGE_WIDTH (w)
- && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (w)
- || WINDOW_RIGHT_MARGIN_COLS (w) == 0));
+ fringe_extended_p = WINDOW_FRINGE_EXTENDED_P (w);
#endif
/* Does the scroll bar exist yet? */
/* 1 if the background of the fringe that is adjacent to a scroll
bar is extended to the gap between the fringe and the bar. */
- unsigned int fringe_extended_p : 1;
+ unsigned fringe_extended_p : 1;
};
/* Turning a lisp vector value into a pointer to a struct scroll_bar. */