Handle focus events from the terminal, from Aaron Jensen.

This commit is contained in:
Nicholas Marriott
2013-02-23 10:01:34 +00:00
parent 1ed37385c6
commit ee0f8adfac
4 changed files with 36 additions and 8 deletions

View File

@ -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);