From a06a0e13921955aaf7e772ee83a7280720a2f03a Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 22 May 2020 15:08:38 +0000 Subject: [PATCH 1/2] xterm* can have focus too. --- options-table.c | 2 +- tty.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/options-table.c b/options-table.c index 87670b12..54bdadba 100644 --- a/options-table.c +++ b/options-table.c @@ -307,7 +307,7 @@ const struct options_table_entry options_table[] = { .type = OPTIONS_TABLE_STRING, .scope = OPTIONS_TABLE_SERVER, .flags = OPTIONS_TABLE_IS_ARRAY, - .default_str = "xterm*:clipboard:ccolour:cstyle:title," + .default_str = "xterm*:clipboard:ccolour:cstyle:focus:title," "screen*:title", .separator = ",", .text = "List of terminal features, used if they cannot be " diff --git a/tty.c b/tty.c index 770c8b78..d330cbc0 100644 --- a/tty.c +++ b/tty.c @@ -467,7 +467,7 @@ tty_update_features(struct tty *tty) if (options_get_number(global_options, "extended-keys")) tty_puts(tty, tty_term_string(tty->term, TTYC_ENEKS)); if (options_get_number(global_options, "focus-events")) - tty_raw(tty, tty_term_string(tty->term, TTYC_ENFCS)); + tty_puts(tty, tty_term_string(tty->term, TTYC_ENFCS)); if (tty->term->flags & TERM_VT100LIKE) tty_puts(tty, "\033[?7727h"); } From 033d6472cb71e82be75aae6682031ef3b711226a Mon Sep 17 00:00:00 2001 From: nicm Date: Fri, 22 May 2020 15:43:38 +0000 Subject: [PATCH 2/2] FocusIn keys can also update the latest client, like normal keys. --- server-client.c | 2 +- tty-keys.c | 7 ++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/server-client.c b/server-client.c index 1f0ac66f..d514b11e 100644 --- a/server-client.c +++ b/server-client.c @@ -1286,7 +1286,7 @@ forward_key: window_pane_key(wp, c, s, wl, key, m); out: - if (s != NULL) + if (s != NULL && key != KEYC_FOCUS_OUT) server_client_update_latest(c); free(event); return (CMD_RETURN_NORMAL); diff --git a/tty-keys.c b/tty-keys.c index 5a2b3817..bbd4bb5f 100644 --- a/tty-keys.c +++ b/tty-keys.c @@ -800,13 +800,10 @@ complete_key: tty->flags &= ~TTY_TIMER; /* Check for focus events. */ - if (key == KEYC_FOCUS_OUT) { + if (key == KEYC_FOCUS_OUT) tty->client->flags &= ~CLIENT_FOCUSED; - return (1); - } else if (key == KEYC_FOCUS_IN) { + else if (key == KEYC_FOCUS_IN) tty->client->flags |= CLIENT_FOCUSED; - return (1); - } /* Fire the key. */ if (key != KEYC_UNKNOWN) {