diff options
author | 2012-03-17 22:35:09 +0000 | |
---|---|---|
committer | 2012-03-17 22:35:09 +0000 | |
commit | 05babb28bdab76474014f30d0f89f1d606eb785c (patch) | |
tree | c6497a91a4cc05fb670d065a8ae077d08b04dfae /usr.bin/tmux/session.c | |
parent | $Id$ -> $OpenBSD$. (diff) | |
download | wireguard-openbsd-05babb28bdab76474014f30d0f89f1d606eb785c.tar.xz wireguard-openbsd-05babb28bdab76474014f30d0f89f1d606eb785c.zip |
Add notify hooks for various events, the functions are currently empty
stubs but will be filled in for control mode later. From George Nachman.
Diffstat (limited to 'usr.bin/tmux/session.c')
-rw-r--r-- | usr.bin/tmux/session.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/usr.bin/tmux/session.c b/usr.bin/tmux/session.c index 69956ad50bd..2476a9ae249 100644 --- a/usr.bin/tmux/session.c +++ b/usr.bin/tmux/session.c @@ -1,4 +1,4 @@ -/* $OpenBSD: session.c,v 1.32 2011/08/16 09:36:23 nicm Exp $ */ +/* $OpenBSD: session.c,v 1.33 2012/03/17 22:35:09 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -142,6 +142,7 @@ session_create(const char *name, const char *cmd, const char *cwd, } log_debug("session %s created", s->name); + notify_session_created(s); return (s); } @@ -150,9 +151,11 @@ session_create(const char *name, const char *cmd, const char *cwd, void session_destroy(struct session *s) { + struct winlink *wl; log_debug("session %s destroyed", s->name); RB_REMOVE(sessions, &sessions, s); + notify_session_closed(s); if (s->tio != NULL) xfree(s->tio); @@ -163,8 +166,11 @@ session_destroy(struct session *s) while (!TAILQ_EMPTY(&s->lastw)) winlink_stack_remove(&s->lastw, TAILQ_FIRST(&s->lastw)); - while (!RB_EMPTY(&s->windows)) - winlink_remove(&s->windows, RB_ROOT(&s->windows)); + while (!RB_EMPTY(&s->windows)) { + wl = RB_ROOT(&s->windows); + notify_window_unlinked(s, wl->window); + winlink_remove(&s->windows, wl); + } xfree(s->cwd); @@ -254,6 +260,7 @@ session_new(struct session *s, return (NULL); } winlink_set_window(wl, w); + notify_window_linked(s, w); environ_free(&env); if (options_get_number(&s->options, "set-remain-on-exit")) @@ -274,6 +281,7 @@ session_attach(struct session *s, struct window *w, int idx, char **cause) return (NULL); } winlink_set_window(wl, w); + notify_window_linked(s, w); session_group_synchronize_from(s); return (wl); @@ -288,6 +296,7 @@ session_detach(struct session *s, struct winlink *wl) session_next(s, 0); wl->flags &= ~WINLINK_ALERTFLAGS; + notify_window_unlinked(s, wl->window); winlink_stack_remove(&s->lastw, wl); winlink_remove(&s->windows, wl); session_group_synchronize_from(s); @@ -555,6 +564,7 @@ session_group_synchronize1(struct session *target, struct session *s) RB_FOREACH(wl, winlinks, ww) { wl2 = winlink_add(&s->windows, wl->idx); winlink_set_window(wl2, wl->window); + notify_window_linked(s, wl2->window); wl2->flags |= wl->flags & WINLINK_ALERTFLAGS; } @@ -576,6 +586,8 @@ session_group_synchronize1(struct session *target, struct session *s) /* Then free the old winlinks list. */ while (!RB_EMPTY(&old_windows)) { wl = RB_ROOT(&old_windows); + if (winlink_find_by_window_id(&s->windows, wl->window->id) == NULL) + notify_window_unlinked(s, wl->window); winlink_remove(&old_windows, wl); } } |