version 1.2, 2009/07/13 23:11:35 |
version 1.3, 2009/07/15 08:00:49 |
|
|
{ |
{ |
struct cmd_target_data *data = self->data; |
struct cmd_target_data *data = self->data; |
struct winlink *wl; |
struct winlink *wl; |
|
struct window *w; |
struct session *s; |
struct session *s; |
struct client *c; |
struct client *c; |
u_int i; |
u_int i, j; |
int destroyed; |
int destroyed; |
|
|
if ((wl = cmd_find_window(ctx, data->target, &s)) == NULL) |
if ((wl = cmd_find_window(ctx, data->target, NULL)) == NULL) |
return (-1); |
return (-1); |
|
w = wl->window; |
|
|
destroyed = session_detach(s, wl); |
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) { |
for (i = 0; i < ARRAY_LENGTH(&clients); i++) { |
s = ARRAY_ITEM(&sessions, i); |
c = ARRAY_ITEM(&clients, i); |
if (s == NULL || !session_has(s, w)) |
if (c == NULL || c->session != s) |
|
continue; |
continue; |
if (destroyed) { |
if ((wl = winlink_find_by_window(&s->windows, w)) == NULL) |
c->session = NULL; |
continue; |
server_write_client(c, MSG_EXIT, NULL, 0); |
|
} else |
destroyed = session_detach(s, wl); |
server_redraw_client(c); |
for (j = 0; j < ARRAY_LENGTH(&clients); j++) { |
|
c = ARRAY_ITEM(&clients, j); |
|
if (c == NULL || c->session != s) |
|
continue; |
|
|
|
if (destroyed) { |
|
c->session = NULL; |
|
server_write_client(c, MSG_EXIT, NULL, 0); |
|
} else |
|
server_redraw_client(c); |
|
} |
} |
} |
recalculate_sizes(); |
recalculate_sizes(); |
|
|