From 12f7197adbf37a430266ecbe355ebb568b69eeb6 Mon Sep 17 00:00:00 2001 From: Nicholas Marriott Date: Mon, 27 Aug 2007 20:36:52 +0000 Subject: [PATCH] session_flush can go bye-bye again. --- TODO | 1 + server.c | 9 +++------ session.c | 11 +++-------- tmux.h | 5 ++--- 4 files changed, 9 insertions(+), 17 deletions(-) diff --git a/TODO b/TODO index 685479d6..bd9aed27 100644 --- a/TODO +++ b/TODO @@ -13,3 +13,4 @@ - new window command prompt - mouse handling and some other bits elinks needs - scrollback +- server doesn't handle SIGTERM anymore... diff --git a/server.c b/server.c index 411f9f13..b386ebba 100644 --- a/server.c +++ b/server.c @@ -1,4 +1,4 @@ -/* $Id: server.c,v 1.7 2007-08-27 15:28:07 nicm Exp $ */ +/* $Id: server.c,v 1.8 2007-08-27 20:36:52 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -667,11 +667,8 @@ lost_window(struct window *w) if (!session_has(s, w)) continue; - /* Detach window from session. */ - session_detach(s, w); - - /* Try to flush session and either redraw or kill clients. */ - destroyed = session_flush(s); + /* Detach window and either redraw or kill clients. */ + destroyed = session_detach(s, w); for (j = 0; j < ARRAY_LENGTH(&clients); j++) { c = ARRAY_ITEM(&clients, j); if (c == NULL || c->session != s) diff --git a/session.c b/session.c index d3667c6b..79e394d2 100644 --- a/session.c +++ b/session.c @@ -1,4 +1,4 @@ -/* $Id: session.c,v 1.6 2007-08-27 15:28:07 nicm Exp $ */ +/* $Id: session.c,v 1.7 2007-08-27 20:36:52 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -124,7 +124,7 @@ session_attach(struct session *s, struct window *w) } /* Detach a window from a session. */ -void +int session_detach(struct session *s, struct window *w) { if (s->window == w) { @@ -133,15 +133,10 @@ session_detach(struct session *s, struct window *w) } window_remove(&s->windows, w); -} -/* Flush session if it is empty. */ -int -session_flush(struct session *s) -{ + /* Destroy session if it is empty. */ if (!ARRAY_EMPTY(&s->windows)) return (0); - session_destroy(s); return (1); } diff --git a/tmux.h b/tmux.h index 478cc5de..949383fe 100644 --- a/tmux.h +++ b/tmux.h @@ -1,4 +1,4 @@ -/* $Id: tmux.h,v 1.5 2007-08-27 13:45:26 nicm Exp $ */ +/* $Id: tmux.h,v 1.6 2007-08-27 20:36:52 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott @@ -485,8 +485,7 @@ void session_destroy(struct session *); int session_index(struct session *, u_int *); int session_new(struct session *, const char *, u_int, u_int); void session_attach(struct session *, struct window *); -void session_detach(struct session *, struct window *); -int session_flush(struct session *); +int session_detach(struct session *, struct window *); int session_has(struct session *, struct window *); int session_next(struct session *); int session_previous(struct session *);