Merge branch 'obsd-master'

This commit is contained in:
Thomas Adam 2017-05-28 22:01:11 +01:00
commit 5d7dfefa36
2 changed files with 13 additions and 9 deletions

View File

@ -77,6 +77,7 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
const char *path, *cmd, *cwd, *to_free = NULL; const char *path, *cmd, *cwd, *to_free = NULL;
char **argv, *cause, *cp; char **argv, *cause, *cp;
int detached, already_attached, idx, argc; int detached, already_attached, idx, argc;
int is_control = 0;
u_int sx, sy; u_int sx, sy;
struct environ_entry *envent; struct environ_entry *envent;
struct cmd_find_state fs; struct cmd_find_state fs;
@ -139,6 +140,8 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
detached = args_has(args, 'd'); detached = args_has(args, 'd');
if (c == NULL) if (c == NULL)
detached = 1; detached = 1;
else if (c->flags & CLIENT_CONTROL)
is_control = 1;
/* Is this client already attached? */ /* Is this client already attached? */
already_attached = 0; already_attached = 0;
@ -185,29 +188,31 @@ cmd_new_session_exec(struct cmd *self, struct cmdq_item *item)
} }
/* Find new session size. */ /* Find new session size. */
if (c != NULL) { if (!detached) {
sx = c->tty.sx; sx = c->tty.sx;
sy = c->tty.sy; sy = c->tty.sy;
if (!is_control &&
sy > 0 &&
options_get_number(global_s_options, "status"))
sy--;
} else { } else {
sx = 80; sx = 80;
sy = 24; sy = 24;
} }
if (detached && args_has(args, 'x')) { if ((is_control || detached) && args_has(args, 'x')) {
sx = strtonum(args_get(args, 'x'), 1, USHRT_MAX, &errstr); sx = strtonum(args_get(args, 'x'), 1, USHRT_MAX, &errstr);
if (errstr != NULL) { if (errstr != NULL) {
cmdq_error(item, "width %s", errstr); cmdq_error(item, "width %s", errstr);
goto error; goto error;
} }
} }
if (detached && args_has(args, 'y')) { if ((is_control || detached) && args_has(args, 'y')) {
sy = strtonum(args_get(args, 'y'), 1, USHRT_MAX, &errstr); sy = strtonum(args_get(args, 'y'), 1, USHRT_MAX, &errstr);
if (errstr != NULL) { if (errstr != NULL) {
cmdq_error(item, "height %s", errstr); cmdq_error(item, "height %s", errstr);
goto error; goto error;
} }
} }
if (sy > 0 && options_get_number(global_s_options, "status"))
sy--;
if (sx == 0) if (sx == 0)
sx = 1; sx = 1;
if (sy == 0) if (sy == 0)

View File

@ -67,10 +67,9 @@ cmd_refresh_client_exec(struct cmd *self, struct cmdq_item *item)
cmdq_error(item, "not a control client"); cmdq_error(item, "not a control client");
return (CMD_RETURN_ERROR); return (CMD_RETURN_ERROR);
} }
if (tty_set_size(&c->tty, w, h)) { tty_set_size(&c->tty, w, h);
c->flags |= CLIENT_SIZECHANGED; c->flags |= CLIENT_SIZECHANGED;
recalculate_sizes(); recalculate_sizes();
}
} else if (args_has(args, 'S')) { } else if (args_has(args, 'S')) {
c->flags |= CLIENT_STATUSFORCE; c->flags |= CLIENT_STATUSFORCE;
server_status_client(c); server_status_client(c);