mirror of
https://github.com/tmux/tmux.git
synced 2024-11-16 09:28:51 +00: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
|
28 September 2007
|
||||||
|
|
||||||
* (nicm) Major rewrite of input parser:
|
* (nicm) Major rewrite of input parser:
|
||||||
@ -68,5 +72,5 @@
|
|||||||
(including mutt, emacs). No status bar yet and no key remapping or other
|
(including mutt, emacs). No status bar yet and no key remapping or other
|
||||||
customisation.
|
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>
|
* 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");
|
log_warnx("carriage_return not supported");
|
||||||
break;
|
break;
|
||||||
|
case '\007': /* BEL */
|
||||||
|
if (bell != NULL) {
|
||||||
|
local_putp(bell);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
log_warnx("bell not supported");
|
||||||
|
break;
|
||||||
case '\010': /* BS */
|
case '\010': /* BS */
|
||||||
if (cursor_left != NULL) {
|
if (cursor_left != NULL) {
|
||||||
local_putp(cursor_left);
|
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>
|
* 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. */
|
/* Write command to a client. */
|
||||||
void
|
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;
|
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. */
|
/* Write command to a client with two buffers. */
|
||||||
void
|
void
|
||||||
server_write_client2(struct client *c,
|
server_write_client2(struct client *c, enum hdrtype type,
|
||||||
enum hdrtype type, void *buf1, size_t len1, void *buf2, size_t len2)
|
const void *buf1, size_t len1, const void *buf2, size_t len2)
|
||||||
{
|
{
|
||||||
struct hdr hdr;
|
struct hdr hdr;
|
||||||
|
|
||||||
@ -112,7 +113,7 @@ server_write_client2(struct client *c,
|
|||||||
/* Write command to all clients attached to a specific window. */
|
/* Write command to all clients attached to a specific window. */
|
||||||
void
|
void
|
||||||
server_write_clients(
|
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 client *c;
|
||||||
struct hdr hdr;
|
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>
|
* 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_fill_clients(struct pollfd **);
|
||||||
void server_handle_clients(struct pollfd **);
|
void server_handle_clients(struct pollfd **);
|
||||||
struct client *server_accept_client(int);
|
struct client *server_accept_client(int);
|
||||||
|
void server_handle_window(struct window *);
|
||||||
void server_lost_client(struct client *);
|
void server_lost_client(struct client *);
|
||||||
void server_lost_window(struct window *);
|
void server_lost_window(struct window *);
|
||||||
|
|
||||||
@ -200,21 +201,13 @@ server_handle_windows(struct pollfd **pfd)
|
|||||||
{
|
{
|
||||||
struct window *w;
|
struct window *w;
|
||||||
u_int i;
|
u_int i;
|
||||||
struct buffer *b;
|
|
||||||
|
|
||||||
for (i = 0; i < ARRAY_LENGTH(&windows); i++) {
|
for (i = 0; i < ARRAY_LENGTH(&windows); i++) {
|
||||||
if ((w = ARRAY_ITEM(&windows, i)) != NULL) {
|
if ((w = ARRAY_ITEM(&windows, i)) != NULL) {
|
||||||
if (window_poll(w, *pfd) != 0)
|
if (window_poll(w, *pfd) != 0)
|
||||||
server_lost_window(w);
|
server_lost_window(w);
|
||||||
else {
|
else
|
||||||
b = buffer_create(BUFSIZ);
|
server_handle_window(w);
|
||||||
window_output(w, b);
|
|
||||||
if (BUFFER_USED(b) != 0) {
|
|
||||||
server_write_clients(w, MSG_OUTPUT,
|
|
||||||
BUFFER_OUT(b), BUFFER_USED(b));
|
|
||||||
}
|
|
||||||
buffer_destroy(b);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
(*pfd)++;
|
(*pfd)++;
|
||||||
}
|
}
|
||||||
@ -312,6 +305,49 @@ server_lost_client(struct client *c)
|
|||||||
xfree(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. */
|
/* Lost window: move clients on to next window. */
|
||||||
void
|
void
|
||||||
server_lost_window(struct window *w)
|
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>
|
* Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net>
|
||||||
@ -539,10 +539,12 @@ int server_msg_dispatch(struct client *);
|
|||||||
/* server-fn.c */
|
/* server-fn.c */
|
||||||
struct session *server_find_sessid(struct sessid *, char **);
|
struct session *server_find_sessid(struct sessid *, char **);
|
||||||
void server_write_message(struct client *, const char *, ...);
|
void server_write_message(struct client *, const char *, ...);
|
||||||
void server_write_client(struct client *, enum hdrtype, void *, size_t);
|
void server_write_client(
|
||||||
void server_write_client2(
|
struct client *, enum hdrtype, const void *, size_t);
|
||||||
struct client *, enum hdrtype, void *, size_t, void *, size_t);
|
void server_write_client2(struct client *,
|
||||||
void server_write_clients(struct window *, enum hdrtype, void *, size_t);
|
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_window_changed(struct client *);
|
||||||
void server_draw_client(struct client *, u_int, u_int);
|
void server_draw_client(struct client *, u_int, u_int);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user