mirror of
https://github.com/tmux/tmux.git
synced 2025-09-02 05:21:10 +00:00
Do not hoke into struct window_pane from the tty code and instead set
everything up in tty_ctx. Provide a way to initialize the tty_ctx from a callback and use it to let popups draw directly through input_parse in the same way as panes do, rather than forcing a full redraw on every change.
This commit is contained in:
55
tmux.h
55
tmux.h
@ -55,7 +55,11 @@ struct mouse_event;
|
||||
struct options;
|
||||
struct options_array_item;
|
||||
struct options_entry;
|
||||
struct screen_write_collect_item;
|
||||
struct screen_write_collect_line;
|
||||
struct screen_write_ctx;
|
||||
struct session;
|
||||
struct tty_ctx;
|
||||
struct tmuxpeer;
|
||||
struct tmuxproc;
|
||||
struct winlink;
|
||||
@ -786,13 +790,16 @@ struct screen {
|
||||
};
|
||||
|
||||
/* Screen write context. */
|
||||
struct screen_write_collect_item;
|
||||
struct screen_write_collect_line;
|
||||
typedef void (*screen_write_init_ctx_cb)(struct screen_write_ctx *,
|
||||
struct tty_ctx *);
|
||||
struct screen_write_ctx {
|
||||
struct window_pane *wp;
|
||||
struct screen *s;
|
||||
int sync;
|
||||
|
||||
screen_write_init_ctx_cb init_ctx_cb;
|
||||
void *arg;
|
||||
|
||||
struct screen_write_collect_item *item;
|
||||
u_int scrolled;
|
||||
u_int bg;
|
||||
@ -1252,8 +1259,6 @@ struct tty {
|
||||
struct termios tio;
|
||||
|
||||
struct grid_cell cell;
|
||||
|
||||
int last_wp;
|
||||
struct grid_cell last_cell;
|
||||
|
||||
#define TTY_NOCURSOR 0x1
|
||||
@ -1285,8 +1290,14 @@ struct tty {
|
||||
};
|
||||
|
||||
/* TTY command context. */
|
||||
typedef void (*tty_ctx_redraw_cb)(const struct tty_ctx *);
|
||||
typedef int (*tty_ctx_set_client_cb)(struct tty_ctx *, struct client *);
|
||||
struct tty_ctx {
|
||||
struct window_pane *wp;
|
||||
struct screen *s;
|
||||
|
||||
tty_ctx_redraw_cb redraw_cb;
|
||||
tty_ctx_set_client_cb set_client_cb;
|
||||
void *arg;
|
||||
|
||||
const struct grid_cell *cell;
|
||||
int wrapped;
|
||||
@ -1308,12 +1319,18 @@ struct tty_ctx {
|
||||
/* Target region (usually pane) offset and size. */
|
||||
u_int xoff;
|
||||
u_int yoff;
|
||||
u_int rxoff;
|
||||
u_int ryoff;
|
||||
u_int sx;
|
||||
u_int sy;
|
||||
|
||||
/* The background colour used for clearing (erasing). */
|
||||
u_int bg;
|
||||
|
||||
/* The default colours and palette. */
|
||||
struct grid_cell defaults;
|
||||
int *palette;
|
||||
|
||||
/* Containing region (usually window) offset and size. */
|
||||
int bigger;
|
||||
u_int wox;
|
||||
@ -1492,7 +1509,7 @@ RB_HEAD(client_files, client_file);
|
||||
typedef int (*prompt_input_cb)(struct client *, void *, const char *, int);
|
||||
typedef void (*prompt_free_cb)(void *);
|
||||
typedef int (*overlay_check_cb)(struct client *, u_int, u_int);
|
||||
typedef int (*overlay_mode_cb)(struct client *, u_int *, u_int *);
|
||||
typedef struct screen *(*overlay_mode_cb)(struct client *, u_int *, u_int *);
|
||||
typedef void (*overlay_draw_cb)(struct client *, struct screen_redraw_ctx *);
|
||||
typedef int (*overlay_key_cb)(struct client *, struct key_event *);
|
||||
typedef void (*overlay_free_cb)(struct client *);
|
||||
@ -1969,7 +1986,7 @@ void tty_update_window_offset(struct window *);
|
||||
void tty_update_client_offset(struct client *);
|
||||
void tty_raw(struct tty *, const char *);
|
||||
void tty_attributes(struct tty *, const struct grid_cell *,
|
||||
struct window_pane *);
|
||||
const struct grid_cell *, int *);
|
||||
void tty_reset(struct tty *);
|
||||
void tty_region_off(struct tty *);
|
||||
void tty_margin_off(struct tty *);
|
||||
@ -1992,8 +2009,8 @@ void tty_send_requests(struct tty *);
|
||||
void tty_stop_tty(struct tty *);
|
||||
void tty_set_title(struct tty *, const char *);
|
||||
void tty_update_mode(struct tty *, int, struct screen *);
|
||||
void tty_draw_line(struct tty *, struct window_pane *, struct screen *,
|
||||
u_int, u_int, u_int, u_int, u_int);
|
||||
void tty_draw_line(struct tty *, struct screen *, u_int, u_int, u_int,
|
||||
u_int, u_int, const struct grid_cell *, int *);
|
||||
void tty_sync_start(struct tty *);
|
||||
void tty_sync_end(struct tty *);
|
||||
int tty_open(struct tty *, char **);
|
||||
@ -2024,6 +2041,7 @@ void tty_cmd_reverseindex(struct tty *, const struct tty_ctx *);
|
||||
void tty_cmd_setselection(struct tty *, const struct tty_ctx *);
|
||||
void tty_cmd_rawstring(struct tty *, const struct tty_ctx *);
|
||||
void tty_cmd_syncstart(struct tty *, const struct tty_ctx *);
|
||||
void tty_default_colours(struct grid_cell *, struct window_pane *);
|
||||
|
||||
/* tty-term.c */
|
||||
extern struct tty_terms tty_terms;
|
||||
@ -2342,8 +2360,8 @@ void input_reset(struct input_ctx *, int);
|
||||
struct evbuffer *input_pending(struct input_ctx *);
|
||||
void input_parse_pane(struct window_pane *);
|
||||
void input_parse_buffer(struct window_pane *, u_char *, size_t);
|
||||
void input_parse_screen(struct input_ctx *, struct screen *, u_char *,
|
||||
size_t);
|
||||
void input_parse_screen(struct input_ctx *, struct screen *,
|
||||
screen_write_init_ctx_cb, void *, u_char *, size_t);
|
||||
|
||||
/* input-key.c */
|
||||
int input_key_pane(struct window_pane *, key_code, struct mouse_event *);
|
||||
@ -2426,8 +2444,11 @@ char *grid_view_string_cells(struct grid *, u_int, u_int, u_int);
|
||||
/* screen-write.c */
|
||||
void screen_write_make_list(struct screen *);
|
||||
void screen_write_free_list(struct screen *);
|
||||
void screen_write_start(struct screen_write_ctx *, struct window_pane *,
|
||||
struct screen *);
|
||||
void screen_write_start_pane(struct screen_write_ctx *,
|
||||
struct window_pane *, struct screen *);
|
||||
void screen_write_start(struct screen_write_ctx *, struct screen *);
|
||||
void screen_write_start_callback(struct screen_write_ctx *, struct screen *,
|
||||
screen_write_init_ctx_cb, void *);
|
||||
void screen_write_stop(struct screen_write_ctx *);
|
||||
void screen_write_reset(struct screen_write_ctx *);
|
||||
size_t printflike(1, 2) screen_write_strlen(const char *, ...);
|
||||
@ -2481,6 +2502,10 @@ void screen_write_collect_add(struct screen_write_ctx *,
|
||||
void screen_write_cell(struct screen_write_ctx *, const struct grid_cell *);
|
||||
void screen_write_setselection(struct screen_write_ctx *, u_char *, u_int);
|
||||
void screen_write_rawstring(struct screen_write_ctx *, u_char *, u_int);
|
||||
void screen_write_alternateon(struct screen_write_ctx *,
|
||||
struct grid_cell *, int);
|
||||
void screen_write_alternateoff(struct screen_write_ctx *,
|
||||
struct grid_cell *, int);
|
||||
|
||||
/* screen-redraw.c */
|
||||
void screen_redraw_screen(struct client *);
|
||||
@ -2569,10 +2594,6 @@ struct window_pane *window_pane_find_by_id_str(const char *);
|
||||
struct window_pane *window_pane_find_by_id(u_int);
|
||||
int window_pane_destroy_ready(struct window_pane *);
|
||||
void window_pane_resize(struct window_pane *, u_int, u_int);
|
||||
void window_pane_alternate_on(struct window_pane *,
|
||||
struct grid_cell *, int);
|
||||
void window_pane_alternate_off(struct window_pane *,
|
||||
struct grid_cell *, int);
|
||||
void window_pane_set_palette(struct window_pane *, u_int, int);
|
||||
void window_pane_unset_palette(struct window_pane *, u_int);
|
||||
void window_pane_reset_palette(struct window_pane *);
|
||||
|
Reference in New Issue
Block a user