mirror of
https://github.com/tmate-io/tmate.git
synced 2025-07-01 14:50:01 +02:00
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.
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user