diff options
author | Nicholas Marriott <nicm@cvs.openbsd.org> | 2013-06-23 12:51:30 +0000 |
---|---|---|
committer | Nicholas Marriott <nicm@cvs.openbsd.org> | 2013-06-23 12:51:30 +0000 |
commit | 03cec82a5001a5a6c4649b6a2392f42f169a79d6 (patch) | |
tree | 983c98f2d2a2752e72efe8d64426680571aa237c | |
parent | 49a74f171e9359c9c6bb88459cec04651f5d6eda (diff) |
Always push a focus event when the application turns it on, prompted by
discussion with Hayaki Saito a while ago.
-rw-r--r-- | usr.bin/tmux/input.c | 4 | ||||
-rw-r--r-- | usr.bin/tmux/server-client.c | 11 | ||||
-rw-r--r-- | usr.bin/tmux/tmux.h | 3 |
3 files changed, 12 insertions, 6 deletions
diff --git a/usr.bin/tmux/input.c b/usr.bin/tmux/input.c index 49fbbedf357..5b5abe8e3c3 100644 --- a/usr.bin/tmux/input.c +++ b/usr.bin/tmux/input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: input.c,v 1.62 2013/03/24 09:18:16 nicm Exp $ */ +/* $OpenBSD: input.c,v 1.63 2013/06/23 12:51:28 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -1333,7 +1333,7 @@ input_csi_dispatch(struct input_ctx *ictx) if (s->mode & MODE_FOCUSON) break; screen_write_mode_set(&ictx->ctx, MODE_FOCUSON); - wp->flags &= ~PANE_FOCUSED; /* force update if needed */ + wp->flags |= PANE_FOCUSPUSH; /* force update */ break; case 1005: screen_write_mode_set(&ictx->ctx, MODE_MOUSE_UTF8); diff --git a/usr.bin/tmux/server-client.c b/usr.bin/tmux/server-client.c index 4e7bfbc9467..829fd8dbf59 100644 --- a/usr.bin/tmux/server-client.c +++ b/usr.bin/tmux/server-client.c @@ -1,4 +1,4 @@ -/* $OpenBSD: server-client.c,v 1.101 2013/04/21 21:32:00 nicm Exp $ */ +/* $OpenBSD: server-client.c,v 1.102 2013/06/23 12:51:28 nicm Exp $ */ /* * Copyright (c) 2009 Nicholas Marriott <nicm@users.sourceforge.net> @@ -548,6 +548,11 @@ server_client_check_focus(struct window_pane *wp) { u_int i; struct client *c; + int push; + + /* 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 +585,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; } diff --git a/usr.bin/tmux/tmux.h b/usr.bin/tmux/tmux.h index bdef7c567de..26c052aa6cb 100644 --- a/usr.bin/tmux/tmux.h +++ b/usr.bin/tmux/tmux.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tmux.h,v 1.412 2013/06/23 12:41:55 nicm Exp $ */ +/* $OpenBSD: tmux.h,v 1.413 2013/06/23 12:51:29 nicm Exp $ */ /* * Copyright (c) 2007 Nicholas Marriott <nicm@users.sourceforge.net> @@ -941,6 +941,7 @@ struct window_pane { #define PANE_DROP 0x2 #define PANE_FOCUSED 0x4 #define PANE_RESIZE 0x8 +#define PANE_FOCUSPUSH 0x10 char *cmd; char *shell; |