---
 tmux.h     |  4 ++++
 tty-keys.c | 14 ++++++++++++++
 2 files changed, 18 insertions(+)

diff --git a/tmux.h b/tmux.h
index c905b66..966588c 100644
--- a/tmux.h
+++ b/tmux.h
@@ -237,6 +237,9 @@ enum key_code {
        KEYC_KP_ENTER,
        KEYC_KP_ZERO,
        KEYC_KP_PERIOD,
+
+       KEYC_FOCUS_IN,
+       KEYC_FOCUS_OUT,
 };
 
 /* Termcap codes. */
@@ -1316,6 +1319,7 @@ struct client {
 #define CLIENT_READONLY 0x800
 #define CLIENT_REDRAWWINDOW 0x1000
 #define CLIENT_CONTROL 0x2000
+#define CLIENT_FOCUSED 0x4000
        int              flags;
 
        struct event     identify_timer;
diff --git a/tty-keys.c b/tty-keys.c
index 00327bb..866151d 100644
--- a/tty-keys.c
+++ b/tty-keys.c
@@ -174,6 +174,10 @@ const struct tty_default_key_raw tty_default_raw_keys[] = {
        { "\033[8@", KEYC_END|KEYC_CTRL|KEYC_SHIFT },
        { "\033[6@", KEYC_NPAGE|KEYC_CTRL|KEYC_SHIFT },
        { "\033[5@", KEYC_PPAGE|KEYC_CTRL|KEYC_SHIFT },
+
+       /* Focus tracking */
+       { "\033[I", KEYC_FOCUS_IN },
+       { "\033[O", KEYC_FOCUS_OUT },
 };
 
 /* Default terminfo(5) keys. */
@@ -559,6 +563,16 @@ complete_key:
                evtimer_del(&tty->key_timer);
        tty->flags &= ~TTY_TIMER;
 
+       if (key == KEYC_FOCUS_OUT) {
+               tty->client->flags &= ~CLIENT_FOCUSED;
+               return (1);
+       }
+
+       if (key == KEYC_FOCUS_IN) {
+               tty->client->flags |= CLIENT_FOCUSED;
+               return (1);
+       }
+
        /* Fire the key. */
        if (key != KEYC_NONE)
                server_client_handle_key(tty->client, key);
-- 
1.8.1.3


------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
tmux-users mailing list
tmux-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/tmux-users

Reply via email to