version 1.28, 2018/10/18 08:38:01 |
version 1.29, 2019/07/10 11:20:10 |
|
|
#include <sys/types.h> |
#include <sys/types.h> |
|
|
#include <stdlib.h> |
#include <stdlib.h> |
|
#include <string.h> |
|
|
#include "tmux.h" |
#include "tmux.h" |
|
|
|
|
.name = "refresh-client", |
.name = "refresh-client", |
.alias = "refresh", |
.alias = "refresh", |
|
|
.args = { "cC:DlLRSt:U", 0, 1 }, |
.args = { "cC:DF:lLRSt:U", 0, 1 }, |
.usage = "[-cDlLRSU] [-C size] " CMD_TARGET_CLIENT_USAGE " [adjustment]", |
.usage = "[-cDlLRSU] [-C XxY] [-F flags] " CMD_TARGET_CLIENT_USAGE |
|
" [adjustment]", |
|
|
.flags = CMD_AFTERHOOK, |
.flags = CMD_AFTERHOOK, |
.exec = cmd_refresh_client_exec |
.exec = cmd_refresh_client_exec |
|
|
struct tty *tty; |
struct tty *tty; |
struct window *w; |
struct window *w; |
const char *size, *errstr; |
const char *size, *errstr; |
|
char *copy, *next, *s; |
u_int x, y, adjust; |
u_int x, y, adjust; |
|
|
if ((c = cmd_find_client(item, args_get(args, 't'), 0)) == NULL) |
if ((c = cmd_find_client(item, args_get(args, 't'), 0)) == NULL) |
|
|
if (args_has(args, 'l')) { |
if (args_has(args, 'l')) { |
if (c->session != NULL) |
if (c->session != NULL) |
tty_putcode_ptr2(&c->tty, TTYC_MS, "", "?"); |
tty_putcode_ptr2(&c->tty, TTYC_MS, "", "?"); |
} else if (args_has(args, 'C')) { |
return (CMD_RETURN_NORMAL); |
if ((size = args_get(args, 'C')) == NULL) { |
} |
cmdq_error(item, "missing size"); |
|
return (CMD_RETURN_ERROR); |
if (args_has(args, 'C') || args_has(args, 'F')) { |
|
if (args_has(args, 'C')) { |
|
if (!(c->flags & CLIENT_CONTROL)) { |
|
cmdq_error(item, "not a control client"); |
|
return (CMD_RETURN_ERROR); |
|
} |
|
size = args_get(args, 'C'); |
|
if (sscanf(size, "%u,%u", &x, &y) != 2 && |
|
sscanf(size, "%ux%u", &x, &y) != 2) { |
|
cmdq_error(item, "bad size argument"); |
|
return (CMD_RETURN_ERROR); |
|
} |
|
if (x < WINDOW_MINIMUM || x > WINDOW_MAXIMUM || |
|
y < WINDOW_MINIMUM || y > WINDOW_MAXIMUM) { |
|
cmdq_error(item, "size too small or too big"); |
|
return (CMD_RETURN_ERROR); |
|
} |
|
tty_set_size(&c->tty, x, y); |
|
c->flags |= CLIENT_SIZECHANGED; |
|
recalculate_sizes(); |
} |
} |
if (sscanf(size, "%u,%u", &x, &y) != 2 && |
if (args_has(args, 'F')) { |
sscanf(size, "%ux%u", &x, &y)) { |
if (!(c->flags & CLIENT_CONTROL)) { |
cmdq_error(item, "bad size argument"); |
cmdq_error(item, "not a control client"); |
return (CMD_RETURN_ERROR); |
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) |
|
c->flags |= CLIENT_CONTROL_NOOUTPUT; |
|
} |
|
free(copy); |
} |
} |
if (x < WINDOW_MINIMUM || x > WINDOW_MAXIMUM || |
|
y < WINDOW_MINIMUM || y > WINDOW_MAXIMUM) { |
|
cmdq_error(item, "size too small or too big"); |
|
return (CMD_RETURN_ERROR); |
|
} |
|
if (!(c->flags & CLIENT_CONTROL)) { |
|
cmdq_error(item, "not a control client"); |
|
return (CMD_RETURN_ERROR); |
|
} |
|
tty_set_size(&c->tty, x, y); |
|
c->flags |= CLIENT_SIZECHANGED; |
|
recalculate_sizes(); |
|
return (CMD_RETURN_NORMAL); |
return (CMD_RETURN_NORMAL); |
} |
} |
|
|