• src/doors/termgfx/idle.c idle.h src/doors/termgfx/test/test_idle.csrc/

    From Rob Swindell (on Debian Linux)@1:103/705 to Git commit to main/sbbs/master on Thu Jul 23 00:08:00 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/c045a09e9e98a739b40c80d5
    Added Files:
    src/doors/termgfx/idle.c idle.h src/doors/termgfx/test/test_idle.c Modified Files:
    src/doors/termgfx/CMakeLists.txt src/doors/termgfx/test/CMakeLists.txt Log Message:
    doors/termgfx: add a shared idle-USER clock (idle.h/idle.c)

    Synchronet's per-program "Maximum Inactivity" is structurally inert for every DSR-paced graphical door. It is enforced in input_thread() against a counter that any successful socket read resets, and these doors pace their frame loop with DSR: each frame carries an ESC[6n and the terminal answers on its own about ten times a second. The counter never climbs, so the SCFG setting reads as configured and does nothing.

    Presence therefore has to be judged on real input, which only the door can
    tell apart from its own pacing acks. This adds the clock that lets it do so: a pure module fed a monotonic millisecond stamp and told when genuine user input arrives, returning ACTIVE, WARN (with a seconds-left countdown) or EXPIRED. It does no I/O, no config parsing and no rendering, and keeps no clock of its
    own, so it serves both the doors that own their I/O loop and those driven through termgfx_termio.

    Behavior worth knowing:

    - A threshold of 0 disables it outright. That is both the unconfigured path
    and the exempt-user path, so it must never warn.
    - Activity during the countdown restarts the whole clock; there is no penalty
    for having been warned.
    - A warn window larger than the threshold is clamped, rather than allowed to
    underflow into never firing.
    - Elapsed time is a signed difference, so a wrapped millisecond clock reads as
    a small elapsed instead of ~4 billion and cannot expire a present user.

    test_idle covers each of those, including the wrap, and runs as the third termgfx unit test. No door consumes this yet; the callers follow.

    Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
    --- SBBSecho 3.37-Linux
    * Origin: Vertrauen - [vert/cvs/bbs].synchro.net (1:103/705)