From: Dmitry Antipov Date: Fri, 23 Aug 2013 04:03:25 +0000 (+0400) Subject: Minor cleanup for redisplay interface and few related functions. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~1686^2~148 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=9997ec56be8bf3fb32ac246e5b654ed735ee2c52;p=emacs.git Minor cleanup for redisplay interface and few related functions. * frame.h (enum text_cursor_kinds): Move from here... * dispextern.h (enum text_cursor_kinds): ...to here. (toplevel): Drop unnecessary declarations. (struct redisplay_interface): Use bool and enum text_cursor_kinds in update_window_end_hook and draw_window_cursor functions. (display_and_set_cursor, x_update_cursor): Adjust prototypes. * nsterm.m (ns_update_window_end, ns_draw_window_cursor): * w32term.c (x_update_window_end,w32_draw_window_cursor): * xterm.c (x_update_window_end, x_draw_window_cursor): * xdisp.c (display_and_set_cursor, update_window_cursor) (update_cursor_in_window_tree, x_update_cursor): Use bool and enum text_cursor_kinds where appropriate. --- diff --git a/src/ChangeLog b/src/ChangeLog index aadaae24e98..e252e4a2f4f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,19 @@ +2013-08-23 Dmitry Antipov + + Minor cleanup for redisplay interface and few related functions. + * frame.h (enum text_cursor_kinds): Move from here... + * dispextern.h (enum text_cursor_kinds): ...to here. + (toplevel): Drop unnecessary declarations. + (struct redisplay_interface): Use bool and enum text_cursor_kinds + in update_window_end_hook and draw_window_cursor functions. + (display_and_set_cursor, x_update_cursor): Adjust prototypes. + * nsterm.m (ns_update_window_end, ns_draw_window_cursor): + * w32term.c (x_update_window_end,w32_draw_window_cursor): + * xterm.c (x_update_window_end, x_draw_window_cursor): + * xdisp.c (display_and_set_cursor, update_window_cursor) + (update_cursor_in_window_tree, x_update_cursor): Use bool and + enum text_cursor_kinds where appropriate. + 2013-08-23 Dmitry Antipov Redesign redisplay interface to drop updated_row and updated_area. diff --git a/src/dispextern.h b/src/dispextern.h index eb5b4bd195c..6e1d85de924 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -95,18 +95,17 @@ typedef int Cursor; #define NativeRectangle int #endif -/* Structure forward declarations. Some are here because function - prototypes below reference structure types before their definition - in this file. Some are here because not every file including - dispextern.h also includes frame.h and windows.h. */ - -struct glyph; -struct glyph_row; -struct glyph_matrix; -struct glyph_pool; -struct frame; -struct window; +/* Text cursor types. */ +enum text_cursor_kinds +{ + DEFAULT_CURSOR = -2, + NO_CURSOR = -1, + FILLED_BOX_CURSOR, + HOLLOW_BOX_CURSOR, + BAR_CURSOR, + HBAR_CURSOR +}; /* Values returned from coordinates_in_window. */ @@ -2739,8 +2738,8 @@ struct redisplay_interface MOUSE_FACE_OVERWRITTEN_P non-zero means that some lines in W that contained glyphs in mouse-face were overwritten, so we have to update the mouse highlight. */ - void (*update_window_end_hook) (struct window *w, int cursor_on_p, - int mouse_face_overwritten_p); + void (*update_window_end_hook) (struct window *w, bool cursor_on_p, + bool mouse_face_overwritten_p); /* Move cursor to row/column position VPOS/HPOS, pixel coordinates Y/X. HPOS/VPOS are window-relative row and column numbers and X/Y @@ -2799,10 +2798,10 @@ struct redisplay_interface 0, don't draw cursor. If ACTIVE_P is 1, system caret should track this cursor (when applicable). */ void (*draw_window_cursor) (struct window *w, - struct glyph_row *glyph_row, - int x, int y, - int cursor_type, int cursor_width, - int on_p, int active_p); + struct glyph_row *glyph_row, + int x, int y, + enum text_cursor_kinds cursor_type, + int cursor_width, bool on_p, bool active_p); /* Draw vertical border for window W from (X,Y_0) to (X,Y_1). */ void (*draw_vertical_window_border) (struct window *w, @@ -3195,13 +3194,12 @@ extern void draw_phys_cursor_glyph (struct window *, extern void get_phys_cursor_geometry (struct window *, struct glyph_row *, struct glyph *, int *, int *, int *); extern void erase_phys_cursor (struct window *); -extern void display_and_set_cursor (struct window *, - int, int, int, int, int); +extern void display_and_set_cursor (struct window *, bool, int, int, int, int); extern void set_output_cursor (struct cursor_pos *); extern void x_cursor_to (struct window *, int, int, int, int); -extern void x_update_cursor (struct frame *, int); +extern void x_update_cursor (struct frame *, bool); extern void x_clear_cursor (struct window *); extern void x_draw_vertical_border (struct window *w); diff --git a/src/frame.h b/src/frame.h index e44003b15ca..2dcb7562524 100644 --- a/src/frame.h +++ b/src/frame.h @@ -56,16 +56,6 @@ enum vertical_scroll_bar_type vertical_scroll_bar_right }; -enum text_cursor_kinds -{ - DEFAULT_CURSOR = -2, - NO_CURSOR = -1, - FILLED_BOX_CURSOR, - HOLLOW_BOX_CURSOR, - BAR_CURSOR, - HBAR_CURSOR -}; - enum fullscreen_type { FULLSCREEN_NONE, diff --git a/src/nsterm.m b/src/nsterm.m index f374bfd90c6..287c119ba73 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -742,8 +742,8 @@ ns_update_window_begin (struct window *w) static void -ns_update_window_end (struct window *w, int cursor_on_p, - int mouse_face_overwritten_p) +ns_update_window_end (struct window *w, bool cursor_on_p, + bool mouse_face_overwritten_p) /* -------------------------------------------------------------------------- Finished a grouped sequence of drawing calls external (RIF) call; for one window called before update_end @@ -2341,8 +2341,8 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row, static void ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, - int x, int y, int cursor_type, int cursor_width, - int on_p, int active_p) + int x, int y, enum text_cursor_kinds cursor_type, + int cursor_width, bool on_p, bool active_p) /* -------------------------------------------------------------------------- External call (RIF): draw cursor. Note that CURSOR_WIDTH is meaningful only for (h)bar cursors. diff --git a/src/w32term.c b/src/w32term.c index 7d51850559b..7a15323551b 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -210,7 +210,6 @@ static int volatile input_signal_count; int w32_message_fd = -1; #endif /* CYGWIN */ -static void x_update_window_end (struct window *, int, int); static void w32_handle_tool_bar_click (struct frame *, struct input_event *); static void w32_define_cursor (Window, Cursor); @@ -676,8 +675,8 @@ w32_draw_vertical_window_border (struct window *w, int x, int y0, int y1) here. */ static void -x_update_window_end (struct window *w, int cursor_on_p, - int mouse_face_overwritten_p) +x_update_window_end (struct window *w, bool cursor_on_p, + bool mouse_face_overwritten_p) { Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); @@ -5300,8 +5299,8 @@ w32_clear_frame_area (struct frame *f, int x, int y, int width, int height) static void w32_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, - int x, int y, int cursor_type, int cursor_width, - int on_p, int active_p) + int x, int y, enum text_cursor_kinds cursor_type, + int cursor_width, bool on_p, bool active_p) { if (on_p) { diff --git a/src/xdisp.c b/src/xdisp.c index a029f53305c..53fc6d85647 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -26465,7 +26465,7 @@ erase_phys_cursor (struct window *w) where to put the cursor is specified by HPOS, VPOS, X and Y. */ void -display_and_set_cursor (struct window *w, int on, +display_and_set_cursor (struct window *w, bool on, int hpos, int vpos, int x, int y) { struct frame *f = XFRAME (w->frame); @@ -26549,7 +26549,7 @@ display_and_set_cursor (struct window *w, int on, of ON. */ static void -update_window_cursor (struct window *w, int on) +update_window_cursor (struct window *w, bool on) { /* Don't update cursor in windows whose frame is in the process of being deleted. */ @@ -26585,7 +26585,7 @@ update_window_cursor (struct window *w, int on) in the window tree rooted at W. */ static void -update_cursor_in_window_tree (struct window *w, int on_p) +update_cursor_in_window_tree (struct window *w, bool on_p) { while (w) { @@ -26604,7 +26604,7 @@ update_cursor_in_window_tree (struct window *w, int on_p) Don't change the cursor's position. */ void -x_update_cursor (struct frame *f, int on_p) +x_update_cursor (struct frame *f, bool on_p) { update_cursor_in_window_tree (XWINDOW (f->root_window), on_p); } diff --git a/src/xterm.c b/src/xterm.c index b5c5a5cb584..cea952f44d2 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -292,8 +292,6 @@ static void x_set_window_size_1 (struct frame *, int, int, int); static void x_raise_frame (struct frame *); static void x_lower_frame (struct frame *); static const XColor *x_color_cells (Display *, int *); -static void x_update_window_end (struct window *, int, int); - static int x_io_error_quitter (Display *); static struct terminal *x_create_terminal (struct x_display_info *); void x_delete_terminal (struct terminal *); @@ -612,7 +610,8 @@ x_draw_vertical_window_border (struct window *w, int x, int y0, int y1) here. */ static void -x_update_window_end (struct window *w, int cursor_on_p, int mouse_face_overwritten_p) +x_update_window_end (struct window *w, bool cursor_on_p, + bool mouse_face_overwritten_p) { Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); @@ -7372,7 +7371,9 @@ x_clear_frame_area (struct frame *f, int x, int y, int width, int height) /* RIF: Draw cursor on window W. */ static void -x_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, int x, int y, int cursor_type, int cursor_width, int on_p, int active_p) +x_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, int x, + int y, enum text_cursor_kinds cursor_type, + int cursor_width, bool on_p, bool active_p) { struct frame *f = XFRAME (WINDOW_FRAME (w));