mirror of
git://git.sv.gnu.org/emacs.git
synced 2026-01-06 03:40:56 -08:00
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.
This commit is contained in:
parent
c65a2df9e3
commit
c3c4768d2b
7 changed files with 68 additions and 47 deletions
|
|
@ -1,3 +1,18 @@
|
|||
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)
|
||||
|
|
|
|||
|
|
@ -751,11 +751,12 @@ void check_matrix_pointer_lossage (struct glyph_matrix *);
|
|||
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,
|
||||
|
|
@ -3163,14 +3164,15 @@ int resize_mini_window (struct window *, int);
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -413,7 +413,7 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
|
|||
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;
|
||||
|
|
|
|||
11
src/nsterm.m
11
src/nsterm.m
|
|
@ -885,7 +885,8 @@ ns_unfocus (struct frame *f)
|
|||
|
||||
|
||||
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
|
||||
-------------------------------------------------------------------------- */
|
||||
|
|
@ -2044,7 +2045,7 @@ ns_scroll_run (struct window *w, struct run *run)
|
|||
/* 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);
|
||||
|
|
@ -2219,7 +2220,7 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
|
|||
}
|
||||
|
||||
/* 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)
|
||||
{
|
||||
|
|
@ -2399,7 +2400,7 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row,
|
|||
|
||||
/* 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);
|
||||
|
|
@ -3710,7 +3711,7 @@ ns_set_vertical_scroll_bar (struct window *window,
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -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_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
|
||||
|
|
@ -848,7 +849,7 @@ w32_draw_fringe_bitmap (struct window *w, struct glyph_row *row,
|
|||
}
|
||||
|
||||
/* 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)
|
||||
{
|
||||
|
|
@ -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,
|
||||
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
|
||||
|
|
@ -3825,7 +3826,7 @@ w32_set_vertical_scroll_bar (struct window *w,
|
|||
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;
|
||||
|
|
@ -5118,7 +5119,8 @@ w32_read_socket (struct terminal *terminal,
|
|||
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;
|
||||
|
|
|
|||
45
src/xdisp.c
45
src/xdisp.c
|
|
@ -966,12 +966,12 @@ window_text_bottom_y (struct window *w)
|
|||
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;
|
||||
|
|
@ -1049,11 +1049,11 @@ window_box_height (struct window *w)
|
|||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
|
|
@ -1081,21 +1081,21 @@ window_box_left_offset (struct window *w, int area)
|
|||
|
||||
|
||||
/* 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;
|
||||
|
|
@ -1111,25 +1111,25 @@ window_box_left (struct window *w, int area)
|
|||
|
||||
|
||||
/* 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);
|
||||
|
|
@ -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
|
||||
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;
|
||||
}
|
||||
|
|
@ -28727,7 +28726,7 @@ x_draw_vertical_border (struct window *w)
|
|||
{
|
||||
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)
|
||||
|
|
@ -28740,7 +28739,7 @@ x_draw_vertical_border (struct window *w)
|
|||
{
|
||||
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)
|
||||
|
|
|
|||
12
src/xterm.c
12
src/xterm.c
|
|
@ -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,
|
||||
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 *);
|
||||
|
|
@ -715,7 +716,7 @@ x_draw_fringe_bitmap (struct window *w, struct glyph_row *row, struct draw_fring
|
|||
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)
|
||||
{
|
||||
|
|
@ -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,
|
||||
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
|
||||
|
|
@ -5147,7 +5148,7 @@ XTset_vertical_scroll_bar (struct window *w, int portion, int whole, int positio
|
|||
#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;
|
||||
|
|
@ -7170,7 +7171,8 @@ XTread_socket (struct terminal *terminal, struct input_event *hold_quit)
|
|||
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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue