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

git pushed a commit to branch tymux-10-quiet-head
in repository terminology.

View the commit online.

commit cd1074b0ba004e086eced099e71a38125294ee55
Author: Boris Faure <[email protected]>
AuthorDate: Sat Oct 31 22:15:23 2026 +0000

    termio: forward progress changes and expire stale ones
    
    The OSC 9;4 progress state becomes a smart callback, progress,change,
    for the window to draw a bar from. termio fires it only when the
    (state, value) pair differs from what it last showed, so a program
    reporting the same percentage over and over does not flood the UI with
    Edje signals.
    
    The indicator also goes stale: each well-formed report re-arms a timer,
    60 s, or 5 s when the bar is complete. A program that dies or stops
    reporting without saying so has its bar removed; a report-none sequence
    and child exit drop it immediately.
    
    termio_progress_get() is the accessor, on the model of
    termio_file_send_progress_get().
---
 src/bin/termio.c          | 67 +++++++++++++++++++++++++++++++++++++++++++++++
 src/bin/termio.h          |  2 ++
 src/bin/termiointernals.h |  5 ++++
 3 files changed, 74 insertions(+)

diff --git a/src/bin/termio.c b/src/bin/termio.c
index ef53a724..72beafba 100644
--- a/src/bin/termio.c
+++ b/src/bin/termio.c
@@ -3457,6 +3457,19 @@ termio_file_send_progress_get(const Evas_Object *obj)
    return sd->sendfile.progress;
 }
 
+Termpty_Progress_State
+termio_progress_get(const Evas_Object *obj, int *value)
+{
+   Termio *sd = evas_object_smart_data_get(obj);
+
+   if (value)
+     *value = 0;
+   EINA_SAFETY_ON_NULL_RETURN_VAL(sd, TERMPTY_PROGRESS_NONE);
+   if (value)
+     *value = sd->pty->progress.value;
+   return (Termpty_Progress_State)sd->pty->progress.state;
+}
+
 /* {{{ Smart */
 
 static void
@@ -3835,6 +3848,7 @@ _smart_del(Evas_Object *obj)
    if (sd->link_do_timer) ecore_timer_del(sd->link_do_timer);
    if (sd->mouse_move_job) ecore_job_del(sd->mouse_move_job);
    if (sd->mouseover_delay) ecore_timer_del(sd->mouseover_delay);
+   if (sd->progress_stale_timer) ecore_timer_del(sd->progress_stale_timer);
    eina_stringshare_del(sd->font.name);
    if (sd->pty) termpty_free(sd->pty);
    eina_stringshare_del(sd->link.string);
@@ -4034,6 +4048,12 @@ _smart_pty_exited(void *data)
         sd->event = NULL;
      }
 
+   if (sd->progress_stale_timer)
+     {
+        ecore_timer_del(sd->progress_stale_timer);
+        sd->progress_stale_timer = NULL;
+     }
+   termpty_progress_reset(sd->pty);
    term_close(sd->win, sd->self, EINA_TRUE);
 }
 
@@ -4049,6 +4069,51 @@ _smart_pty_bell(void *data)
      edje_object_signal_emit(sd->cursor.obj, "bell,ring", "terminology");
 }
 
+/* The OSC 9;4 progress indicator went stale: the program stopped
+ * reporting or died, so forget the state, which hides the bar. */
+static Eina_Bool
+_smart_pty_progress_stale(void *data)
+{
+   Termio *sd = data;
+
+   sd->progress_stale_timer = NULL;
+   termpty_progress_reset(sd->pty);
+   return ECORE_CALLBACK_CANCEL;
+}
+
+static void
+_smart_pty_progress(void *data)
+{
+   Termio *sd = evas_object_smart_data_get(data);
+
+   EINA_SAFETY_ON_NULL_RETURN(sd);
+   /* Re-arm the staleness timer on every report: a program reporting the
+    * same value over and over is still alive. A completed bar expires
+    * faster, so that it does not outstay the build it reported. */
+   if (sd->progress_stale_timer)
+     {
+        ecore_timer_del(sd->progress_stale_timer);
+        sd->progress_stale_timer = NULL;
+     }
+   if (sd->pty->progress.state != TERMPTY_PROGRESS_NONE)
+     {
+        double timeout = 60.0;
+
+        if ((sd->pty->progress.state == TERMPTY_PROGRESS_NORMAL) &&
+            (sd->pty->progress.value == 100))
+          timeout = 5.0;
+        sd->progress_stale_timer =
+          ecore_timer_add(timeout, _smart_pty_progress_stale, sd);
+     }
+   if ((sd->progress.state != sd->pty->progress.state) ||
+       (sd->progress.value != sd->pty->progress.value))
+     {
+        sd->progress.state = sd->pty->progress.state;
+        sd->progress.value = sd->pty->progress.value;
+        evas_object_smart_callback_call(data, "progress,change", NULL);
+     }
+}
+
 static void
 _handle_query_esc(Termio *sd)
 {
@@ -4652,6 +4717,8 @@ termio_add(Evas_Object *win, Config *config,
    sd->pty->cb.bell.data = ""
    sd->pty->cb.command.func = _smart_pty_command;
    sd->pty->cb.command.data = ""
+   sd->pty->cb.progress.func = _smart_pty_progress;
+   sd->pty->cb.progress.data = ""
    _smart_size(obj, w, h, EINA_TRUE);
    return obj;
 }
diff --git a/src/bin/termio.h b/src/bin/termio.h
index aab11e02..754d1a78 100644
--- a/src/bin/termio.h
+++ b/src/bin/termio.h
@@ -67,6 +67,8 @@ Config      *termio_config_get(const Evas_Object *obj);
 Eina_Bool    termio_file_send_ok(const Evas_Object *obj, const char *file);
 void         termio_file_send_cancel(const Evas_Object *obj);
 double       termio_file_send_progress_get(const Evas_Object *obj);
+Termpty_Progress_State termio_progress_get(const Evas_Object *obj,
+                                           int *value);
 
 void
 termio_imf_cursor_set(Evas_Object *obj, Ecore_IMF_Context *imf);
diff --git a/src/bin/termiointernals.h b/src/bin/termiointernals.h
index 81683964..0d9ccfba 100644
--- a/src/bin/termiointernals.h
+++ b/src/bin/termiointernals.h
@@ -87,6 +87,11 @@ struct tag_Termio
       unsigned long long total, size;
       Eina_Bool active : 1;
    } sendfile;
+   struct {
+      unsigned char state; /* a Termpty_Progress_State, as last shown */
+      unsigned char value;
+   } progress;
+   Ecore_Timer *progress_stale_timer;
    struct {
         int r;
         int g;

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

Reply via email to