From c5504af4a685707389888db475fb7451ff5d8d86 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Thu, 21 Mar 2013 18:47:01 +0000 Subject: Add various checks to turn off bits that can't work in control mode (such as lock). --- server-fn.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'server-fn.c') diff --git a/server-fn.c b/server-fn.c index c22095dc..69857263 100644 --- a/server-fn.c +++ b/server-fn.c @@ -239,6 +239,9 @@ server_lock_client(struct client *c) size_t cmdlen; struct msg_lock_data lockdata; + if (!(c->flags & CLIENT_CONTROL)) + return; + if (c->flags & CLIENT_SUSPENDED) return; -- cgit From 8d59b189cc9e83ac0049fc3108de1b822fa7b4ce Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Fri, 22 Mar 2013 10:31:22 +0000 Subject: No more lint means no more ARGSUSED. --- server-fn.c | 1 - 1 file changed, 1 deletion(-) (limited to 'server-fn.c') diff --git a/server-fn.c b/server-fn.c index 69857263..fe5ed431 100644 --- a/server-fn.c +++ b/server-fn.c @@ -494,7 +494,6 @@ server_clear_identify(struct client *c) } } -/* ARGSUSED */ void server_callback_identify(unused int fd, unused short events, void *data) { -- cgit From 29613f2f31117ed898455fdf75dd7b69d18129f3 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Fri, 22 Mar 2013 10:42:55 +0000 Subject: Prevent lock on control clients, not on others. --- server-fn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'server-fn.c') diff --git a/server-fn.c b/server-fn.c index fe5ed431..6d66a9f0 100644 --- a/server-fn.c +++ b/server-fn.c @@ -239,7 +239,7 @@ server_lock_client(struct client *c) size_t cmdlen; struct msg_lock_data lockdata; - if (!(c->flags & CLIENT_CONTROL)) + if (c->flags & CLIENT_CONTROL) return; if (c->flags & CLIENT_SUSPENDED) -- cgit From 20636d956dd36c1f14152569a4d44a50eea9083d Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sun, 24 Mar 2013 09:54:10 +0000 Subject: Add a command queue to standardize and simplify commands that call other commands and allow a command to block execution of subsequent commands. This allows run-shell and if-shell to be synchronous which has been much requested. Each client has a default command queue and commands are consumed one at a time from it. A command may suspend execution from the queue by returning CMD_RETURN_WAIT and then resume it by calling cmd_continue() - for example run-shell does this from the callback that is fired after the job is freed. When the command queue becomes empty, command clients are automatically exited (unless attaching). A callback is also fired - this is used for nested commands in, for example, if-shell which can block execution of the client's cmdq until a new cmdq becomes empty. Also merge all the old error/info/print functions together and lose the old curclient/cmdclient distinction - a cmdq is bound to one client (or none if in the configuration file), this is a command client if c->session is NULL otherwise an attached client. --- server-fn.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'server-fn.c') diff --git a/server-fn.c b/server-fn.c index 6d66a9f0..b9217ef2 100644 --- a/server-fn.c +++ b/server-fn.c @@ -194,7 +194,7 @@ server_status_window(struct window *w) /* * This is slightly different. We want to redraw the status line of any - * clients containing this window rather than any where it is the + * clients containing this window rather than anywhere it is the * current window. */ @@ -563,7 +563,7 @@ int server_set_stdin_callback(struct client *c, void (*cb)(struct client *, int, void *), void *cb_data, char **cause) { - if (c == NULL) { + if (c == NULL || c->session != NULL) { *cause = xstrdup("no client with stdin"); return (-1); } -- cgit From c71844de631186f3df7ff5a6e3aab613da1e4853 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Sun, 24 Mar 2013 09:57:59 +0000 Subject: Add resize-pane -Z to temporary zoom the active pane to occupy the full window or unzoom (restored to the normal layout) if it already zoomed, bound to C-b z by default. The pane is unzoomed on pretty much any excuse whatsoever. We considered making this a new layout but the requirements are quite different from layouts so decided it is better as a special case. Each current layout cell is saved, a temporary one-cell layout generated and all except the active pane set to NULL. Prompted by suggestions and scripts from several. Thanks to Aaron Jensen and Thiago Padilha for testing an earlier version. --- server-fn.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'server-fn.c') diff --git a/server-fn.c b/server-fn.c index b9217ef2..874afffb 100644 --- a/server-fn.c +++ b/server-fn.c @@ -377,6 +377,7 @@ server_destroy_pane(struct window_pane *wp) return; } + server_unzoom_window(w); layout_close_pane(wp); window_remove_pane(w, wp); @@ -588,3 +589,11 @@ server_set_stdin_callback(struct client *c, void (*cb)(struct client *, int, return (0); } + +void +server_unzoom_window(struct window *w) +{ + window_unzoom(w); + server_redraw_window(w); + server_status_window(w); +} -- cgit From 6fee3e9e4b4c68c5d3d7f333c779ac865af7bf86 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 25 Mar 2013 10:11:45 +0000 Subject: Rename session idx to session id throughout and add $ prefix to targets to use it, extended from a diff from George Nachman. --- server-fn.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'server-fn.c') diff --git a/server-fn.c b/server-fn.c index 874afffb..f0c2dd23 100644 --- a/server-fn.c +++ b/server-fn.c @@ -39,7 +39,7 @@ server_fill_environ(struct session *s, struct environ *env) term = options_get_string(&s->options, "default-terminal"); environ_set(env, "TERM", term); - idx = s->idx; + idx = s->id; } else idx = -1; pid = getpid(); -- cgit From e4c0730bf1e13ac256a58db7ee7a58c36c8980f4 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 25 Mar 2013 11:36:59 +0000 Subject: Use single stdout and stderr for control clients. --- server-fn.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'server-fn.c') diff --git a/server-fn.c b/server-fn.c index f0c2dd23..c0b005e8 100644 --- a/server-fn.c +++ b/server-fn.c @@ -546,6 +546,10 @@ server_push_stderr(struct client *c) struct msg_stderr_data data; size_t size; + if (c->stderr_data == c->stdout_data) { + server_push_stdout(c); + return; + } size = EVBUFFER_LENGTH(c->stderr_data); if (size == 0) return; -- cgit