This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch tymux
in repository terminology.

View the commit online.

commit 3dcd0064fa046e66f8fdace4fb01feda9a0e47a8
Author: [email protected] <[email protected]>
AuthorDate: Mon Mar 16 09:18:43 2026 -0600

    feat: integrate tymux session recovery into termio lifecycle
    
    Wired tymux session mode into three critical points of the termio
    component:
    
    1. termio_add(): When session_name is provided, call termsession_attach()
       instead of termpty_new() to connect to the daemon. Register callbacks
       (change, title, bell, exit) on the shadow Termpty for screen updates
       and keyboard routing.
    
    2. _smart_del(): Free TermSession and its shadow Termpty in session mode,
       or free the direct Termpty in normal mode. Ensures clean cleanup of
       daemon resources.
    
    3. _smart_size(): Dispatch resize events to termsession_resize() in
       session mode, or termpty_resize() in normal mode.
    
    Session mode is fully isolated by #ifdef HAVE_TYMUX guards. Normal
    (non-session) terminal behavior is completely unaffected. Users now
    recover live sessions with `terminology --session=<name>`.
---
 src/bin/termio.c          | 90 +++++++++++++++++++++++++++++++++++------------
 src/bin/termiointernals.h |  6 ++++
 2 files changed, 73 insertions(+), 23 deletions(-)

diff --git a/src/bin/termio.c b/src/bin/termio.c
index b1ff0cdf..9c301f81 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -5,6 +5,7 @@
 #include <Ecore_Input.h>
 
 #include "termio.h"
+#include "termsession.h"
 #include "termiolink.h"
 #include "termpty.h"
 #include "backlog.h"
@@ -3305,7 +3306,12 @@ _smart_size(Evas_Object *obj, int w, int h, Eina_Bool force)
                                        sd->font.chw * sd->grid.w,
                                        sd->font.chh * sd->grid.h);
    termio_sel_set(sd, EINA_FALSE);
-   termpty_resize(sd->pty, w, h);
+#ifdef HAVE_TYMUX
+   if (sd->session)
+       termsession_resize(sd->session, w, h);
+   else
+#endif
+       termpty_resize(sd->pty, w, h);
 
    _smart_calculate(obj);
    _smart_apply(obj);
@@ -3498,7 +3504,18 @@ _smart_del(Evas_Object *obj)
    if (sd->mouse_move_job) ecore_job_del(sd->mouse_move_job);
    if (sd->mouseover_delay) ecore_timer_del(sd->mouseover_delay);
    eina_stringshare_del(sd->font.name);
+#ifdef HAVE_TYMUX
+   if (sd->session)
+     {
+        termsession_free(sd->session);
+        sd->pty = NULL;   /* freed inside termsession_free */
+     }
+   else
+#endif
    if (sd->pty) termpty_free(sd->pty);
+#ifdef HAVE_TYMUX
+   eina_stringshare_del(sd->session_name);
+#endif
    eina_stringshare_del(sd->link.string);
    if (sd->glayer) evas_object_del(sd->glayer);
    if (sd->win)
@@ -4237,7 +4254,7 @@ Evas_Object *
 termio_add(Evas_Object *win, Config *config,
            const char *cmd, Eina_Bool login_shell, const char *cd,
            int w, int h, Term *term, const char *title,
-           const char *session_name EINA_UNUSED)
+           const char *session_name)
 {
    Evas *e;
    Evas_Object *obj, *g;
@@ -4288,29 +4305,56 @@ termio_add(Evas_Object *win, Config *config,
                        _smart_cb_drop, obj);
 
    window_id = elm_win_window_id_get(win);
-   sd->pty = termpty_new(cmd, login_shell, cd, w, h, config, title,
-                         window_id);
-   if (!sd->pty)
+#ifdef HAVE_TYMUX
+   if (session_name && *session_name)
      {
-        ERR(_("Could not allocate termpty"));
-        evas_object_del(obj);
-        return NULL;
+        sd->session_name = eina_stringshare_add(session_name);
+        Termpty *spty = NULL;
+        sd->session = termsession_attach(session_name, w, h, &spty);
+        if (!sd->session)
+          {
+             ERR("Could not attach to tymux session '%s'", session_name);
+             evas_object_del(obj);
+             return NULL;
+          }
+        sd->pty = spty;
+        sd->pty->obj = obj;
+        sd->session->cb_change.func = _smart_pty_change;
+        sd->session->cb_change.data = ""
+        sd->session->cb_title.func  = _smart_pty_title;
+        sd->session->cb_title.data  = ""
+        sd->session->cb_bell.func   = _smart_pty_bell;
+        sd->session->cb_bell.data   = ""
+        sd->session->cb_exit.func   = _smart_pty_exited;
+        sd->session->cb_exit.data   = ""
+     }
+   else
+#endif
+     {
+        sd->pty = termpty_new(cmd, login_shell, cd, w, h, config, title,
+                              window_id);
+        if (!sd->pty)
+          {
+             ERR(_("Could not allocate termpty"));
+             evas_object_del(obj);
+             return NULL;
+          }
+        sd->pty->obj = obj;
+        sd->pty->cb.change.func = _smart_pty_change;
+        sd->pty->cb.change.data = ""
+        sd->pty->cb.set_title.func = _smart_pty_title;
+        sd->pty->cb.set_title.data = ""
+        sd->pty->cb.set_icon.func = _smart_pty_icon;
+        sd->pty->cb.set_icon.data = ""
+        sd->pty->cb.cancel_sel.func = _smart_pty_cancel_sel;
+        sd->pty->cb.cancel_sel.data = ""
+        sd->pty->cb.exited.func = _smart_pty_exited;
+        sd->pty->cb.exited.data = ""
+        sd->pty->cb.bell.func = _smart_pty_bell;
+        sd->pty->cb.bell.data = ""
+        sd->pty->cb.command.func = _smart_pty_command;
+        sd->pty->cb.command.data = ""
      }
-   sd->pty->obj = obj;
-   sd->pty->cb.change.func = _smart_pty_change;
-   sd->pty->cb.change.data = ""
-   sd->pty->cb.set_title.func = _smart_pty_title;
-   sd->pty->cb.set_title.data = ""
-   sd->pty->cb.set_icon.func = _smart_pty_icon;
-   sd->pty->cb.set_icon.data = ""
-   sd->pty->cb.cancel_sel.func = _smart_pty_cancel_sel;
-   sd->pty->cb.cancel_sel.data = ""
-   sd->pty->cb.exited.func = _smart_pty_exited;
-   sd->pty->cb.exited.data = ""
-   sd->pty->cb.bell.func = _smart_pty_bell;
-   sd->pty->cb.bell.data = ""
-   sd->pty->cb.command.func = _smart_pty_command;
-   sd->pty->cb.command.data = ""
    _smart_size(obj, w, h, EINA_TRUE);
    return obj;
 }
diff --git a/src/bin/termiointernals.h b/src/bin/termiointernals.h
index e3d0dbe9..f727388e 100644
--- a/src/bin/termiointernals.h
+++ b/src/bin/termiointernals.h
@@ -5,6 +5,8 @@
 typedef void Term;
 #endif
 
+#include "termsession.h"
+
 typedef struct tag_Termio Termio;
 
 struct tag_Termio
@@ -74,6 +76,10 @@ struct tag_Termio
    Term *term;
 
    Termpty *pty;
+#ifdef HAVE_TYMUX
+   TermSession *session;        /* non-NULL in session mode */
+   const char  *session_name;   /* eina_stringshare */
+#endif
    Ecore_Animator *anim;
    Ecore_Timer *delayed_size_timer;
    Ecore_Timer *link_do_timer;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to