diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2013-06-23 13:10:46 +0000 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2013-06-28 20:55:16 +0100 |
commit | c7a121cfc0137c907b7bfb0c3fd1bdee395af8aa (patch) | |
tree | 3a746b9f737616e49e490ce555df0655e7952bcc /server-client.c | |
parent | 777be296ee041e7d9131110e0489e791ed389ac1 (diff) | |
download | rtmux-c7a121cfc0137c907b7bfb0c3fd1bdee395af8aa.tar.gz rtmux-c7a121cfc0137c907b7bfb0c3fd1bdee395af8aa.tar.bz2 rtmux-c7a121cfc0137c907b7bfb0c3fd1bdee395af8aa.zip |
Focus events can cause trouble if left on and they can't be turned off
during idle periods (like the other states are) because we'd miss
events. So add a server option to control them. Defaults to off.
Diffstat (limited to 'server-client.c')
-rw-r--r-- | server-client.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/server-client.c b/server-client.c index 1c15a555..01616cbf 100644 --- a/server-client.c +++ b/server-client.c @@ -548,6 +548,15 @@ server_client_check_focus(struct window_pane *wp) { u_int i; struct client *c; + int push; + + /* Are focus events off? */ + if (!options_get_number(&global_options, "focus-events")) + return; + + /* Do we need to push the focus state? */ + push = wp->flags & PANE_FOCUSPUSH; + wp->flags &= ~PANE_FOCUSPUSH; /* If we don't care about focus, forget it. */ if (!(wp->base.mode & MODE_FOCUSON)) @@ -580,13 +589,13 @@ server_client_check_focus(struct window_pane *wp) } not_focused: - if (wp->flags & PANE_FOCUSED) + if (push || (wp->flags & PANE_FOCUSED)) bufferevent_write(wp->event, "\033[O", 3); wp->flags &= ~PANE_FOCUSED; return; focused: - if (!(wp->flags & PANE_FOCUSED)) + if (push || !(wp->flags & PANE_FOCUSED)) bufferevent_write(wp->event, "\033[I", 3); wp->flags |= PANE_FOCUSED; } |