summaryrefslogtreecommitdiffstats
path: root/server-window.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicm@openbsd.org>2012-06-18 10:58:44 +0000
committerNicholas Marriott <nicm@openbsd.org>2012-06-18 10:58:44 +0000
commit7c39850d1f55f101c42a2dd65664691927c459a1 (patch)
tree0816b7f247b9f7b2b17054bf631ed13decf40d78 /server-window.c
parenta13b4a819a0a6d7d5763d12335eb82417093202d (diff)
Tidy up bell code, from Thomas Adam.
Diffstat (limited to 'server-window.c')
-rw-r--r--server-window.c49
1 files changed, 14 insertions, 35 deletions
diff --git a/server-window.c b/server-window.c
index 47dec89a..f382de99 100644
--- a/server-window.c
+++ b/server-window.c
@@ -76,46 +76,25 @@ server_window_check_bell(struct session *s, struct winlink *wl)
return (0);
if (s->curw != wl || s->flags & SESSION_UNATTACHED)
wl->flags |= WINLINK_BELL;
+ if (s->flags & SESSION_UNATTACHED)
+ return (1);
+ visual = options_get_number(&s->options, "visual-bell");
action = options_get_number(&s->options, "bell-action");
- switch (action) {
- case BELL_ANY:
- if (s->flags & SESSION_UNATTACHED)
- break;
- visual = options_get_number(&s->options, "visual-bell");
- for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
- c = ARRAY_ITEM(&clients, i);
- if (c == NULL || c->session != s)
- continue;
- if (!visual) {
- tty_bell(&c->tty);
- continue;
- }
- if (c->session->curw->window == w) {
- status_message_set(c, "Bell in current window");
- continue;
- }
- status_message_set(c, "Bell in window %u",
- winlink_find_by_window(&s->windows, w)->idx);
+ for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
+ c = ARRAY_ITEM(&clients, i);
+ if (c == NULL || c->session != s)
+ continue;
+ if (!visual) {
+ tty_bell(&c->tty);
+ continue;
}
- break;
- case BELL_CURRENT:
- if (s->flags & SESSION_UNATTACHED)
- break;
- visual = options_get_number(&s->options, "visual-bell");
- for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
- c = ARRAY_ITEM(&clients, i);
- if (c == NULL || c->session != s)
- continue;
- if (c->session->curw->window != w)
- continue;
- if (!visual) {
- tty_bell(&c->tty);
- continue;
- }
+ if (c->session->curw->window == w)
status_message_set(c, "Bell in current window");
+ else if (action == BELL_ANY) {
+ status_message_set(c, "Bell in window %u",
+ winlink_find_by_window(&s->windows, w)->idx);
}
- break;
}
return (1);