diff options
author | Thomas Adam <thomas@xteddy.org> | 2015-10-22 14:01:12 +0100 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2015-10-22 14:01:12 +0100 |
commit | 8c3981366574f5c6496985e0127ca817f3d70037 (patch) | |
tree | 98ebbee2088ac29bc7e1cf8d26699b02c1c2da42 | |
parent | 6bc3902f5d1188ea457907373011b7dd912e389c (diff) | |
parent | 3ebcf25149d75977ea97e9d4f786e0508d1a0d5e (diff) | |
download | rtmux-8c3981366574f5c6496985e0127ca817f3d70037.tar.gz rtmux-8c3981366574f5c6496985e0127ca817f3d70037.tar.bz2 rtmux-8c3981366574f5c6496985e0127ca817f3d70037.zip |
Merge branch 'obsd-master'
-rw-r--r-- | cmd-find.c | 33 | ||||
-rw-r--r-- | cmd-select-pane.c | 13 | ||||
-rw-r--r-- | server-client.c | 7 | ||||
-rw-r--r-- | server.c | 2 |
4 files changed, 39 insertions, 16 deletions
@@ -254,24 +254,35 @@ cmd_find_current_session_with_client(struct cmd_find_state *fs) wp = NULL; /* Not running in a pane. We know nothing. Find the best session. */ - if (wp == NULL) { - fs->s = cmd_find_best_session(NULL, 0, fs->flags); - if (fs->s == NULL) - return (-1); - fs->wl = fs->s->curw; - fs->idx = fs->wl->idx; - fs->w = fs->wl->window; - fs->wp = fs->w->active; - return (0); - } + if (wp == NULL) + goto unknown_pane; /* We now know the window and pane. */ fs->w = wp->window; fs->wp = wp; /* Find the best session and winlink. */ - if (cmd_find_best_session_with_window(fs) != 0) + if (cmd_find_best_session_with_window(fs) != 0) { + if (wp != NULL) { + /* + * The window may have been destroyed but the pane + * still on all_window_panes due to something else + * holding a reference. + */ + goto unknown_pane; + } return (-1); + } + return (0); + +unknown_pane: + fs->s = cmd_find_best_session(NULL, 0, fs->flags); + if (fs->s == NULL) + return (-1); + fs->wl = fs->s->curw; + fs->idx = fs->wl->idx; + fs->w = fs->wl->window; + fs->wp = fs->w->active; return (0); } diff --git a/cmd-select-pane.c b/cmd-select-pane.c index e76587cc..7986e98c 100644 --- a/cmd-select-pane.c +++ b/cmd-select-pane.c @@ -120,14 +120,19 @@ cmd_select_pane_exec(struct cmd *self, struct cmd_q *cmdq) return (CMD_RETURN_NORMAL); } - if (args_has(self->args, 'L')) + if (args_has(self->args, 'L')) { + server_unzoom_window(wp->window); wp = window_pane_find_left(wp); - else if (args_has(self->args, 'R')) + } else if (args_has(self->args, 'R')) { + server_unzoom_window(wp->window); wp = window_pane_find_right(wp); - else if (args_has(self->args, 'U')) + } else if (args_has(self->args, 'U')) { + server_unzoom_window(wp->window); wp = window_pane_find_up(wp); - else if (args_has(self->args, 'D')) + } else if (args_has(self->args, 'D')) { + server_unzoom_window(wp->window); wp = window_pane_find_down(wp); + } if (wp == NULL) return (CMD_RETURN_NORMAL); diff --git a/server-client.c b/server-client.c index 92816041..960c5630 100644 --- a/server-client.c +++ b/server-client.c @@ -1164,38 +1164,45 @@ server_client_msg_identify(struct client *c, struct imsg *imsg) fatalx("bad MSG_IDENTIFY_FLAGS size"); memcpy(&flags, data, sizeof flags); c->flags |= flags; + log_debug("client %p IDENTIFY_FLAGS %#x", c, flags); break; case MSG_IDENTIFY_TERM: if (datalen == 0 || data[datalen - 1] != '\0') fatalx("bad MSG_IDENTIFY_TERM string"); c->term = xstrdup(data); + log_debug("client %p IDENTIFY_TERM %s", c, data); break; case MSG_IDENTIFY_TTYNAME: if (datalen == 0 || data[datalen - 1] != '\0') fatalx("bad MSG_IDENTIFY_TTYNAME string"); c->ttyname = xstrdup(data); + log_debug("client %p IDENTIFY_TTYNAME %s", c, data); break; case MSG_IDENTIFY_CWD: if (datalen == 0 || data[datalen - 1] != '\0') fatalx("bad MSG_IDENTIFY_CWD string"); if ((c->cwd = open(data, O_RDONLY)) == -1) c->cwd = open("/", O_RDONLY); + log_debug("client %p IDENTIFY_CWD %s", c, data); break; case MSG_IDENTIFY_STDIN: if (datalen != 0) fatalx("bad MSG_IDENTIFY_STDIN size"); c->fd = imsg->fd; + log_debug("client %p IDENTIFY_STDIN %d", c, imsg->fd); break; case MSG_IDENTIFY_ENVIRON: if (datalen == 0 || data[datalen - 1] != '\0') fatalx("bad MSG_IDENTIFY_ENVIRON string"); if (strchr(data, '=') != NULL) environ_put(&c->environ, data); + log_debug("client %p IDENTIFY_ENVIRON %s", c, data); break; case MSG_IDENTIFY_CLIENTPID: if (datalen != sizeof c->pid) fatalx("bad MSG_IDENTIFY_CLIENTPID size"); memcpy(&c->pid, data, sizeof c->pid); + log_debug("client %p IDENTIFY_CLIENTPID %ld", c, (long)c->pid); break; default: break; @@ -282,7 +282,7 @@ server_send_exit(void) if (c->flags & (CLIENT_BAD|CLIENT_SUSPENDED)) server_client_lost(c); else - server_write_client(c, MSG_EXIT, NULL, 0); + server_write_client(c, MSG_SHUTDOWN, NULL, 0); c->session = NULL; } |