A full-featured web browser for the terminal using Chromium (CEF) with support for Sixel and Kitty graphics protocols. brow6el.dev

Konsole support: render the page, keep it aligned and make clicks land #19

Merged janantos.tngl.sh
targeting main from mendezr.tngl.sh/brow6el:konsole-support
Merged opened by and assigned to janantos.tngl.sh
targeting main from mendezr.tngl.sh/brow6el:konsole-support

In KDE Konsole brow6el showed an empty window, and once that was fixed the page was drawn one row too high and clicks near the edge of buttons missed (for example "Accepter tout" in the yahoo.fr consent dialog). Four commits, each one usable on its own:

  1. Clamp the sixel geometry to the window size. Konsole answers the XTSMGRAPHICS query (CSI ? 2;1;0 S) with its maximum image size, 16384x16144, so every frame had that size and Konsole drew nothing. An image cannot be larger than the window, so the size reported through TIOCGWINSZ now caps it. xterm, whose sixel limit is smaller than its window, keeps its value.
  2. Keep the image within whole rows and sixel bands. The reserved last row was computed from the pixel height, which can include a margin smaller than a row, and terminals draw the last 6 pixel band in full. The image reached into the last row and Konsole scrolled the screen by one row after each frame, leaving a black band at the bottom and drawing the page 15 px higher than the mouse coordinates put it.
  3. Use pixel mouse coordinates when the terminal supports them. With SGR mouse mode only the cell is known (8x15 px here) and a click is mapped to the cell centre. SGR-Pixels (DEC 1016) is enabled when DECRQM reports it (kitty, xterm) or XTVERSION says Konsole, which supports it without answering DECRQM.
  4. Accept button releases that do not name the button. In that mode Konsole reports a release as button 3; it was dropped, so the click never completed.

Konsole before and after: empty window, rendered page

Page drawn one row too high, then aligned

Clicking the yahoo.fr consent button: before it does nothing, after it closes

Tested with Konsole 26.04 under Xvfb and in a real Konsole over SSH: a button at CSS y=400 is now drawn where expected and a click 2 px inside its top edge reaches it. Also checked in kitty and xterm. Builds on current main and merges cleanly with the open pull requests.

Commits 0