diff options
author | Nicholas Marriott <nicholas.marriott@gmail.com> | 2020-05-05 15:42:20 +0100 |
---|---|---|
committer | Nicholas Marriott <nicholas.marriott@gmail.com> | 2020-05-05 15:42:20 +0100 |
commit | 2f89d2e7d816918e152aacfee85fab45ee2057b9 (patch) | |
tree | 98f86226f36a6bf5e1a88bef8ca1d6cdb02612b8 /cmd-refresh-client.c | |
parent | deacfedc65e6de6b3f84348d6723ae6f14d097df (diff) | |
download | rtmux-2f89d2e7d816918e152aacfee85fab45ee2057b9.tar.gz rtmux-2f89d2e7d816918e152aacfee85fab45ee2057b9.tar.bz2 rtmux-2f89d2e7d816918e152aacfee85fab45ee2057b9.zip |
Change the existing client flags for control mode to apply for any client, use
the same mechanism for the read-only flag and add an ignore-size flag.
refresh-client -F has become -f (-F stays for backwards compatibility) and
attach-session and switch-client now have -f flags also. A new format
"client_flags" lists the flags and is shown by list-clients by default.
This separates the read-only flag from "ignore size" behaviour (new
ignore-size) flag - both behaviours are useful in different circumstances.
attach -r and switchc -r remain and set or toggle both flags together.
Diffstat (limited to 'cmd-refresh-client.c')
-rw-r--r-- | cmd-refresh-client.c | 25 |
1 files changed, 8 insertions, 17 deletions
diff --git a/cmd-refresh-client.c b/cmd-refresh-client.c index 5514ff73..c53a6a78 100644 --- a/cmd-refresh-client.c +++ b/cmd-refresh-client.c @@ -34,8 +34,8 @@ const struct cmd_entry cmd_refresh_client_entry = { .name = "refresh-client", .alias = "refresh", - .args = { "cC:DF:lLRSt:U", 0, 1 }, - .usage = "[-cDlLRSU] [-C XxY] [-F flags] " CMD_TARGET_CLIENT_USAGE + .args = { "cC:Df:F:lLRSt:U", 0, 1 }, + .usage = "[-cDlLRSU] [-C XxY] [-f flags] " CMD_TARGET_CLIENT_USAGE " [adjustment]", .flags = CMD_AFTERHOOK|CMD_CLIENT_TFLAG, @@ -50,7 +50,6 @@ cmd_refresh_client_exec(struct cmd *self, struct cmdq_item *item) struct tty *tty = &tc->tty; struct window *w; const char *size, *errstr; - char *copy, *next, *s; u_int x, y, adjust; if (args_has(args, 'c') || @@ -108,7 +107,12 @@ cmd_refresh_client_exec(struct cmd *self, struct cmdq_item *item) return (CMD_RETURN_NORMAL); } - if (args_has(args, 'C') || args_has(args, 'F')) { + if (args_has(args, 'F')) /* -F is an alias for -f */ + server_client_set_flags(tc, args_get(args, 'F')); + if (args_has(args, 'f')) + server_client_set_flags(tc, args_get(args, 'f')); + + if (args_has(args, 'C')) { if (args_has(args, 'C')) { if (!(tc->flags & CLIENT_CONTROL)) { cmdq_error(item, "not a control client"); @@ -129,19 +133,6 @@ cmd_refresh_client_exec(struct cmd *self, struct cmdq_item *item) tc->flags |= CLIENT_SIZECHANGED; recalculate_sizes(); } - if (args_has(args, 'F')) { - if (!(tc->flags & CLIENT_CONTROL)) { - cmdq_error(item, "not a control client"); - return (CMD_RETURN_ERROR); - } - s = copy = xstrdup(args_get(args, 'F')); - while ((next = strsep(&s, ",")) != NULL) { - /* Unknown flags are ignored. */ - if (strcmp(next, "no-output") == 0) - tc->flags |= CLIENT_CONTROL_NOOUTPUT; - } - free(copy); - } return (CMD_RETURN_NORMAL); } |