diff options
author | Nicholas Marriott <nicm@openbsd.org> | 2013-06-23 13:10:46 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@openbsd.org> | 2013-06-23 13:10:46 +0000 |
commit | 3977dba76139b5d4b0a6e60458d39a374beeedf3 (patch) | |
tree | c9a2eb74d17f3b685766bd460258b460eddb3a4b /server-client.c | |
parent | a41cd8d75b55da5a1e75e187b30b33917c18c1b2 (diff) | |
download | rtmux-3977dba76139b5d4b0a6e60458d39a374beeedf3.tar.gz rtmux-3977dba76139b5d4b0a6e60458d39a374beeedf3.tar.bz2 rtmux-3977dba76139b5d4b0a6e60458d39a374beeedf3.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 3b7b988a..5f61f5c0 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; } |