Handle focus events from the terminal, from Aaron Jensen.

This commit is contained in:
Nicholas Marriott
2013-03-24 09:28:59 +00:00
parent bb8457b166
commit a60687f9ba
4 changed files with 111 additions and 5 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);