mirror of
https://github.com/tmate-io/tmate.git
synced 2024-11-23 08:33:17 +01:00
Pass bell through from any window.
This commit is contained in:
parent
14e9f73df9
commit
2ec60c9d66
6
CHANGES
6
CHANGES
@ -1,3 +1,7 @@
|
||||
29 September 2007
|
||||
|
||||
* (nicm) Pass through bell in any window to current.
|
||||
|
||||
28 September 2007
|
||||
|
||||
* (nicm) Major rewrite of input parser:
|
||||
@ -68,5 +72,5 @@
|
||||
(including mutt, emacs). No status bar yet and no key remapping or other
|
||||
customisation.
|
||||
|
||||
$Id: CHANGES,v 1.13 2007-09-28 22:47:21 nicm Exp $
|
||||
$Id: CHANGES,v 1.14 2007-09-29 09:53:25 nicm Exp $
|
||||
|
||||
|
9
local.c
9
local.c
@ -1,4 +1,4 @@
|
||||
/* $Id: local.c,v 1.8 2007-09-28 22:47:21 nicm Exp $ */
|
||||
/* $Id: local.c,v 1.9 2007-09-29 09:53:25 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -393,6 +393,13 @@ local_output(struct buffer *b, size_t size)
|
||||
}
|
||||
log_warnx("carriage_return not supported");
|
||||
break;
|
||||
case '\007': /* BEL */
|
||||
if (bell != NULL) {
|
||||
local_putp(bell);
|
||||
break;
|
||||
}
|
||||
log_warnx("bell not supported");
|
||||
break;
|
||||
case '\010': /* BS */
|
||||
if (cursor_left != NULL) {
|
||||
local_putp(cursor_left);
|
||||
|
11
server-fn.c
11
server-fn.c
@ -1,4 +1,4 @@
|
||||
/* $Id: server-fn.c,v 1.6 2007-09-28 21:08:30 nicm Exp $ */
|
||||
/* $Id: server-fn.c,v 1.7 2007-09-29 09:53:25 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -76,7 +76,8 @@ server_find_sessid(struct sessid *sid, char **cause)
|
||||
|
||||
/* Write command to a client. */
|
||||
void
|
||||
server_write_client(struct client *c, enum hdrtype type, void *buf, size_t len)
|
||||
server_write_client(
|
||||
struct client *c, enum hdrtype type, const void *buf, size_t len)
|
||||
{
|
||||
struct hdr hdr;
|
||||
|
||||
@ -92,8 +93,8 @@ server_write_client(struct client *c, enum hdrtype type, void *buf, size_t len)
|
||||
|
||||
/* Write command to a client with two buffers. */
|
||||
void
|
||||
server_write_client2(struct client *c,
|
||||
enum hdrtype type, void *buf1, size_t len1, void *buf2, size_t len2)
|
||||
server_write_client2(struct client *c, enum hdrtype type,
|
||||
const void *buf1, size_t len1, const void *buf2, size_t len2)
|
||||
{
|
||||
struct hdr hdr;
|
||||
|
||||
@ -112,7 +113,7 @@ server_write_client2(struct client *c,
|
||||
/* Write command to all clients attached to a specific window. */
|
||||
void
|
||||
server_write_clients(
|
||||
struct window *w, enum hdrtype type, void *buf, size_t len)
|
||||
struct window *w, enum hdrtype type, const void *buf, size_t len)
|
||||
{
|
||||
struct client *c;
|
||||
struct hdr hdr;
|
||||
|
58
server.c
58
server.c
@ -1,4 +1,4 @@
|
||||
/* $Id: server.c,v 1.15 2007-09-27 09:15:58 nicm Exp $ */
|
||||
/* $Id: server.c,v 1.16 2007-09-29 09:53:25 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -50,6 +50,7 @@ void server_handle_windows(struct pollfd **);
|
||||
void server_fill_clients(struct pollfd **);
|
||||
void server_handle_clients(struct pollfd **);
|
||||
struct client *server_accept_client(int);
|
||||
void server_handle_window(struct window *);
|
||||
void server_lost_client(struct client *);
|
||||
void server_lost_window(struct window *);
|
||||
|
||||
@ -200,21 +201,13 @@ server_handle_windows(struct pollfd **pfd)
|
||||
{
|
||||
struct window *w;
|
||||
u_int i;
|
||||
struct buffer *b;
|
||||
|
||||
for (i = 0; i < ARRAY_LENGTH(&windows); i++) {
|
||||
if ((w = ARRAY_ITEM(&windows, i)) != NULL) {
|
||||
if (window_poll(w, *pfd) != 0)
|
||||
server_lost_window(w);
|
||||
else {
|
||||
b = buffer_create(BUFSIZ);
|
||||
window_output(w, b);
|
||||
if (BUFFER_USED(b) != 0) {
|
||||
server_write_clients(w, MSG_OUTPUT,
|
||||
BUFFER_OUT(b), BUFFER_USED(b));
|
||||
}
|
||||
buffer_destroy(b);
|
||||
}
|
||||
else
|
||||
server_handle_window(w);
|
||||
}
|
||||
(*pfd)++;
|
||||
}
|
||||
@ -312,6 +305,49 @@ server_lost_client(struct client *c)
|
||||
xfree(c);
|
||||
}
|
||||
|
||||
/* Handle window data. */
|
||||
void
|
||||
server_handle_window(struct window *w)
|
||||
{
|
||||
struct client *c;
|
||||
struct session *s;
|
||||
struct buffer *b;
|
||||
u_int i, j, p;
|
||||
|
||||
b = buffer_create(BUFSIZ);
|
||||
window_output(w, b);
|
||||
|
||||
if (BUFFER_USED(b) != 0) {
|
||||
server_write_clients(
|
||||
w, MSG_OUTPUT, BUFFER_OUT(b), BUFFER_USED(b));
|
||||
}
|
||||
buffer_destroy(b);
|
||||
|
||||
if (!(w->flags & WINDOW_BELL))
|
||||
return;
|
||||
|
||||
for (i = 0; i < ARRAY_LENGTH(&sessions); i++) {
|
||||
s = ARRAY_ITEM(&sessions, i);
|
||||
if (s == NULL)
|
||||
continue;
|
||||
if (window_index(&s->windows, w, &p) != 0)
|
||||
continue;
|
||||
|
||||
for (j = 0; j < ARRAY_LENGTH(&clients); j++) {
|
||||
c = ARRAY_ITEM(&clients, j);
|
||||
if (c == NULL || c->session != s)
|
||||
continue;
|
||||
/*
|
||||
if (s->window != w)
|
||||
server_write_message(c, "Bell in window %u", p);
|
||||
*/
|
||||
server_write_client(c, MSG_OUTPUT, "\007", 1);
|
||||
}
|
||||
}
|
||||
|
||||
w->flags &= ~WINDOW_BELL;
|
||||
}
|
||||
|
||||
/* Lost window: move clients on to next window. */
|
||||
void
|
||||
server_lost_window(struct window *w)
|
||||
|
12
tmux.h
12
tmux.h
@ -1,4 +1,4 @@
|
||||
/* $Id: tmux.h,v 1.22 2007-09-29 09:15:49 nicm Exp $ */
|
||||
/* $Id: tmux.h,v 1.23 2007-09-29 09:53:25 nicm Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||
@ -539,10 +539,12 @@ int server_msg_dispatch(struct client *);
|
||||
/* server-fn.c */
|
||||
struct session *server_find_sessid(struct sessid *, char **);
|
||||
void server_write_message(struct client *, const char *, ...);
|
||||
void server_write_client(struct client *, enum hdrtype, void *, size_t);
|
||||
void server_write_client2(
|
||||
struct client *, enum hdrtype, void *, size_t, void *, size_t);
|
||||
void server_write_clients(struct window *, enum hdrtype, void *, size_t);
|
||||
void server_write_client(
|
||||
struct client *, enum hdrtype, const void *, size_t);
|
||||
void server_write_client2(struct client *,
|
||||
enum hdrtype, const void *, size_t, const void *, size_t);
|
||||
void server_write_clients(
|
||||
struct window *, enum hdrtype, const void *, size_t);
|
||||
void server_window_changed(struct client *);
|
||||
void server_draw_client(struct client *, u_int, u_int);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user