• src/doors/termgfx/test/test_termgfx_termio_mouse_drawn.csrc/doors/term

    From Rob Swindell (on Debian Linux)@1:103/705 to Git commit to main/sbbs/master on Sun Jul 26 01:15:28 2026
    https://gitlab.synchro.net/main/sbbs/-/commit/55237f6a0599715342ca457a
    Added Files:
    src/doors/termgfx/test/test_termgfx_termio_mouse_drawn.c
    Modified Files:
    src/doors/termgfx/termgfx_termio.c src/doors/termgfx/test/unit_termgfx_termio.sh
    Log Message:
    termgfx: map the mouse against the rect the frame was drawn in

    The same defect just fixed in syncconquer lives here, and here it is worse.
    The mapper asked termgfx_image_rect() where the image goes, which answers
    what the CENTERING wanted. Two things then move it before it reaches the terminal: a sixel is placed by CUP, so its true origin is the addressed
    cell's pixel -- the offset rounded down to the cell grid -- and the vstep
    trim can shrink and re-centre the image after that rect was computed.
    Neither is visible to the mapper, so every click carried the difference as
    a constant bias.

    It goes the way that hurts. The image is drawn ABOVE where the mapper
    believes it starts, so clicks map high and the top edge of a target stops answering. At the geometry a live Windows Terminal reported -- 1330x1480,
    20px cells -- the fit asks for 1330x831 at y=314, the trim takes it to 1248x780, and it is finally drawn at y=320: an origin the mapper had no way
    to know. This one costs syncscumm most, where pointing at things IS the
    game.

    present() now records the rect it actually drew, on both the indexed and truecolor paths, and the mapper inverts that, falling back to the requested rect only before the first frame. JXL is placed by pixel offset and was
    already exact; recording it there too keeps one answer rather than two.

    The test drives a real present at that geometry and reads the placement off
    the WIRE -- the CUP that positions the sixel and the raster attributes that state its size -- then clicks the image's own corners. The far corner is
    what pins it: the near corner clamps to (0,0) whether the mapper is biased
    or not, so only the far one fails when it is.

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