mirror of
https://github.com/tmate-io/tmate.git
synced 2024-12-25 16:19:02 +01:00
Tidy up bell code, from Thomas Adam.
This commit is contained in:
parent
a13b4a819a
commit
7c39850d1f
@ -76,13 +76,11 @@ server_window_check_bell(struct session *s, struct winlink *wl)
|
|||||||
return (0);
|
return (0);
|
||||||
if (s->curw != wl || s->flags & SESSION_UNATTACHED)
|
if (s->curw != wl || s->flags & SESSION_UNATTACHED)
|
||||||
wl->flags |= WINLINK_BELL;
|
wl->flags |= WINLINK_BELL;
|
||||||
|
|
||||||
action = options_get_number(&s->options, "bell-action");
|
|
||||||
switch (action) {
|
|
||||||
case BELL_ANY:
|
|
||||||
if (s->flags & SESSION_UNATTACHED)
|
if (s->flags & SESSION_UNATTACHED)
|
||||||
break;
|
return (1);
|
||||||
|
|
||||||
visual = options_get_number(&s->options, "visual-bell");
|
visual = options_get_number(&s->options, "visual-bell");
|
||||||
|
action = options_get_number(&s->options, "bell-action");
|
||||||
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
|
for (i = 0; i < ARRAY_LENGTH(&clients); i++) {
|
||||||
c = ARRAY_ITEM(&clients, i);
|
c = ARRAY_ITEM(&clients, i);
|
||||||
if (c == NULL || c->session != s)
|
if (c == NULL || c->session != s)
|
||||||
@ -91,31 +89,12 @@ server_window_check_bell(struct session *s, struct winlink *wl)
|
|||||||
tty_bell(&c->tty);
|
tty_bell(&c->tty);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (c->session->curw->window == w) {
|
if (c->session->curw->window == w)
|
||||||
status_message_set(c, "Bell in current window");
|
status_message_set(c, "Bell in current window");
|
||||||
continue;
|
else if (action == BELL_ANY) {
|
||||||
}
|
|
||||||
status_message_set(c, "Bell in window %u",
|
status_message_set(c, "Bell in window %u",
|
||||||
winlink_find_by_window(&s->windows, w)->idx);
|
winlink_find_by_window(&s->windows, w)->idx);
|
||||||
}
|
}
|
||||||
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;
|
|
||||||
}
|
|
||||||
status_message_set(c, "Bell in current window");
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return (1);
|
return (1);
|
||||||
|
Loading…
Reference in New Issue
Block a user