From 029c34ce6bc76168d06726bc81bda4514d245054 Mon Sep 17 00:00:00 2001
From: Nicholas Marriott <nicm@openbsd.org>
Date: Wed, 24 Aug 2011 09:58:44 +0000
Subject: [PATCH] Add a tty_bell wrapper function, from Dylan Alex Simon.

---
 server-window.c | 6 +++---
 tmux.h          | 1 +
 tty.c           | 6 ++++++
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/server-window.c b/server-window.c
index b444982d..a44e32fa 100644
--- a/server-window.c
+++ b/server-window.c
@@ -86,7 +86,7 @@ server_window_check_bell(struct session *s, struct winlink *wl)
 			if (c == NULL || c->session != s)
 				continue;
 			if (!visual) {
-				tty_putcode(&c->tty, TTYC_BEL);
+				tty_bell(&c->tty);
 				continue;
 			}
 			if (c->session->curw->window == w) {
@@ -108,7 +108,7 @@ server_window_check_bell(struct session *s, struct winlink *wl)
 			if (c->session->curw->window != w)
 				continue;
 			if (!visual) {
-				tty_putcode(&c->tty, TTYC_BEL);
+				tty_bell(&c->tty);
 				continue;
 			}
 			status_message_set(c, "Bell in current window");
@@ -254,6 +254,6 @@ ring_bell(struct session *s)
 	for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
 		c = ARRAY_ITEM(&clients, i);
 		if (c != NULL && c->session == s)
-			tty_putcode(&c->tty, TTYC_BEL);
+			tty_bell(&c->tty);
 	}
 }
diff --git a/tmux.h b/tmux.h
index 5c2a5a81..7f0390d5 100644
--- a/tmux.h
+++ b/tmux.h
@@ -1458,6 +1458,7 @@ void	tty_cmd_utf8character(struct tty *, const struct tty_ctx *);
 void	tty_cmd_reverseindex(struct tty *, const struct tty_ctx *);
 void	tty_cmd_setselection(struct tty *, const struct tty_ctx *);
 void	tty_cmd_rawstring(struct tty *, const struct tty_ctx *);
+void	tty_bell(struct tty *);
 
 /* tty-term.c */
 extern struct tty_terms tty_terms;
diff --git a/tty.c b/tty.c
index efd779a6..dce4887b 100644
--- a/tty.c
+++ b/tty.c
@@ -1546,3 +1546,9 @@ tty_try_88(struct tty *tty, u_char colour, const char *type)
 	tty_puts(tty, s);
 	return (0);
 }
+
+void
+tty_bell(struct tty *tty)
+{
+	tty_putcode(tty, TTYC_BEL);
+}