mirror of
https://github.com/tmate-io/tmate.git
synced 2025-08-13 23:38:52 +02:00
Handle focus events from the terminal, from Aaron Jensen.
This commit is contained in:
13
tty-keys.c
13
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,15 @@ complete_key:
|
||||
evtimer_del(&tty->key_timer);
|
||||
tty->flags &= ~TTY_TIMER;
|
||||
|
||||
/* Check for focus events. */
|
||||
if (key == KEYC_FOCUS_OUT) {
|
||||
tty->client->flags &= ~CLIENT_FOCUSED;
|
||||
return (1);
|
||||
} else 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);
|
||||
|
Reference in New Issue
Block a user