Commit c3c4768d authored by Dmitry Antipov's avatar Dmitry Antipov

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.
parent c65a2df9
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> 2013-08-28 Dmitry Antipov <dmantipov@yandex.ru>
* buffer.c (Foverlays_at, Foverlays_in, Fnext_overlay_change) * buffer.c (Foverlays_at, Foverlays_in, Fnext_overlay_change)
......
...@@ -751,11 +751,12 @@ void check_matrix_pointer_lossage (struct glyph_matrix *); ...@@ -751,11 +751,12 @@ void check_matrix_pointer_lossage (struct glyph_matrix *);
Glyph Rows Glyph Rows
***********************************************************************/ ***********************************************************************/
/* Area in window glyph matrix. If values are added or removed, the /* Area in window glyph matrix. If values are added or removed,
function mark_object in alloc.c has to be changed. */ the function mark_glyph_matrix in alloc.c may need to be changed. */
enum glyph_row_area enum glyph_row_area
{ {
ANY_AREA = -1,
LEFT_MARGIN_AREA, LEFT_MARGIN_AREA,
TEXT_AREA, TEXT_AREA,
RIGHT_MARGIN_AREA, RIGHT_MARGIN_AREA,
...@@ -3163,14 +3164,15 @@ int resize_mini_window (struct window *, int); ...@@ -3163,14 +3164,15 @@ int resize_mini_window (struct window *, int);
void set_vertical_scroll_bar (struct window *); void set_vertical_scroll_bar (struct window *);
#endif #endif
int try_window (Lisp_Object, struct text_pos, int); 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_box_height (struct window *);
int window_text_bottom_y (struct window *); int window_text_bottom_y (struct window *);
int window_box_width (struct window *, int); int window_box_width (struct window *, enum glyph_row_area);
int window_box_left (struct window *, int); int window_box_left (struct window *, enum glyph_row_area);
int window_box_left_offset (struct window *, int); int window_box_left_offset (struct window *, enum glyph_row_area);
int window_box_right (struct window *, int); int window_box_right (struct window *, enum glyph_row_area);
int window_box_right_offset (struct window *, int); int window_box_right_offset (struct window *, enum glyph_row_area);
int estimate_mode_line_height (struct frame *, enum face_id); int estimate_mode_line_height (struct frame *, enum face_id);
void pixel_to_glyph_coords (struct frame *, int, int, int *, int *, void pixel_to_glyph_coords (struct frame *, int, int, int *, int *,
NativeRectangle *, int); NativeRectangle *, int);
......
...@@ -413,7 +413,7 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y ...@@ -413,7 +413,7 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
Get W's size. */ Get W's size. */
if (w) 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_p = WINDOW_WANTS_HEADER_LINE_P (w);
header_line_changed_p = header_line_p != matrix->header_line_p; header_line_changed_p = header_line_p != matrix->header_line_p;
......
...@@ -885,7 +885,8 @@ Free a pool and temporary objects it refers to (callable from C) ...@@ -885,7 +885,8 @@ Free a pool and temporary objects it refers to (callable from C)
static void 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 Internal (but parallels other terms): Focus drawing on given row
-------------------------------------------------------------------------- */ -------------------------------------------------------------------------- */
...@@ -2044,7 +2045,7 @@ Free a pool and temporary objects it refers to (callable from C) ...@@ -2044,7 +2045,7 @@ Free a pool and temporary objects it refers to (callable from C)
/* Get frame-relative bounding box of the text display area of W, /* Get frame-relative bounding box of the text display area of W,
without mode lines. Include in this box the left and right without mode lines. Include in this box the left and right
fringe of W. */ 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); from_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->current_y);
to_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->desired_y); to_y = WINDOW_TO_FRAME_PIXEL_Y (w, run->desired_y);
...@@ -2219,7 +2220,7 @@ Free a pool and temporary objects it refers to (callable from C) ...@@ -2219,7 +2220,7 @@ Free a pool and temporary objects it refers to (callable from C)
} }
/* Must clip because of partially visible lines. */ /* 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) if (!p->overlay_p)
{ {
...@@ -2399,7 +2400,7 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar cursors. ...@@ -2399,7 +2400,7 @@ Note that CURSOR_WIDTH is meaningful only for (h)bar cursors.
/* TODO: only needed in rare cases with last-resort font in HELLO.. /* TODO: only needed in rare cases with last-resort font in HELLO..
should we do this more efficiently? */ 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); face = FACE_FROM_ID (f, phys_cursor_glyph->face_id);
...@@ -3710,7 +3711,7 @@ overwriting cursor (usually when cursor on a tab) */ ...@@ -3710,7 +3711,7 @@ overwriting cursor (usually when cursor on a tab) */
NSTRACE (ns_set_vertical_scroll_bar); NSTRACE (ns_set_vertical_scroll_bar);
/* Get dimensions. */ /* 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; top = window_y;
height = window_height; height = window_height;
width = WINDOW_CONFIG_SCROLL_BAR_COLS (window) * FRAME_COLUMN_WIDTH (f); width = WINDOW_CONFIG_SCROLL_BAR_COLS (window) * FRAME_COLUMN_WIDTH (f);
......
...@@ -240,7 +240,8 @@ static void x_frame_rehighlight (struct w32_display_info *); ...@@ -240,7 +240,8 @@ static void x_frame_rehighlight (struct w32_display_info *);
static void x_draw_hollow_cursor (struct window *, struct glyph_row *); static void x_draw_hollow_cursor (struct window *, struct glyph_row *);
static void x_draw_bar_cursor (struct window *, struct glyph_row *, int, static void x_draw_bar_cursor (struct window *, struct glyph_row *, int,
enum text_cursor_kinds); 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 BOOL my_show_window (struct frame *, HWND, int);
static void my_set_window_pos (HWND, HWND, int, int, int, int, UINT); static void my_set_window_pos (HWND, HWND, int, int, int, int, UINT);
#if 0 #if 0
...@@ -848,7 +849,7 @@ w32_draw_fringe_bitmap (struct window *w, struct glyph_row *row, ...@@ -848,7 +849,7 @@ w32_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
} }
/* Must clip because of partially visible lines. */ /* 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) if (p->which && p->which < max_fringe_bmp)
{ {
...@@ -2731,7 +2732,7 @@ x_scroll_run (struct window *w, struct run *run) ...@@ -2731,7 +2732,7 @@ x_scroll_run (struct window *w, struct run *run)
/* Get frame-relative bounding box of the text display area of W, /* Get frame-relative bounding box of the text display area of W,
without mode lines. Include in this box the left and right without mode lines. Include in this box the left and right
fringes of W. */ 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 /* If the fringe is adjacent to the left (right) scroll bar of a
leftmost (rightmost, respectively) window, then extend its leftmost (rightmost, respectively) window, then extend its
...@@ -3825,7 +3826,7 @@ w32_set_vertical_scroll_bar (struct window *w, ...@@ -3825,7 +3826,7 @@ w32_set_vertical_scroll_bar (struct window *w,
bool fringe_extended_p; bool fringe_extended_p;
/* Get window dimensions. */ /* 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; top = window_y;
width = WINDOW_CONFIG_SCROLL_BAR_COLS (w) * FRAME_COLUMN_WIDTH (f); width = WINDOW_CONFIG_SCROLL_BAR_COLS (w) * FRAME_COLUMN_WIDTH (f);
height = window_height; height = window_height;
...@@ -5118,7 +5119,8 @@ w32_read_socket (struct terminal *terminal, ...@@ -5118,7 +5119,8 @@ w32_read_socket (struct terminal *terminal,
mode lines must be clipped to the whole window. */ mode lines must be clipped to the whole window. */
static void 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; RECT clip_rect;
int window_x, window_y, window_width; int window_x, window_y, window_width;
......
...@@ -966,12 +966,12 @@ window_text_bottom_y (struct window *w) ...@@ -966,12 +966,12 @@ window_text_bottom_y (struct window *w)
return height; return height;
} }
/* Return the pixel width of display area AREA of window W. AREA < 0 /* Return the pixel width of display area AREA of window W.
means return the total width of W, not including fringes to ANY_AREA means return the total width of W, not including
the left and right of the window. */ fringes to the left and right of the window. */
int 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 cols = w->total_cols;
int pixels = 0; int pixels = 0;
...@@ -1049,11 +1049,11 @@ window_box_height (struct window *w) ...@@ -1049,11 +1049,11 @@ window_box_height (struct window *w)
} }
/* Return the window-relative coordinate of the left edge of display /* 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. */ whole window, to the right of the left fringe of W. */
int int
window_box_left_offset (struct window *w, int area) window_box_left_offset (struct window *w, enum glyph_row_area area)
{ {
int x; int x;
...@@ -1081,21 +1081,21 @@ window_box_left_offset (struct window *w, int area) ...@@ -1081,21 +1081,21 @@ window_box_left_offset (struct window *w, int area)
/* Return the window-relative coordinate of the right edge of display /* 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. */ whole window, to the left of the right fringe of W. */
int 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 window_box_left_offset (w, area) + window_box_width (w, area);
} }
/* Return the frame-relative coordinate of the left edge of display /* 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. */ whole window, to the right of the left fringe of W. */
int 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); struct frame *f = XFRAME (w->frame);
int x; int x;
...@@ -1111,25 +1111,25 @@ window_box_left (struct window *w, int area) ...@@ -1111,25 +1111,25 @@ window_box_left (struct window *w, int area)
/* Return the frame-relative coordinate of the right edge of display /* 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. */ whole window, to the left of the right fringe of W. */
int 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); return window_box_left (w, area) + window_box_width (w, area);
} }
/* Get the bounding box of the display area AREA of window W, without /* 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 whole window, not including the left and right fringes of
the window. Return in *BOX_X and *BOX_Y the frame-relative pixel the window. Return in *BOX_X and *BOX_Y the frame-relative pixel
coordinates of the upper-left corner of the box. Return in coordinates of the upper-left corner of the box. Return in
*BOX_WIDTH, and *BOX_HEIGHT the pixel width and height of the box. */ *BOX_WIDTH, and *BOX_HEIGHT the pixel width and height of the box. */
void void
window_box (struct window *w, int area, int *box_x, int *box_y, window_box (struct window *w, enum glyph_row_area area, int *box_x,
int *box_width, int *box_height) int *box_y, int *box_width, int *box_height)
{ {
if (box_width) if (box_width)
*box_width = window_box_width (w, area); *box_width = window_box_width (w, area);
...@@ -1147,19 +1147,18 @@ window_box (struct window *w, int area, int *box_x, int *box_y, ...@@ -1147,19 +1147,18 @@ window_box (struct window *w, int area, int *box_x, int *box_y,
/* Get the bounding box of the display area AREA of window W, without /* Get the bounding box of the display area AREA of window W, without
mode lines. AREA < 0 means the whole window, not including the mode lines and both fringes of the window. Return in *TOP_LEFT_X
left and right fringe of the window. Return in *TOP_LEFT_X
and TOP_LEFT_Y the frame-relative pixel coordinates of the and TOP_LEFT_Y the frame-relative pixel coordinates of the
upper-left corner of the box. Return in *BOTTOM_RIGHT_X, and upper-left corner of the box. Return in *BOTTOM_RIGHT_X, and
*BOTTOM_RIGHT_Y the coordinates of the bottom-right corner of the *BOTTOM_RIGHT_Y the coordinates of the bottom-right corner of the
box. */ box. */
static void static void
window_box_edges (struct window *w, int area, int *top_left_x, int *top_left_y, window_box_edges (struct window *w, int *top_left_x, int *top_left_y,
int *bottom_right_x, int *bottom_right_y) int *bottom_right_x, int *bottom_right_y)
{ {
window_box (w, area, top_left_x, top_left_y, bottom_right_x, window_box (w, ANY_AREA, top_left_x, top_left_y,
bottom_right_y); bottom_right_x, bottom_right_y);
*bottom_right_x += *top_left_x; *bottom_right_x += *top_left_x;
*bottom_right_y += *top_left_y; *bottom_right_y += *top_left_y;
} }
...@@ -28727,7 +28726,7 @@ x_draw_vertical_border (struct window *w) ...@@ -28727,7 +28726,7 @@ x_draw_vertical_border (struct window *w)
{ {
int x0, x1, y0, y1; int x0, x1, y0, y1;
window_box_edges (w, -1, &x0, &y0, &x1, &y1); window_box_edges (w, &x0, &y0, &x1, &y1);
y1 -= 1; y1 -= 1;
if (WINDOW_LEFT_FRINGE_WIDTH (w) == 0) if (WINDOW_LEFT_FRINGE_WIDTH (w) == 0)
...@@ -28740,7 +28739,7 @@ x_draw_vertical_border (struct window *w) ...@@ -28740,7 +28739,7 @@ x_draw_vertical_border (struct window *w)
{ {
int x0, x1, y0, y1; int x0, x1, y0, y1;
window_box_edges (w, -1, &x0, &y0, &x1, &y1); window_box_edges (w, &x0, &y0, &x1, &y1);
y1 -= 1; y1 -= 1;
if (WINDOW_LEFT_FRINGE_WIDTH (w) == 0) if (WINDOW_LEFT_FRINGE_WIDTH (w) == 0)
......
...@@ -314,7 +314,8 @@ static void x_draw_hollow_cursor (struct window *, struct glyph_row *); ...@@ -314,7 +314,8 @@ static void x_draw_hollow_cursor (struct window *, struct glyph_row *);
static void x_draw_bar_cursor (struct window *, struct glyph_row *, int, static void x_draw_bar_cursor (struct window *, struct glyph_row *, int,
enum text_cursor_kinds); 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_flush (struct frame *f);
static void x_update_begin (struct frame *); static void x_update_begin (struct frame *);
static void x_update_window_begin (struct window *); static void x_update_window_begin (struct window *);
...@@ -715,7 +716,7 @@ x_draw_fringe_bitmap (struct window *w, struct glyph_row *row, struct draw_fring ...@@ -715,7 +716,7 @@ x_draw_fringe_bitmap (struct window *w, struct glyph_row *row, struct draw_fring
struct face *face = p->face; struct face *face = p->face;
/* Must clip because of partially visible lines. */ /* 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) if (!p->overlay_p)
{ {
...@@ -3247,7 +3248,7 @@ x_scroll_run (struct window *w, struct run *run) ...@@ -3247,7 +3248,7 @@ x_scroll_run (struct window *w, struct run *run)
/* Get frame-relative bounding box of the text display area of W, /* Get frame-relative bounding box of the text display area of W,
without mode lines. Include in this box the left and right without mode lines. Include in this box the left and right
fringe of W. */ 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 #ifdef USE_TOOLKIT_SCROLL_BARS
/* If the fringe is adjacent to the left (right) scroll bar of a /* If the fringe is adjacent to the left (right) scroll bar of a
...@@ -5147,7 +5148,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio ...@@ -5147,7 +5148,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio
#endif #endif
/* Get window dimensions. */ /* 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; top = window_y;
width = WINDOW_CONFIG_SCROLL_BAR_COLS (w) * FRAME_COLUMN_WIDTH (f); width = WINDOW_CONFIG_SCROLL_BAR_COLS (w) * FRAME_COLUMN_WIDTH (f);
height = window_height; height = window_height;
...@@ -7170,7 +7171,8 @@ XTread_socket (struct terminal *terminal, struct input_event *hold_quit) ...@@ -7170,7 +7171,8 @@ XTread_socket (struct terminal *terminal, struct input_event *hold_quit)
mode lines must be clipped to the whole window. */ mode lines must be clipped to the whole window. */
static void 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)); struct frame *f = XFRAME (WINDOW_FRAME (w));
XRectangle clip_rect; XRectangle clip_rect;
......
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