session_flush can go bye-bye again.

This commit is contained in:
Nicholas Marriott 2007-08-27 20:36:52 +00:00
parent 438144692d
commit 12f7197adb
4 changed files with 9 additions and 17 deletions

1
TODO
View File

@ -13,3 +13,4 @@
- new window command prompt - new window command prompt
- mouse handling and some other bits elinks needs - mouse handling and some other bits elinks needs
- scrollback - scrollback
- server doesn't handle SIGTERM anymore...

View File

@ -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 <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -667,11 +667,8 @@ lost_window(struct window *w)
if (!session_has(s, w)) if (!session_has(s, w))
continue; continue;
/* Detach window from session. */ /* Detach window and either redraw or kill clients. */
session_detach(s, w); destroyed = session_detach(s, w);
/* Try to flush session and either redraw or kill clients. */
destroyed = session_flush(s);
for (j = 0; j < ARRAY_LENGTH(&clients); j++) { for (j = 0; j < ARRAY_LENGTH(&clients); j++) {
c = ARRAY_ITEM(&clients, j); c = ARRAY_ITEM(&clients, j);
if (c == NULL || c->session != s) if (c == NULL || c->session != s)

View File

@ -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 <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -124,7 +124,7 @@ session_attach(struct session *s, struct window *w)
} }
/* Detach a window from a session. */ /* Detach a window from a session. */
void int
session_detach(struct session *s, struct window *w) session_detach(struct session *s, struct window *w)
{ {
if (s->window == w) { if (s->window == w) {
@ -133,15 +133,10 @@ session_detach(struct session *s, struct window *w)
} }
window_remove(&s->windows, w); window_remove(&s->windows, w);
}
/* Flush session if it is empty. */ /* Destroy session if it is empty. */
int
session_flush(struct session *s)
{
if (!ARRAY_EMPTY(&s->windows)) if (!ARRAY_EMPTY(&s->windows))
return (0); return (0);
session_destroy(s); session_destroy(s);
return (1); return (1);
} }

5
tmux.h
View File

@ -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 <nicm@users.sourceforge.net> * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
@ -485,8 +485,7 @@ void session_destroy(struct session *);
int session_index(struct session *, u_int *); int session_index(struct session *, u_int *);
int session_new(struct session *, const char *, u_int, u_int); int session_new(struct session *, const char *, u_int, u_int);
void session_attach(struct session *, struct window *); void session_attach(struct session *, struct window *);
void session_detach(struct session *, struct window *); int session_detach(struct session *, struct window *);
int session_flush(struct session *);
int session_has(struct session *, struct window *); int session_has(struct session *, struct window *);
int session_next(struct session *); int session_next(struct session *);
int session_previous(struct session *); int session_previous(struct session *);