diff --git a/AGENTS.md b/AGENTS.md index 295bc80..fcce8be 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -11,12 +11,13 @@ It uses a pure **X11 (`Xlibre` + `sxmo-de-dwm`)** stack (no Wayland) with **Adre - `src/neoui/`: **NeoUI** `240x320` UI SDK (`neoui.h` -> `/usr/include/neoui.h`, `neoui.cpp` -> `/usr/lib/libneoui.so`) providing both a C-compatible FFI (`neoui_*`) and C++20 classes (`ThemeSpec`, `PluginTheme`, `NeoWindow`) for `.Xresources` / `~/.xthemes/*.xth` theme resolution, Xlib/Xft/Pango window and offscreen `Pixmap` double buffering, standardized OS shell widgets, keypad/softkey chord handling, and multi-tap input (paired with Yabasic FFI libraries `neoui.yab` and `neonet.yab` + examples `neoui_demo.yab`, `neonet_demo.yab`, and `bulls_cows.yab` in `overlay/rootfs/home/user/Projects/`). - `src/dwm-plugins/`: preloaded C++20 `240x320` DWM plugins linked against `libneoui.so` and shared headers: - `theme.h`: header forwarding to `../neoui/neoui.h` for unified `.Xresources` / `~/.xthemes/*.xth` parsing, proportional font sizing (`theme.baseFontSize`), automatic shade derivation, and live Xft/Pango theme reloading (`PluginTheme`). - - `phone_data.h`: shared X11 geometry (`240x296` below the 24px bar), FIFO IPC (`/tmp/dwm_plugin_.fifo`), softkey chord detection, Sxmo TSV contact/call/SMS parsers, and `libjpeg`/`libpng` helpers. + - `phone_data.h`: shared X11 geometry (`240x296` below the 24px bar), FIFO IPC (`/tmp/dwm_plugin_.fifo`), softkey chord detection, Sxmo TSV contact/call/SMS parsers (`parseSmsHeaderLine()` / `stripSmsSimTag()` tolerate the QMI WMS `[SIM n]` header tag), and `libjpeg`/`libpng` helpers. - `net_tls.h`: shared C++20 TCP + OpenSSL TLS + STARTTLS socket class (`NetStream`), HTTP/HTTPS `GET` client (`httpGet`), MD5/CSPRNG helpers, and RFC 2047 / Base64 / Quoted-Printable MIME decoders. - `pjsip_media.h`: PJSIP (`pjproject` / `pjmedia-codec/g722` & `pjmedia/alaw_ulaw`) ITU-T G.722 wideband 16 kHz SB-ADPCM and G.711 PCMU/PCMA codec implementation for `sip.so`. - `monotone.h` + `bananarchy_melody.cpp` (`/usr/bin/bananarchy-melody`): Nokia RTTTL (`.nrt`, `.rtttl`, `.rtx`), Ericsson eMelody (`.emy`), and IrDA iMelody (`.imy`) monophonic ringtone parser and 48 kHz WAV synthesizer. - `locker_plugin.cpp` (`locker.so` / `xlocker`) + `verify_passcode.c` (`/usr/bin/bananarchy-verify-passcode`), `passcode_plugin.cpp` (`passcode.so` / `xpasscode`), `dialer_plugin.cpp` (`dialer.so` / `xdialer`), `calllog_plugin.cpp` (`calllog.so` / `xcalllog`), `callscreen_plugin.cpp` (`callscreen.so` / `xcallscreen`), `contacts_plugin.cpp` (`contacts.so` / `xcontacts`), `sms_plugin.cpp` (`sms.so` / `xsms`), `files_plugin.cpp` (`files.so` / `xfiles`), `camera_plugin.cpp` (`camera.so` / `xcamera`), `themes_plugin.cpp` (`themes.so` / `xthemes`), `modem_plugin.cpp` (`modem.so` / `xmodem`), `networks_plugin.cpp` (`networks.so` / `xnetworks` / `xbluetooth`), `ringtones_plugin.cpp` (`ringtones.so` / `xringtones`), `wallpapers_plugin.cpp` (`wallpapers.so` / `xwallpapers` / `xbackground`), `music_plugin.cpp` (`music.so` / `xmusic` / `xplayer`), `sip_plugin.cpp` (`sip.so` / `xsip`), `email_plugin.cpp` (`email.so` / `xemail` / `xmail`), `irc_plugin.cpp` (`irc.so` / `xirc`), `tox_plugin.cpp` (`tox.so` / `xtox`), `smallweb_plugin.cpp` (`smallweb.so` / `xkopher` / `kopher` / `xsmallweb`), `webarchy_plugin.cpp` (`webarchy.so` / `webarchy` / `xwebarchy`), `gps_plugin.cpp` (`gps.so` / `xgps` / `xmaps` / `xnav`), `privacy_plugin.cpp` (`privacy.so` / `xprivacy` / `privacy`), `engmenu_plugin.cpp` (`engmenu.so` / `xengmenu`). - `dwm_plugin_runner.c`: lightweight `/usr/bin/dwm-plugin` launcher symlinked by `xlocker`, `xpasscode`, `xdrawer`, `xdialer`, `xcalllog`, `xcallscreen`, `xcontacts`, `xsms`, `xfiles`, `xcamera`, `xthemes`, `xmodem`, `xnetworks`, `xbluetooth`, `xringtones`, `xwallpapers`, `xbackground`, `xmusic`, `xplayer`, `xsip`, `xemail`, `xmail`, `xirc`, `xtox`, `xkopher`, `kopher`, `xsmallweb`, `webarchy`, `xwebarchy`, `xgps`, `xmaps`, `xnav`, `xprivacy`, `privacy`, `xengmenu`, `dmenu`, and `xdmenu`. + - `sms_plugin.cpp` (`sms.so` / `xsms`): threaded conversation view whose message bodies are drawn line by line and clipped to the bubble by `renderLayoutLines()`, with a per-message scroll offset (`msgScrollPx`) and right-edge scrollbar; `smsTextMetrics()` accounts GSM-7 septets versus UCS-2 UTF-16 units and concatenated part limits. Reads `sms.txt` logs written by the QMI WMS daemon after 8-bit/16-bit concatenated SMS reassembly. - `src/xdrawer/`: global phone controls overlay (`xdrawer.so` / `xdrawer`), toggled by pressing both softkeys simultaneously. - `src/sxmo-st/`: patched `st` terminal with HarfBuzz OpenType ligatures (`Fira Code`), `XIM` (`fcitx5-t9`), and live `SIGUSR1` `.Xresources` reload. - `src/fcitx5-t9/`: 6-mode keypad input method (`abc`, `Abc`, `ABC`, `Sym`, `Ctl`, `123` + `*` long-press `Ctrl+` latch) with fixed bottom preedit bar (`Y=290, H=30`). @@ -31,7 +32,7 @@ It uses a pure **X11 (`Xlibre` + `sxmo-de-dwm`)** stack (no Wayland) with **Adre - `scripts/prune-rootfs-packages.sh`: two-phase rootfs pruner (`world` before `apk add`, `purge` after) that reads the denylist and pins `install_if` packages with negative `!pkg` world constraints plus `apk fix`; the `world` phase is required so apk can atomically replace Rust `sudo-rs` with C `sudo`. ## 3. Build and image generation commands -All cross-compilation scripts run inside rootless Docker (`alpine:3.24` `armv7` sysroot) and write to `prebuilt/`; `rebuild-image.sh` mirrors those artifacts into `overlay/rootfs/`: +All cross-compilation scripts run inside rootless Docker (`alpine:3.24` `armv7` sysroot) and write to `prebuilt/`; `build-sxmo-x11.sh`, `sync-prebuilt-overlay.sh`, and `rebuild-image.sh` mirror those artifacts into `overlay/rootfs/` (and `build-sxmo-x11.sh` also refreshes `rootfs/` when present): - `./scripts/build-sxmo-x11.sh` — builds `libneoui.so`, `st`, `dmenu.so`, `dwm`, `dwm-plugin`, `bananarchy-verify-passcode`, `bananarchy-melody`, `sxmo_vibrate`, and all C++ `.so` plugins (`locker`, `passcode`, `xdrawer`, `dialer`, `calllog`, `callscreen`, `contacts`, `sms`, `files`, `camera`, `themes`, `modem`, `networks`, `ringtones`, `wallpapers`, `music`, `sip`, `email`, `irc`, `tox`, `smallweb`, `webarchy`, `gps`, `privacy`, `engmenu`). - `./scripts/build-gsocket.sh` — fetches and cross-compiles `gsocket` (`gs-netcat`, `gsocket`, `gs-sftp`, `gs-mount`, `blitz`) for `armv7`. - `./scripts/build-dmenu.sh` — rebuilds only `dmenu.so`, `stest`, `dmenu_path`, and `dmenu_run`. @@ -46,7 +47,7 @@ All cross-compilation scripts run inside rootless Docker (`alpine:3.24` `armv7` - `./rebuild-image.sh [--mkinitfs]` — verifies the clone, syncs `prebuilt/` into `overlay/rootfs/`, bootstraps `rootfs/` from scratch when missing, applies the overlay, and produces flashable images in `images/`. - `./scripts/bootstrap-rootfs.sh [rootfs-dir] [device] [--force|--check]` — creates a complete `armv7` rootfs from `scripts/rootfs-packages.txt` inside rootless Docker; idempotent via `etc/bananarchy/rootfs-bootstrap.done`. - `./scripts/prune-rootfs-packages.sh world|purge` — removes Wayland-only, Rust-based, and retired packages from a target rootfs inside the build container. -- `./scripts/check-rebuild.sh` — offline preflight for a clean clone (syntax, package list, plugin artifacts, overlay sync, ignored local agent config, Docker, version helper). +- `./scripts/check-rebuild.sh` — offline preflight for a clean clone (syntax, package list, plugin artifacts, overlay sync, SMS long-message rendering guard, ignored local agent config, Docker, version helper). - `./scripts/sync-prebuilt-overlay.sh [--check]` — mirrors `prebuilt/` artifacts into `overlay/rootfs/`; `--check` only reports drift. - `./scripts/bootstrap-flash-deps.sh` — installs `pyusb` and `pyserial` into the gitignored `.flash-deps/` directory for `flash-edl.py`. - `sudo ./flash-edl.sh [device]` — flashes `lk2nd` and the system image over Qualcomm USB EDL (`05c6:9008`), using the vendored `vendor/edl/` library and auto-installed host dependencies. @@ -56,6 +57,8 @@ All cross-compilation scripts run inside rootless Docker (`alpine:3.24` `armv7` - **No emojis**: never use emojis in source code, UI strings, logs, or commit messages (use Nerd Font PUA codepoints defined in `neoui.h` / `phone_data.h` / `dmenu.c` for UI icons). - **Unified theming**: never hardcode UI colors or font sizes in `dwm`, `dmenu`, `st`, or any DWM plugin. Read colors and proportional font sizes from `PluginTheme` (`src/neoui/neoui.h` / `src/dwm-plugins/theme.h`) / `.Xresources` (`theme.*`), and handle `RELOAD_THEME` on the plugin FIFO. - **Zero-lag plugin model**: phone UI apps must run as preloaded resident daemons (`--preload`) guarded by `/tmp/dwm_plugin_.lock`, sleeping at 0% CPU on `poll()` over `ConnectionNumber(dpy)` and `/tmp/dwm_plugin_.fifo`, and rendering into an offscreen `Pixmap` (`240x296` at `X=0, Y=24`) copied with `XCopyArea` to prevent flicker. +- **Multiline text rendering**: on the target Pango/Xft stack `pango_xft_render_layout()` only paints the first line of a long multiline layout, so wrapped bodies must be drawn line by line with `pango_xft_render_layout_line()` using a scroll offset and a bounded visible line count (see `sms_plugin.cpp`, `dialer_plugin.cpp`, `modem_plugin.cpp`, and `neoui_draw_text_wrapped()`). Where the widget has a fixed rectangle, clip with `XftDrawSetClipRectangles()` and reset the clip afterwards so the softkey bar still draws; keep measurement and rendering at the same layout width. `scripts/check-rebuild.sh` guards `sms_plugin.cpp`. +- **SMS text accounting**: never treat `std::string::size()` (UTF-8 bytes) as an SMS character count. Use code-point-aware logic such as `smsTextMetrics()`: GSM-7 septets (160 per part, 153 when concatenated) or UCS-2 UTF-16 units (70 per part, 67 when concatenated). SMS log headers are parsed by `parseSmsHeaderLine()`, which strips `[SIM n]` tags; do not write those tags back into `sms.txt`. - **Documentation**: keep `README.md`, `MANUAL.md`, `SDK.md`, and `CHANGELOG.md` synchronized with any new user-facing features, SDK functions, or keybindings, and do not leave third-party `.md` files inside `src/` or `edl/`. - **Artifact sources**: `prebuilt/` is the single source of truth for compiled artifacts and `scripts/rootfs-packages.txt` for the `armv7` package set. Never edit `overlay/rootfs/` copies of binaries by hand; run `./scripts/sync-prebuilt-overlay.sh` after changing `prebuilt/`. - **Package hygiene**: keep `scripts/rootfs-packages.txt` free of Rust-based top-level packages (use C `sudo`, never `sudo-rs`) and Wayland-purpose packages; `libwpe` and the `wayland-libs-*` shared libraries stay because GTK3/WebKitGTK link them directly, but no Wayland compositor, backend, or viewer is shipped. `scripts/check-rebuild.sh` enforces this. diff --git a/CHANGELOG.md b/CHANGELOG.md index a0fc002..dbd95c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ Release versions follow the `
` format (where `2026` is `a`, - Replaced the byte-based `composeText.size()/160` counter with `smsTextMetrics()`, which decodes UTF-8 code points, detects the 3GPP TS 23.038 GSM 7-bit alphabet plus extension table, and reports GSM-7 septets (160 per part, 153 when concatenated) or UCS-2 UTF-16 units (70 per part, 67 when concatenated) with the correct part count. The offline-send fallback log now records units instead of bytes. - `parseSmsHeaderLine()` strips the `[SIM n]` tag written by the QMI WMS daemon (`Received from 5050 [SIM 1] at …:`) and by older local send fallbacks (`Sent at … [SIM 1]:`), so senders and ISO timestamps stay clean; the fallback no longer writes the tag into `sms.txt`. - Added a `scripts/check-rebuild.sh` guard that rejects a bulk `pango_xft_render_layout()` call in `sms_plugin.cpp` and requires the line-by-line renderer, scroll state, encoding metrics, and SIM-tag stripping. +- Updated `AGENTS.md` with the multiline Pango/Xft rendering convention, the SMS text-accounting rule, the `sms_plugin.cpp` layout, and the new preflight guard. ### Remove the remaining optional scripting runtimes - Removed `perl`, `perl-io-socket-ssl`, `tcl-lib`, `tcl-tls`, `sqlite-tcl`, `lua5.4`, `lua5.4-dev`, `lua5.5`, `lua5.5-dev`, and `sqlite` (CLI) from `scripts/rootfs-packages.txt` and added them to the prune denylist: 13 packages / 49.45 MiB including dependents. `sqlite-libs`, `tcl`, and all paramount runtimes stay.