From 4d382ae8e6c71c5414dc41053223c05400d923f8 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sun, 10 Feb 2013 17:32:58 +0000 Subject: Miscellaneous tidying of choose API, including: - rename client and session to start_client and start_session in window_choose_data struct. also add TREE_OTHER define and reorder the struct - rename window_choose_ctx to window_choose_data_run - don't pass a cmd_ctx into window_choose_create (will let it use a different client later). instead take type, session, client - add window_choose_data_free and use it to dispose of wcd rather than each cmd-*.c doing it individually - change so ref counting is done by wcd_add and wcd_free rather than callers. this means 1 ref for each item but what of it :-) - also add a ref to tree_session - not sure if this is needed? - all the callbacks except choose-client and find-window are the same so remove them and add window_choose_default_callback - reorder/rename some other bits and pieces for tidyness --- tmux.h | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'tmux.h') diff --git a/tmux.h b/tmux.h index 1dd11ade..96199d59 100644 --- a/tmux.h +++ b/tmux.h @@ -879,18 +879,24 @@ struct window_mode { /* Structures for choose mode. */ struct window_choose_data { - struct client *client; - struct session *session; /* Session of current client. */ - struct session *tree_session; /* Session of items in tree. */ - struct format_tree *ft; - struct winlink *wl; - char *ft_template; - char *command; + struct client *start_client; + struct session *start_session; + u_int idx; int type; +#define TREE_OTHER 0x0 #define TREE_WINDOW 0x1 #define TREE_SESSION 0x2 + + struct session *tree_session; /* session of items in tree */ + + struct winlink *wl; int pane_id; + + char *ft_template; + struct format_tree *ft; + + char *command; }; struct window_choose_mode_item { @@ -2194,8 +2200,10 @@ void window_choose_add(struct window_pane *, void window_choose_ready(struct window_pane *, u_int, void (*)(struct window_choose_data *), void (*)(struct window_choose_data *)); -struct window_choose_data *window_choose_data_create(struct cmd_ctx *); -void window_choose_ctx(struct window_choose_data *); +struct window_choose_data *window_choose_data_create (int, + struct client *, struct session *); +void window_choose_data_free(struct window_choose_data *); +void window_choose_data_run(struct window_choose_data *); struct window_choose_data *window_choose_add_window(struct window_pane *, struct cmd_ctx *, struct session *, struct winlink *, const char *, char *, u_int); -- cgit