mirror of
https://github.com/tmux/tmux.git
synced 2024-12-13 01:48:47 +00:00
Make server exit when last session dies. Also fix window check for status activity redraw.
This commit is contained in:
parent
6a187bb8d3
commit
3cd4a08ffb
7
CHANGES
7
CHANGES
@ -1,3 +1,8 @@
|
||||
06 June 2008
|
||||
|
||||
* The server now exits when no sessions remain.
|
||||
* Fix bug with inserting characters with TERM=xterm-color.
|
||||
|
||||
05 June 2008
|
||||
|
||||
* Completely reorganise command parsing. Much more common code in cmd-generic.c
|
||||
@ -440,4 +445,4 @@
|
||||
(including mutt, emacs). No status bar yet and no key remapping or other
|
||||
customisation.
|
||||
|
||||
$Id: CHANGES,v 1.113 2008-06-05 23:17:03 nicm Exp $
|
||||
$Id: CHANGES,v 1.114 2008-06-06 17:55:27 nicm Exp $
|
||||
|
2
TODO
2
TODO
@ -79,6 +79,6 @@
|
||||
- status bar customisation variables, show-activity, show-last-window
|
||||
- show-options
|
||||
- let server die when last session does
|
||||
- each command should have a print op as well for list keys
|
||||
- fix occasion start server problems
|
||||
- key binding bug: random changes?
|
||||
- test and fix wsvt25
|
||||
|
24
server.c
24
server.c
@ -1,4 +1,4 @@
|
||||
/* $Id: server.c,v 1.54 2008-06-06 17:20:29 nicm Exp $ */
|
||||
/* $Id: server.c,v 1.55 2008-06-06 17:55:27 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -142,7 +142,7 @@ server_main(const char *srv_path, int srv_fd)
|
||||
{
|
||||
struct pollfd *pfds, *pfd;
|
||||
int nfds;
|
||||
u_int i;
|
||||
u_int i, n;
|
||||
|
||||
siginit();
|
||||
|
||||
@ -188,6 +188,22 @@ server_main(const char *srv_path, int srv_fd)
|
||||
*/
|
||||
server_handle_windows(&pfd);
|
||||
server_handle_clients(&pfd);
|
||||
|
||||
/*
|
||||
* If we have no sessions and clients left, let's get out
|
||||
* of here...
|
||||
*/
|
||||
n = 0;
|
||||
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
|
||||
if (ARRAY_ITEM(&sessions, i) != NULL)
|
||||
n++;
|
||||
}
|
||||
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
|
||||
if (ARRAY_ITEM(&clients, i) != NULL)
|
||||
n++;
|
||||
}
|
||||
if (n == 0)
|
||||
break;
|
||||
}
|
||||
if (pfds != NULL)
|
||||
xfree(pfds);
|
||||
@ -430,7 +446,7 @@ server_handle_window(struct window *w)
|
||||
continue;
|
||||
|
||||
if (w->flags & WINDOW_BELL &&
|
||||
!session_alert_has(s, w, WINDOW_BELL)) {
|
||||
!session_alert_has_window(s, w, WINDOW_BELL)) {
|
||||
session_alert_add(s, w, WINDOW_BELL);
|
||||
|
||||
action = options_get_number(&s->options, "bell-action");
|
||||
@ -449,7 +465,7 @@ server_handle_window(struct window *w)
|
||||
|
||||
if ((w->flags & WINDOW_MONITOR) &&
|
||||
(w->flags & WINDOW_ACTIVITY) &&
|
||||
!session_alert_has(s, w, WINDOW_ACTIVITY)) {
|
||||
!session_alert_has_window(s, w, WINDOW_ACTIVITY)) {
|
||||
session_alert_add(s, w, WINDOW_ACTIVITY);
|
||||
update = 1;
|
||||
}
|
||||
|
18
session.c
18
session.c
@ -1,4 +1,4 @@
|
||||
/* $Id: session.c,v 1.35 2008-06-06 17:20:29 nicm Exp $ */
|
||||
/* $Id: session.c,v 1.36 2008-06-06 17:55:27 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -55,7 +55,8 @@ session_alert_add(struct session *s, struct window *w, int type)
|
||||
if (wl == s->curw)
|
||||
continue;
|
||||
|
||||
if (wl->window == w && !session_alert_has(s, wl, type)) {
|
||||
if (wl->window == w &&
|
||||
!session_alert_has(s, wl, type)) {
|
||||
sa = xmalloc(sizeof *sa);
|
||||
sa->wl = wl;
|
||||
sa->type = type;
|
||||
@ -77,6 +78,19 @@ session_alert_has(struct session *s, struct winlink *wl, int type)
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
session_alert_has_window(struct session *s, struct window *w, int type)
|
||||
{
|
||||
struct session_alert *sa;
|
||||
|
||||
TAILQ_FOREACH(sa, &s->alerts, entry) {
|
||||
if (sa->wl->window == w && sa->type == type)
|
||||
return (1);
|
||||
}
|
||||
|
||||
return (0);
|
||||
}
|
||||
|
||||
/* Find session by name. */
|
||||
struct session *
|
||||
session_find(const char *name)
|
||||
|
3
tmux.h
3
tmux.h
@ -1,4 +1,4 @@
|
||||
/* $Id: tmux.h,v 1.134 2008-06-06 17:20:30 nicm Exp $ */
|
||||
/* $Id: tmux.h,v 1.135 2008-06-06 17:55:27 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -1064,6 +1064,7 @@ extern struct sessions sessions;
|
||||
void session_alert_add(struct session *, struct window *, int);
|
||||
void session_alert_cancel(struct session *, struct winlink *);
|
||||
int session_alert_has(struct session *, struct winlink *, int);
|
||||
int session_alert_has_window(struct session *, struct window *, int);
|
||||
struct session *session_find(const char *);
|
||||
struct session *session_create(const char *, const char *, u_int, u_int);
|
||||
void session_destroy(struct session *);
|
||||
|
Loading…
Reference in New Issue
Block a user