diff options
author | Tiago Cunha <tcunha@gmx.com> | 2009-10-11 23:38:16 +0000 |
---|---|---|
committer | Tiago Cunha <tcunha@gmx.com> | 2009-10-11 23:38:16 +0000 |
commit | 6a1ebb11df452e570b430ba16192c38b0e3a0f90 (patch) | |
tree | f2165e41abebbb503f4f8feba689468128a96cf7 /cmd-unlink-window.c | |
parent | 1fd3a405e69c7478ab29d29cd56ac5b23f2f4f71 (diff) | |
download | rtmux-6a1ebb11df452e570b430ba16192c38b0e3a0f90.tar.gz rtmux-6a1ebb11df452e570b430ba16192c38b0e3a0f90.tar.bz2 rtmux-6a1ebb11df452e570b430ba16192c38b0e3a0f90.zip |
Sync OpenBSD patchset 371:
Add "grouped sessions" which have independent name, options, current window and
so on but where the linked windows are synchronized (ie creating, killing
windows and so on are mirrored between the sessions). A grouped session may be
created by passing -t to new-session.
Had this around for a while, tested by a couple of people.
Diffstat (limited to 'cmd-unlink-window.c')
-rw-r--r-- | cmd-unlink-window.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/cmd-unlink-window.c b/cmd-unlink-window.c index dea0a058..936a7e4f 100644 --- a/cmd-unlink-window.c +++ b/cmd-unlink-window.c @@ -1,4 +1,4 @@ -/* $Id: cmd-unlink-window.c,v 1.18 2009-09-20 22:17:03 tcunha Exp $ */ +/* $Id: cmd-unlink-window.c,v 1.19 2009-10-11 23:38:16 tcunha Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -42,16 +42,28 @@ cmd_unlink_window_exec(struct cmd *self, struct cmd_ctx *ctx) { struct cmd_target_data *data = self->data; struct winlink *wl; - struct session *s; + struct window *w; + struct session *s, *s2; + struct session_group *sg; + u_int references; if ((wl = cmd_find_window(ctx, data->target, &s)) == NULL) return (-1); + w = wl->window; - if (!(data->chflags & CMD_CHFLAG('k')) && wl->window->references == 1) { + sg = session_group_find(s); + if (sg != NULL) { + references = 0; + TAILQ_FOREACH(s2, &sg->sessions, gentry) + references++; + } else + references = 1; + + if (!(data->chflags & CMD_CHFLAG('k')) && w->references == references) { ctx->error(ctx, "window is only linked to one session"); return (-1); } - + server_unlink_window(s, wl); recalculate_sizes(); |