Commit 9997ec56 authored by Dmitry Antipov's avatar 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.
parent 7f780da6
2013-08-23 Dmitry Antipov <dmantipov@yandex.ru>
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 <dmantipov@yandex.ru> 2013-08-23 Dmitry Antipov <dmantipov@yandex.ru>
Redesign redisplay interface to drop updated_row and updated_area. Redesign redisplay interface to drop updated_row and updated_area.
......
...@@ -95,18 +95,17 @@ typedef int Cursor; ...@@ -95,18 +95,17 @@ typedef int Cursor;
#define NativeRectangle int #define NativeRectangle int
#endif #endif
/* Structure forward declarations. Some are here because function /* Text cursor types. */
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;
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. */ /* Values returned from coordinates_in_window. */
...@@ -2739,8 +2738,8 @@ struct redisplay_interface ...@@ -2739,8 +2738,8 @@ struct redisplay_interface
MOUSE_FACE_OVERWRITTEN_P non-zero means that some lines in W MOUSE_FACE_OVERWRITTEN_P non-zero means that some lines in W
that contained glyphs in mouse-face were overwritten, so we that contained glyphs in mouse-face were overwritten, so we
have to update the mouse highlight. */ have to update the mouse highlight. */
void (*update_window_end_hook) (struct window *w, int cursor_on_p, void (*update_window_end_hook) (struct window *w, bool cursor_on_p,
int mouse_face_overwritten_p); bool mouse_face_overwritten_p);
/* Move cursor to row/column position VPOS/HPOS, pixel coordinates /* Move cursor to row/column position VPOS/HPOS, pixel coordinates
Y/X. HPOS/VPOS are window-relative row and column numbers and X/Y Y/X. HPOS/VPOS are window-relative row and column numbers and X/Y
...@@ -2799,10 +2798,10 @@ struct redisplay_interface ...@@ -2799,10 +2798,10 @@ struct redisplay_interface
0, don't draw cursor. If ACTIVE_P is 1, system caret 0, don't draw cursor. If ACTIVE_P is 1, system caret
should track this cursor (when applicable). */ should track this cursor (when applicable). */
void (*draw_window_cursor) (struct window *w, void (*draw_window_cursor) (struct window *w,
struct glyph_row *glyph_row, struct glyph_row *glyph_row,
int x, int y, int x, int y,
int cursor_type, int cursor_width, enum text_cursor_kinds cursor_type,
int on_p, int active_p); int cursor_width, bool on_p, bool active_p);
/* Draw vertical border for window W from (X,Y_0) to (X,Y_1). */ /* Draw vertical border for window W from (X,Y_0) to (X,Y_1). */
void (*draw_vertical_window_border) (struct window *w, void (*draw_vertical_window_border) (struct window *w,
...@@ -3195,13 +3194,12 @@ extern void draw_phys_cursor_glyph (struct window *, ...@@ -3195,13 +3194,12 @@ extern void draw_phys_cursor_glyph (struct window *,
extern void get_phys_cursor_geometry (struct window *, struct glyph_row *, extern void get_phys_cursor_geometry (struct window *, struct glyph_row *,
struct glyph *, int *, int *, int *); struct glyph *, int *, int *, int *);
extern void erase_phys_cursor (struct window *); extern void erase_phys_cursor (struct window *);
extern void display_and_set_cursor (struct window *, extern void display_and_set_cursor (struct window *, bool, int, int, int, int);
int, int, int, int, int);
extern void set_output_cursor (struct cursor_pos *); extern void set_output_cursor (struct cursor_pos *);
extern void x_cursor_to (struct window *, int, int, int, int); 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_clear_cursor (struct window *);
extern void x_draw_vertical_border (struct window *w); extern void x_draw_vertical_border (struct window *w);
......
...@@ -56,16 +56,6 @@ enum vertical_scroll_bar_type ...@@ -56,16 +56,6 @@ enum vertical_scroll_bar_type
vertical_scroll_bar_right 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 enum fullscreen_type
{ {
FULLSCREEN_NONE, FULLSCREEN_NONE,
......
...@@ -742,8 +742,8 @@ Free a pool and temporary objects it refers to (callable from C) ...@@ -742,8 +742,8 @@ Free a pool and temporary objects it refers to (callable from C)
static void static void
ns_update_window_end (struct window *w, int cursor_on_p, ns_update_window_end (struct window *w, bool cursor_on_p,
int mouse_face_overwritten_p) bool mouse_face_overwritten_p)
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
Finished a grouped sequence of drawing calls Finished a grouped sequence of drawing calls
external (RIF) call; for one window called before update_end external (RIF) call; for one window called before update_end
...@@ -2341,8 +2341,8 @@ Free a pool and temporary objects it refers to (callable from C) ...@@ -2341,8 +2341,8 @@ Free a pool and temporary objects it refers to (callable from C)
static void static void
ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row,
int x, int y, int cursor_type, int cursor_width, int x, int y, enum text_cursor_kinds cursor_type,
int on_p, int active_p) int cursor_width, bool on_p, bool active_p)
/* -------------------------------------------------------------------------- /* --------------------------------------------------------------------------
External call (RIF): draw cursor. External call (RIF): draw cursor.
Note that CURSOR_WIDTH is meaningful only for (h)bar cursors. Note that CURSOR_WIDTH is meaningful only for (h)bar cursors.
......
...@@ -210,7 +210,6 @@ static int volatile input_signal_count; ...@@ -210,7 +210,6 @@ static int volatile input_signal_count;
int w32_message_fd = -1; int w32_message_fd = -1;
#endif /* CYGWIN */ #endif /* CYGWIN */
static void x_update_window_end (struct window *, int, int);
static void w32_handle_tool_bar_click (struct frame *, static void w32_handle_tool_bar_click (struct frame *,
struct input_event *); struct input_event *);
static void w32_define_cursor (Window, Cursor); 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) ...@@ -676,8 +675,8 @@ w32_draw_vertical_window_border (struct window *w, int x, int y0, int y1)
here. */ here. */
static void static void
x_update_window_end (struct window *w, int cursor_on_p, x_update_window_end (struct window *w, bool cursor_on_p,
int mouse_face_overwritten_p) bool mouse_face_overwritten_p)
{ {
Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); 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) ...@@ -5300,8 +5299,8 @@ w32_clear_frame_area (struct frame *f, int x, int y, int width, int height)
static void static void
w32_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, w32_draw_window_cursor (struct window *w, struct glyph_row *glyph_row,
int x, int y, int cursor_type, int cursor_width, int x, int y, enum text_cursor_kinds cursor_type,
int on_p, int active_p) int cursor_width, bool on_p, bool active_p)
{ {
if (on_p) if (on_p)
{ {
......
...@@ -26465,7 +26465,7 @@ erase_phys_cursor (struct window *w) ...@@ -26465,7 +26465,7 @@ erase_phys_cursor (struct window *w)
where to put the cursor is specified by HPOS, VPOS, X and Y. */ where to put the cursor is specified by HPOS, VPOS, X and Y. */
void 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) int hpos, int vpos, int x, int y)
{ {
struct frame *f = XFRAME (w->frame); struct frame *f = XFRAME (w->frame);
...@@ -26549,7 +26549,7 @@ display_and_set_cursor (struct window *w, int on, ...@@ -26549,7 +26549,7 @@ display_and_set_cursor (struct window *w, int on,
of ON. */ of ON. */
static void 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 /* Don't update cursor in windows whose frame is in the process
of being deleted. */ of being deleted. */
...@@ -26585,7 +26585,7 @@ update_window_cursor (struct window *w, int on) ...@@ -26585,7 +26585,7 @@ update_window_cursor (struct window *w, int on)
in the window tree rooted at W. */ in the window tree rooted at W. */
static void 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) while (w)
{ {
...@@ -26604,7 +26604,7 @@ update_cursor_in_window_tree (struct window *w, int on_p) ...@@ -26604,7 +26604,7 @@ update_cursor_in_window_tree (struct window *w, int on_p)
Don't change the cursor's position. */ Don't change the cursor's position. */
void 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); update_cursor_in_window_tree (XWINDOW (f->root_window), on_p);
} }
......
...@@ -292,8 +292,6 @@ static void x_set_window_size_1 (struct frame *, int, int, int); ...@@ -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_raise_frame (struct frame *);
static void x_lower_frame (struct frame *); static void x_lower_frame (struct frame *);
static const XColor *x_color_cells (Display *, int *); 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 int x_io_error_quitter (Display *);
static struct terminal *x_create_terminal (struct x_display_info *); static struct terminal *x_create_terminal (struct x_display_info *);
void x_delete_terminal (struct terminal *); void x_delete_terminal (struct terminal *);
...@@ -612,7 +610,8 @@ x_draw_vertical_window_border (struct window *w, int x, int y0, int y1) ...@@ -612,7 +610,8 @@ x_draw_vertical_window_border (struct window *w, int x, int y0, int y1)
here. */ here. */
static void 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)); 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) ...@@ -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. */ /* RIF: Draw cursor on window W. */
static void 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)); struct frame *f = XFRAME (WINDOW_FRAME (w));
......
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