* dispextern.h (enum glyph_row_area): Add ANY_AREA member.
Fix comment.
(window_box, window_box_width, window_box_left, window_box_left_offset)
(window_box_right, window_box_right_offset): Adjust prototypes.
* xdisp.c (window_box, window_box_width, window_box_left)
(window_box_left_offset, window_box_right, window_box_right_offset):
Use enum glyph_row_area. Adjust users and tweak comment where needed.
(window_box_edges): Likewise. Lost 2nd arg since it is always ANY_AREA.
* nsterm.m (ns_clip_to_row):
* w32term.c (w32_clip_to_row):
* xterm.c (x_clip_to_row): Likewise.
+2013-08-28 Dmitry Antipov <dmantipov@yandex.ru>
+
+ Prefer enum glyph_row_area to int where appropriate.
+ * dispextern.h (enum glyph_row_area): Add ANY_AREA member.
+ Fix comment.
+ (window_box, window_box_width, window_box_left, window_box_left_offset)
+ (window_box_right, window_box_right_offset): Adjust prototypes.
+ * xdisp.c (window_box, window_box_width, window_box_left)
+ (window_box_left_offset, window_box_right, window_box_right_offset):
+ Use enum glyph_row_area. Adjust users and tweak comment where needed.
+ (window_box_edges): Likewise. Lost 2nd arg since it is always ANY_AREA.
+ * nsterm.m (ns_clip_to_row):
+ * w32term.c (w32_clip_to_row):
+ * xterm.c (x_clip_to_row): Likewise.
+
2013-08-28 Dmitry Antipov <dmantipov@yandex.ru>
* buffer.c (Foverlays_at, Foverlays_in, Fnext_overlay_change)
Glyph Rows
***********************************************************************/
-/* Area in window glyph matrix. If values are added or removed, the
- function mark_object in alloc.c has to be changed. */
+/* Area in window glyph matrix. If values are added or removed,
+ the function mark_glyph_matrix in alloc.c may need to be changed. */
enum glyph_row_area
{
+ ANY_AREA = -1,
LEFT_MARGIN_AREA,
TEXT_AREA,
RIGHT_MARGIN_AREA,
void set_vertical_scroll_bar (struct window *);
#endif
int try_window (Lisp_Object, struct text_pos, int);
-void window_box (struct window *, int, int *, int *, int *, int *);
+void window_box (struct window *, enum glyph_row_area,
+ int *, int *, int *, int *);
int window_box_height (struct window *);
int window_text_bottom_y (struct window *);
-int window_box_width (struct window *, int);
-int window_box_left (struct window *, int);
-int window_box_left_offset (struct window *, int);
-int window_box_right (struct window *, int);
-int window_box_right_offset (struct window *, int);
+int window_box_width (struct window *, enum glyph_row_area);
+int window_box_left (struct window *, enum glyph_row_area);
+int window_box_left_offset (struct window *, enum glyph_row_area);
+int window_box_right (struct window *, enum glyph_row_area);
+int window_box_right_offset (struct window *, enum glyph_row_area);
int estimate_mode_line_height (struct frame *, enum face_id);
void pixel_to_glyph_coords (struct frame *, int, int, int *, int *,
NativeRectangle *, int);
Get W's size. */
if (w)
{
- window_box (w, -1, 0, 0, &window_width, &window_height);
+ window_box (w, ANY_AREA, 0, 0, &window_width, &window_height);
header_line_p = WINDOW_WANTS_HEADER_LINE_P (w);
header_line_changed_p = header_line_p != matrix->header_line_p;
static void
-ns_clip_to_row (struct window *w, struct glyph_row *row, int area, BOOL gc)
+ns_clip_to_row (struct window *w, struct glyph_row *row,
+ enum glyph_row_area area, BOOL gc)
/* --------------------------------------------------------------------------
Internal (but parallels other terms): Focus drawing on given row
-------------------------------------------------------------------------- */
/* Get frame-relative bounding box of the text display area of W,
without mode lines. Include in this box the left and right
fringe of W. */
- window_box (w, -1, &x, &y, &width, &height);
+ window_box (w, ANY_AREA, &x, &y, &width, &height);
from_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->current_y);
to_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->desired_y);
}
/* Must clip because of partially visible lines. */
- ns_clip_to_row (w, row, -1, YES);
+ ns_clip_to_row (w, row, ANY_AREA, YES);
if (!p->overlay_p)
{
/* TODO: only needed in rare cases with last-resort font in HELLO..
should we do this more efficiently? */
- ns_clip_to_row (w, glyph_row, -1, NO); /* do ns_focus(f, &r, 1); if remove */
+ ns_clip_to_row (w, glyph_row, ANY_AREA, NO); /* do ns_focus(f, &r, 1); if remove */
face = FACE_FROM_ID (f, phys_cursor_glyph->face_id);
NSTRACE (ns_set_vertical_scroll_bar);
/* Get dimensions. */
- window_box (window, -1, 0, &window_y, 0, &window_height);
+ window_box (window, ANY_AREA, 0, &window_y, 0, &window_height);
top = window_y;
height = window_height;
width = WINDOW_CONFIG_SCROLL_BAR_COLS (window) * FRAME_COLUMN_WIDTH (f);
static void x_draw_hollow_cursor (struct window *, struct glyph_row *);
static void x_draw_bar_cursor (struct window *, struct glyph_row *, int,
enum text_cursor_kinds);
-static void w32_clip_to_row (struct window *, struct glyph_row *, int, HDC);
+static void w32_clip_to_row (struct window *, struct glyph_row *,
+ enum glyph_row_area, HDC);
static BOOL my_show_window (struct frame *, HWND, int);
static void my_set_window_pos (HWND, HWND, int, int, int, int, UINT);
#if 0
}
/* Must clip because of partially visible lines. */
- w32_clip_to_row (w, row, -1, hdc);
+ w32_clip_to_row (w, row, ANY_AREA, hdc);
if (p->which && p->which < max_fringe_bmp)
{
/* Get frame-relative bounding box of the text display area of W,
without mode lines. Include in this box the left and right
fringes of W. */
- window_box (w, -1, &x, &y, &width, &height);
+ window_box (w, ANY_AREA, &x, &y, &width, &height);
/* If the fringe is adjacent to the left (right) scroll bar of a
leftmost (rightmost, respectively) window, then extend its
bool fringe_extended_p;
/* Get window dimensions. */
- window_box (w, -1, 0, &window_y, 0, &window_height);
+ window_box (w, ANY_AREA, 0, &window_y, 0, &window_height);
top = window_y;
width = WINDOW_CONFIG_SCROLL_BAR_COLS (w) * FRAME_COLUMN_WIDTH (f);
height = window_height;
mode lines must be clipped to the whole window. */
static void
-w32_clip_to_row (struct window *w, struct glyph_row *row, int area, HDC hdc)
+w32_clip_to_row (struct window *w, struct glyph_row *row,
+ enum glyph_row_area area, HDC hdc)
{
RECT clip_rect;
int window_x, window_y, window_width;
return height;
}
-/* Return the pixel width of display area AREA of window W. AREA < 0
- means return the total width of W, not including fringes to
- the left and right of the window. */
+/* Return the pixel width of display area AREA of window W.
+ ANY_AREA means return the total width of W, not including
+ fringes to the left and right of the window. */
int
-window_box_width (struct window *w, int area)
+window_box_width (struct window *w, enum glyph_row_area area)
{
int cols = w->total_cols;
int pixels = 0;
}
/* Return the window-relative coordinate of the left edge of display
- area AREA of window W. AREA < 0 means return the left edge of the
+ area AREA of window W. ANY_AREA means return the left edge of the
whole window, to the right of the left fringe of W. */
int
-window_box_left_offset (struct window *w, int area)
+window_box_left_offset (struct window *w, enum glyph_row_area area)
{
int x;
/* Return the window-relative coordinate of the right edge of display
- area AREA of window W. AREA < 0 means return the right edge of the
+ area AREA of window W. ANY_AREA means return the right edge of the
whole window, to the left of the right fringe of W. */
int
-window_box_right_offset (struct window *w, int area)
+window_box_right_offset (struct window *w, enum glyph_row_area area)
{
return window_box_left_offset (w, area) + window_box_width (w, area);
}
/* Return the frame-relative coordinate of the left edge of display
- area AREA of window W. AREA < 0 means return the left edge of the
+ area AREA of window W. ANY_AREA means return the left edge of the
whole window, to the right of the left fringe of W. */
int
-window_box_left (struct window *w, int area)
+window_box_left (struct window *w, enum glyph_row_area area)
{
struct frame *f = XFRAME (w->frame);
int x;
/* Return the frame-relative coordinate of the right edge of display
- area AREA of window W. AREA < 0 means return the right edge of the
+ area AREA of window W. ANY_AREA means return the right edge of the
whole window, to the left of the right fringe of W. */
int
-window_box_right (struct window *w, int area)
+window_box_right (struct window *w, enum glyph_row_area area)
{
return window_box_left (w, area) + window_box_width (w, area);
}
/* Get the bounding box of the display area AREA of window W, without
- mode lines, in frame-relative coordinates. AREA < 0 means the
+ mode lines, in frame-relative coordinates. ANY_AREA means the
whole window, not including the left and right fringes of
the window. Return in *BOX_X and *BOX_Y the frame-relative pixel
coordinates of the upper-left corner of the box. Return in
*BOX_WIDTH, and *BOX_HEIGHT the pixel width and height of the box. */
void
-window_box (struct window *w, int area, int *box_x, int *box_y,
- int *box_width, int *box_height)
+window_box (struct window *w, enum glyph_row_area area, int *box_x,
+ int *box_y, int *box_width, int *box_height)
{
if (box_width)
*box_width = window_box_width (w, area);
/* Get the bounding box of the display area AREA of window W, without
- mode lines. AREA < 0 means the whole window, not including the
- left and right fringe of the window. Return in *TOP_LEFT_X
+ mode lines and both fringes of the window. Return in *TOP_LEFT_X
and TOP_LEFT_Y the frame-relative pixel coordinates of the
upper-left corner of the box. Return in *BOTTOM_RIGHT_X, and
*BOTTOM_RIGHT_Y the coordinates of the bottom-right corner of the
box. */
static void
-window_box_edges (struct window *w, int area, int *top_left_x, int *top_left_y,
- int *bottom_right_x, int *bottom_right_y)
+window_box_edges (struct window *w, int *top_left_x, int *top_left_y,
+ int *bottom_right_x, int *bottom_right_y)
{
- window_box (w, area, top_left_x, top_left_y, bottom_right_x,
- bottom_right_y);
+ window_box (w, ANY_AREA, top_left_x, top_left_y,
+ bottom_right_x, bottom_right_y);
*bottom_right_x += *top_left_x;
*bottom_right_y += *top_left_y;
}
{
int x0, x1, y0, y1;
- window_box_edges (w, -1, &x0, &y0, &x1, &y1);
+ window_box_edges (w, &x0, &y0, &x1, &y1);
y1 -= 1;
if (WINDOW_LEFT_FRINGE_WIDTH (w) == 0)
{
int x0, x1, y0, y1;
- window_box_edges (w, -1, &x0, &y0, &x1, &y1);
+ window_box_edges (w, &x0, &y0, &x1, &y1);
y1 -= 1;
if (WINDOW_LEFT_FRINGE_WIDTH (w) == 0)
static void x_draw_bar_cursor (struct window *, struct glyph_row *, int,
enum text_cursor_kinds);
-static void x_clip_to_row (struct window *, struct glyph_row *, int, GC);
+static void x_clip_to_row (struct window *, struct glyph_row *,
+ enum glyph_row_area, GC);
static void x_flush (struct frame *f);
static void x_update_begin (struct frame *);
static void x_update_window_begin (struct window *);
struct face *face = p->face;
/* Must clip because of partially visible lines. */
- x_clip_to_row (w, row, -1, gc);
+ x_clip_to_row (w, row, ANY_AREA, gc);
if (!p->overlay_p)
{
/* Get frame-relative bounding box of the text display area of W,
without mode lines. Include in this box the left and right
fringe of W. */
- window_box (w, -1, &x, &y, &width, &height);
+ window_box (w, ANY_AREA, &x, &y, &width, &height);
#ifdef USE_TOOLKIT_SCROLL_BARS
/* If the fringe is adjacent to the left (right) scroll bar of a
#endif
/* Get window dimensions. */
- window_box (w, -1, 0, &window_y, 0, &window_height);
+ window_box (w, ANY_AREA, 0, &window_y, 0, &window_height);
top = window_y;
width = WINDOW_CONFIG_SCROLL_BAR_COLS (w) * FRAME_COLUMN_WIDTH (f);
height = window_height;
mode lines must be clipped to the whole window. */
static void
-x_clip_to_row (struct window *w, struct glyph_row *row, int area, GC gc)
+x_clip_to_row (struct window *w, struct glyph_row *row,
+ enum glyph_row_area area, GC gc)
{
struct frame *f = XFRAME (WINDOW_FRAME (w));
XRectangle clip_rect;