This is an automated email from the git hooks/post-receive script.
git pushed a commit to branch tymux-12-session-parity
in repository terminology.
View the commit online.
commit 07b0ca8d3b5315e84832ec501691f09a0c387361
Author: Cedric BAIL <[email protected]>
AuthorDate: Sun Nov 22 22:20:11 2026 -0600
termd_tymux: don't invent a focus event
An application enabling focus reporting is told the current focus. The
daemon has no focus of its own and always answered that it was lost,
so every application started out unfocused and the bytes could land
in a shell's input. Focus events now only come from attached clients.
---
src/bin/termd_tymux.c | 1 +
src/bin/termpty.h | 2 ++
src/bin/termptyesc.c | 3 ++-
tests/tymux.py | 26 +++++++++++++++++++++-----
4 files changed, 26 insertions(+), 6 deletions(-)
diff --git a/src/bin/termd_tymux.c b/src/bin/termd_tymux.c
index dd4e6cf7..0acccf48 100644
--- a/src/bin/termd_tymux.c
+++ b/src/bin/termd_tymux.c
@@ -1292,6 +1292,7 @@ termd_tymux_new(const char *name, const char *cmd)
td->pty = termpty_new(cmd, EINA_FALSE, NULL, 80, 24, td->config, name, 0);
if (!td->pty)
goto err;
+ td->pty->no_focus_event = EINA_TRUE;
td->pty->cb.change.func = _cb_pty_change;
td->pty->cb.change.data = ""
td->pty->cb.set_title.func = _cb_pty_title;
diff --git a/src/bin/termpty.h b/src/bin/termpty.h
index b475b22d..931170b3 100644
--- a/src/bin/termpty.h
+++ b/src/bin/termpty.h
@@ -342,6 +342,8 @@ struct tag_Termpty
unsigned int write_reply : 1; /* set during termpty_write_reply() */
unsigned int decoding_error : 1;
unsigned int focus_reporting : 1;
+ /* no widget to be focused: the focus comes from the clients, as input */
+ unsigned int no_focus_event : 1;
unsigned int color_scheme_reporting : 1;
unsigned int osc_skip : 1; /* discarding an OSC too long for the buffer */
unsigned int osc_skip_esc : 1; /* and the last codepoint was ESC */
diff --git a/src/bin/termptyesc.c b/src/bin/termptyesc.c
index 0192f6a1..11378853 100644
--- a/src/bin/termptyesc.c
+++ b/src/bin/termptyesc.c
@@ -657,7 +657,8 @@ _handle_esc_csi_reset_mode(Termpty *ty, Eina_Unicode cc, Eina_Unicode *b,
if (mode)
{
ty->focus_reporting = EINA_TRUE;
- termpty_focus_report(ty, termio_is_focused(ty->obj));
+ if (!ty->no_focus_event)
+ termpty_focus_report(ty, termio_is_focused(ty->obj));
}
else
{
diff --git a/tests/tymux.py b/tests/tymux.py
index 6ac1367a..d6ed6212 100644
--- a/tests/tymux.py
+++ b/tests/tymux.py
@@ -192,11 +192,8 @@ def cpu_time(pid):
def emit(client, octal):
"""make the shell of client write octal escapes, such as \\033[?1h: the
- echo of the command holds the backslashes, not the sequence. Setting
- focus reporting makes the session type a focus-out into the shell, which
- Ctrl+U drops along with it."""
- client.idle(0.3)
- client.send("\x15printf '%s'\r" % octal)
+ echo of the command holds the backslashes, not the sequence."""
+ client.send("printf '%s'\r" % octal)
def expect_after(client, mark, text, timeout=5):
@@ -222,6 +219,24 @@ def modes_session(name):
return client
+def check_no_focus_event():
+ name = "f%d" % os.getpid()
+ c = Client(["new", name])
+ check(c.expect("$ "), "focus: the shell prompt is shown")
+ # the first byte the command reads is the typed x, unless the session
+ # put a focus event in the input of the shell first
+ c.send("printf '\\033[?1004h'; head -c 1 | od -An -tx1; echo END\r")
+ check(c.expect("\033[?1004h"), "focus: reporting is set")
+ c.idle(0.3)
+ c.send("x\r")
+ check(c.expect("78"), "focus: the command read the typed byte first")
+ check(b"1b" not in c.out,
+ "focus: the session sends no focus event to the shell")
+ c.send("\x02d")
+ c.wait()
+ tymux("kill", name)
+
+
def check_modes():
name = "m%d" % os.getpid()
c = Client(["new", name])
@@ -497,6 +512,7 @@ def main():
check(not daemons(), "tymuxd exits with its shell")
check_modes()
+ check_no_focus_event()
# a client that stops reading is dropped instead of blocking tymuxd
a = Client(["new", NAME])
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.