summaryrefslogtreecommitdiff
path: root/usr.bin/tmux/server-fn.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@cvs.openbsd.org>2016-10-16 22:06:41 +0000
committerNicholas Marriott <nicm@cvs.openbsd.org>2016-10-16 22:06:41 +0000
commitdd710358400562e21af7c99f0af8e30112a967f8 (patch)
tree6d1f0d78f02d2464887c89f626277be197e72f57 /usr.bin/tmux/server-fn.c
parent682bdbaa44332449efd70c28f021e0a61033aa50 (diff)
Use the notify name string instead of going via an enum and change
existing hooks to use notifys instead.
Diffstat (limited to 'usr.bin/tmux/server-fn.c')
-rw-r--r--usr.bin/tmux/server-fn.c22
1 files changed, 12 insertions, 10 deletions
diff --git a/usr.bin/tmux/server-fn.c b/usr.bin/tmux/server-fn.c
index 0167da802ff..ea924328615 100644
--- a/usr.bin/tmux/server-fn.c
+++ b/usr.bin/tmux/server-fn.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server-fn.c,v 1.101 2016/10/11 13:21:59 nicm Exp $ */
+/* $OpenBSD: server-fn.c,v 1.102 2016/10/16 22:06:40 nicm Exp $ */
/*
* Copyright (c) 2007 Nicholas Marriott <nicholas.marriott@gmail.com>
@@ -258,7 +258,8 @@ server_link_window(struct session *src, struct winlink *srcwl,
* Can't use session_detach as it will destroy session
* if this makes it empty.
*/
- notify_window_unlinked(dst, dstwl->window);
+ notify_session_window("window-unlinked", dst,
+ dstwl->window);
dstwl->flags &= ~WINLINK_ALERTFLAGS;
winlink_stack_remove(&dst->lastw, dstwl);
winlink_remove(&dst->windows, dstwl);
@@ -294,13 +295,12 @@ server_unlink_window(struct session *s, struct winlink *wl)
}
void
-server_destroy_pane(struct window_pane *wp, int hooks)
+server_destroy_pane(struct window_pane *wp, int notify)
{
struct window *w = wp->window;
int old_fd;
struct screen_write_ctx ctx;
struct grid_cell gc;
- struct cmd_find_state fs;
old_fd = wp->fd;
if (wp->fd != -1) {
@@ -312,6 +312,10 @@ server_destroy_pane(struct window_pane *wp, int hooks)
if (options_get_number(w->options, "remain-on-exit")) {
if (old_fd == -1)
return;
+
+ if (notify)
+ notify_pane("pane-died", wp);
+
screen_write_start(&ctx, wp, &wp->base);
screen_write_scrollregion(&ctx, 0, screen_size_y(ctx.s) - 1);
screen_write_cursormove(&ctx, 0, screen_size_y(ctx.s) - 1);
@@ -322,18 +326,16 @@ server_destroy_pane(struct window_pane *wp, int hooks)
screen_write_stop(&ctx);
wp->flags |= PANE_REDRAW;
- if (hooks && cmd_find_from_pane(&fs, wp) == 0)
- hooks_run(hooks_get(fs.s), NULL, &fs, "pane-died");
return;
}
+ if (notify)
+ notify_pane("pane-exited", wp);
+
server_unzoom_window(w);
layout_close_pane(wp);
window_remove_pane(w, wp);
- if (hooks && cmd_find_from_window(&fs, w) == 0)
- hooks_run(hooks_get(fs.s), NULL, &fs, "pane-exited");
-
if (TAILQ_EMPTY(&w->panes))
server_kill_window(w);
else
@@ -394,7 +396,7 @@ server_destroy_session(struct session *s)
c->session = s_new;
server_client_set_key_table(c, NULL);
status_timer_start(c);
- notify_attached_session_changed(c);
+ notify_client("client-session-changed", c);
session_update_activity(s_new, NULL);
gettimeofday(&s_new->last_attached_time, NULL);
server_redraw_client(c);